]> git.openstreetmap.org Git - rails.git/blob - vendor/assets/iD/iD.js
Hash passwords as soon as a new user is created
[rails.git] / vendor / assets / iD / iD.js
1 (() => {
2   var __create = Object.create;
3   var __defProp = Object.defineProperty;
4   var __defProps = Object.defineProperties;
5   var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6   var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7   var __getOwnPropNames = Object.getOwnPropertyNames;
8   var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9   var __getProtoOf = Object.getPrototypeOf;
10   var __hasOwnProp = Object.prototype.hasOwnProperty;
11   var __propIsEnum = Object.prototype.propertyIsEnumerable;
12   var __knownSymbol = (name, symbol) => {
13     if (symbol = Symbol[name])
14       return symbol;
15     throw Error("Symbol." + name + " is not defined");
16   };
17   var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
18   var __spreadValues = (a2, b2) => {
19     for (var prop in b2 || (b2 = {}))
20       if (__hasOwnProp.call(b2, prop))
21         __defNormalProp(a2, prop, b2[prop]);
22     if (__getOwnPropSymbols)
23       for (var prop of __getOwnPropSymbols(b2)) {
24         if (__propIsEnum.call(b2, prop))
25           __defNormalProp(a2, prop, b2[prop]);
26       }
27     return a2;
28   };
29   var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
30   var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
31     get: (a2, b2) => (typeof require !== "undefined" ? require : a2)[b2]
32   }) : x2)(function(x2) {
33     if (typeof require !== "undefined")
34       return require.apply(this, arguments);
35     throw Error('Dynamic require of "' + x2 + '" is not supported');
36   });
37   var __commonJS = (cb, mod) => function __require2() {
38     return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
39   };
40   var __export = (target, all) => {
41     for (var name in all)
42       __defProp(target, name, { get: all[name], enumerable: true });
43   };
44   var __copyProps = (to, from, except, desc) => {
45     if (from && typeof from === "object" || typeof from === "function") {
46       for (let key of __getOwnPropNames(from))
47         if (!__hasOwnProp.call(to, key) && key !== except)
48           __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
49     }
50     return to;
51   };
52   var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
53     // If the importer is in node compatibility mode or this is not an ESM
54     // file that has been converted to a CommonJS file using a Babel-
55     // compatible transform (i.e. "__esModule" has not been set), then set
56     // "default" to the CommonJS "module.exports" for node compatibility.
57     isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
58     mod
59   ));
60   var __publicField = (obj, key, value) => {
61     __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
62     return value;
63   };
64   var __accessCheck = (obj, member, msg) => {
65     if (!member.has(obj))
66       throw TypeError("Cannot " + msg);
67   };
68   var __privateAdd = (obj, member, value) => {
69     if (member.has(obj))
70       throw TypeError("Cannot add the same private member more than once");
71     member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
72   };
73   var __privateMethod = (obj, member, method) => {
74     __accessCheck(obj, member, "access private method");
75     return method;
76   };
77   var __await = function(promise, isYieldStar) {
78     this[0] = promise;
79     this[1] = isYieldStar;
80   };
81   var __yieldStar = (value) => {
82     var obj = value[__knownSymbol("asyncIterator")];
83     var isAwait = false;
84     var method;
85     var it = {};
86     if (obj == null) {
87       obj = value[__knownSymbol("iterator")]();
88       method = (k2) => it[k2] = (x2) => obj[k2](x2);
89     } else {
90       obj = obj.call(value);
91       method = (k2) => it[k2] = (v2) => {
92         if (isAwait) {
93           isAwait = false;
94           if (k2 === "throw")
95             throw v2;
96           return v2;
97         }
98         isAwait = true;
99         return {
100           done: false,
101           value: new __await(new Promise((resolve) => {
102             var x2 = obj[k2](v2);
103             if (!(x2 instanceof Object))
104               throw TypeError("Object expected");
105             resolve(x2);
106           }), 1)
107         };
108       };
109     }
110     return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x2) => {
111       throw x2;
112     }, "return" in obj && method("return"), it;
113   };
114
115   // node_modules/diacritics/index.js
116   var require_diacritics = __commonJS({
117     "node_modules/diacritics/index.js"(exports2) {
118       exports2.remove = removeDiacritics2;
119       var replacementList = [
120         {
121           base: " ",
122           chars: "\xA0"
123         },
124         {
125           base: "0",
126           chars: "\u07C0"
127         },
128         {
129           base: "A",
130           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"
131         },
132         {
133           base: "AA",
134           chars: "\uA732"
135         },
136         {
137           base: "AE",
138           chars: "\xC6\u01FC\u01E2"
139         },
140         {
141           base: "AO",
142           chars: "\uA734"
143         },
144         {
145           base: "AU",
146           chars: "\uA736"
147         },
148         {
149           base: "AV",
150           chars: "\uA738\uA73A"
151         },
152         {
153           base: "AY",
154           chars: "\uA73C"
155         },
156         {
157           base: "B",
158           chars: "\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0181"
159         },
160         {
161           base: "C",
162           chars: "\u24B8\uFF23\uA73E\u1E08\u0106C\u0108\u010A\u010C\xC7\u0187\u023B"
163         },
164         {
165           base: "D",
166           chars: "\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018A\u0189\u1D05\uA779"
167         },
168         {
169           base: "Dh",
170           chars: "\xD0"
171         },
172         {
173           base: "DZ",
174           chars: "\u01F1\u01C4"
175         },
176         {
177           base: "Dz",
178           chars: "\u01F2\u01C5"
179         },
180         {
181           base: "E",
182           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"
183         },
184         {
185           base: "F",
186           chars: "\uA77C\u24BB\uFF26\u1E1E\u0191\uA77B"
187         },
188         {
189           base: "G",
190           chars: "\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E\u0262"
191         },
192         {
193           base: "H",
194           chars: "\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"
195         },
196         {
197           base: "I",
198           chars: "\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"
199         },
200         {
201           base: "J",
202           chars: "\u24BF\uFF2A\u0134\u0248\u0237"
203         },
204         {
205           base: "K",
206           chars: "\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"
207         },
208         {
209           base: "L",
210           chars: "\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"
211         },
212         {
213           base: "LJ",
214           chars: "\u01C7"
215         },
216         {
217           base: "Lj",
218           chars: "\u01C8"
219         },
220         {
221           base: "M",
222           chars: "\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C\u03FB"
223         },
224         {
225           base: "N",
226           chars: "\uA7A4\u0220\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u019D\uA790\u1D0E"
227         },
228         {
229           base: "NJ",
230           chars: "\u01CA"
231         },
232         {
233           base: "Nj",
234           chars: "\u01CB"
235         },
236         {
237           base: "O",
238           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"
239         },
240         {
241           base: "OE",
242           chars: "\u0152"
243         },
244         {
245           base: "OI",
246           chars: "\u01A2"
247         },
248         {
249           base: "OO",
250           chars: "\uA74E"
251         },
252         {
253           base: "OU",
254           chars: "\u0222"
255         },
256         {
257           base: "P",
258           chars: "\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"
259         },
260         {
261           base: "Q",
262           chars: "\u24C6\uFF31\uA756\uA758\u024A"
263         },
264         {
265           base: "R",
266           chars: "\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"
267         },
268         {
269           base: "S",
270           chars: "\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"
271         },
272         {
273           base: "T",
274           chars: "\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"
275         },
276         {
277           base: "Th",
278           chars: "\xDE"
279         },
280         {
281           base: "TZ",
282           chars: "\uA728"
283         },
284         {
285           base: "U",
286           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"
287         },
288         {
289           base: "V",
290           chars: "\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"
291         },
292         {
293           base: "VY",
294           chars: "\uA760"
295         },
296         {
297           base: "W",
298           chars: "\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"
299         },
300         {
301           base: "X",
302           chars: "\u24CD\uFF38\u1E8A\u1E8C"
303         },
304         {
305           base: "Y",
306           chars: "\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"
307         },
308         {
309           base: "Z",
310           chars: "\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"
311         },
312         {
313           base: "a",
314           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"
315         },
316         {
317           base: "aa",
318           chars: "\uA733"
319         },
320         {
321           base: "ae",
322           chars: "\xE6\u01FD\u01E3"
323         },
324         {
325           base: "ao",
326           chars: "\uA735"
327         },
328         {
329           base: "au",
330           chars: "\uA737"
331         },
332         {
333           base: "av",
334           chars: "\uA739\uA73B"
335         },
336         {
337           base: "ay",
338           chars: "\uA73D"
339         },
340         {
341           base: "b",
342           chars: "\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253\u0182"
343         },
344         {
345           base: "c",
346           chars: "\uFF43\u24D2\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"
347         },
348         {
349           base: "d",
350           chars: "\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\u018B\u13E7\u0501\uA7AA"
351         },
352         {
353           base: "dh",
354           chars: "\xF0"
355         },
356         {
357           base: "dz",
358           chars: "\u01F3\u01C6"
359         },
360         {
361           base: "e",
362           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"
363         },
364         {
365           base: "f",
366           chars: "\u24D5\uFF46\u1E1F\u0192"
367         },
368         {
369           base: "ff",
370           chars: "\uFB00"
371         },
372         {
373           base: "fi",
374           chars: "\uFB01"
375         },
376         {
377           base: "fl",
378           chars: "\uFB02"
379         },
380         {
381           base: "ffi",
382           chars: "\uFB03"
383         },
384         {
385           base: "ffl",
386           chars: "\uFB04"
387         },
388         {
389           base: "g",
390           chars: "\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\uA77F\u1D79"
391         },
392         {
393           base: "h",
394           chars: "\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"
395         },
396         {
397           base: "hv",
398           chars: "\u0195"
399         },
400         {
401           base: "i",
402           chars: "\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"
403         },
404         {
405           base: "j",
406           chars: "\u24D9\uFF4A\u0135\u01F0\u0249"
407         },
408         {
409           base: "k",
410           chars: "\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"
411         },
412         {
413           base: "l",
414           chars: "\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747\u026D"
415         },
416         {
417           base: "lj",
418           chars: "\u01C9"
419         },
420         {
421           base: "m",
422           chars: "\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"
423         },
424         {
425           base: "n",
426           chars: "\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5\u043B\u0509"
427         },
428         {
429           base: "nj",
430           chars: "\u01CC"
431         },
432         {
433           base: "o",
434           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"
435         },
436         {
437           base: "oe",
438           chars: "\u0153"
439         },
440         {
441           base: "oi",
442           chars: "\u01A3"
443         },
444         {
445           base: "oo",
446           chars: "\uA74F"
447         },
448         {
449           base: "ou",
450           chars: "\u0223"
451         },
452         {
453           base: "p",
454           chars: "\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755\u03C1"
455         },
456         {
457           base: "q",
458           chars: "\u24E0\uFF51\u024B\uA757\uA759"
459         },
460         {
461           base: "r",
462           chars: "\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"
463         },
464         {
465           base: "s",
466           chars: "\u24E2\uFF53\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B\u0282"
467         },
468         {
469           base: "ss",
470           chars: "\xDF"
471         },
472         {
473           base: "t",
474           chars: "\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"
475         },
476         {
477           base: "th",
478           chars: "\xFE"
479         },
480         {
481           base: "tz",
482           chars: "\uA729"
483         },
484         {
485           base: "u",
486           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"
487         },
488         {
489           base: "v",
490           chars: "\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"
491         },
492         {
493           base: "vy",
494           chars: "\uA761"
495         },
496         {
497           base: "w",
498           chars: "\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"
499         },
500         {
501           base: "x",
502           chars: "\u24E7\uFF58\u1E8B\u1E8D"
503         },
504         {
505           base: "y",
506           chars: "\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"
507         },
508         {
509           base: "z",
510           chars: "\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"
511         }
512       ];
513       var diacriticsMap = {};
514       for (i3 = 0; i3 < replacementList.length; i3 += 1) {
515         chars = replacementList[i3].chars;
516         for (j3 = 0; j3 < chars.length; j3 += 1) {
517           diacriticsMap[chars[j3]] = replacementList[i3].base;
518         }
519       }
520       var chars;
521       var j3;
522       var i3;
523       function removeDiacritics2(str2) {
524         return str2.replace(/[^\u0000-\u007e]/g, function(c2) {
525           return diacriticsMap[c2] || c2;
526         });
527       }
528       exports2.replacementList = replacementList;
529       exports2.diacriticsMap = diacriticsMap;
530     }
531   });
532
533   // node_modules/alif-toolkit/lib/isArabic.js
534   var require_isArabic = __commonJS({
535     "node_modules/alif-toolkit/lib/isArabic.js"(exports2) {
536       "use strict";
537       Object.defineProperty(exports2, "__esModule", { value: true });
538       var arabicBlocks = [
539         [1536, 1791],
540         [1872, 1919],
541         [2208, 2303],
542         [64336, 65023],
543         [65136, 65279],
544         [69216, 69247],
545         [126064, 126143],
546         [126464, 126719]
547         // Mathematical Alphabetic symbols https://www.unicode.org/charts/PDF/U1EE00.pdf
548       ];
549       function isArabic(char) {
550         if (char.length > 1) {
551           throw new Error("isArabic works on only one-character strings");
552         }
553         let code = char.charCodeAt(0);
554         for (let i3 = 0; i3 < arabicBlocks.length; i3++) {
555           let block2 = arabicBlocks[i3];
556           if (code >= block2[0] && code <= block2[1]) {
557             return true;
558           }
559         }
560         return false;
561       }
562       exports2.isArabic = isArabic;
563       function isMath(char) {
564         if (char.length > 2) {
565           throw new Error("isMath works on only one-character strings");
566         }
567         let code = char.charCodeAt(0);
568         return code >= 1632 && code <= 1644 || code >= 1776 && code <= 1785;
569       }
570       exports2.isMath = isMath;
571     }
572   });
573
574   // node_modules/alif-toolkit/lib/unicode-arabic.js
575   var require_unicode_arabic = __commonJS({
576     "node_modules/alif-toolkit/lib/unicode-arabic.js"(exports2) {
577       "use strict";
578       Object.defineProperty(exports2, "__esModule", { value: true });
579       var arabicReference = {
580         "alef": {
581           "normal": [
582             "\u0627"
583           ],
584           "madda_above": {
585             "normal": [
586               "\u0627\u0653",
587               "\u0622"
588             ],
589             "isolated": "\uFE81",
590             "final": "\uFE82"
591           },
592           "hamza_above": {
593             "normal": [
594               "\u0627\u0654",
595               "\u0623"
596             ],
597             "isolated": "\uFE83",
598             "final": "\uFE84"
599           },
600           "hamza_below": {
601             "normal": [
602               "\u0627\u0655",
603               "\u0625"
604             ],
605             "isolated": "\uFE87",
606             "final": "\uFE88"
607           },
608           "wasla": {
609             "normal": "\u0671",
610             "isolated": "\uFB50",
611             "final": "\uFB51"
612           },
613           "wavy_hamza_above": [
614             "\u0672"
615           ],
616           "wavy_hamza_below": [
617             "\u0627\u065F",
618             "\u0673"
619           ],
620           "high_hamza": [
621             "\u0675",
622             "\u0627\u0674"
623           ],
624           "indic_two_above": [
625             "\u0773"
626           ],
627           "indic_three_above": [
628             "\u0774"
629           ],
630           "fathatan": {
631             "normal": [
632               "\u0627\u064B"
633             ],
634             "final": "\uFD3C",
635             "isolated": "\uFD3D"
636           },
637           "isolated": "\uFE8D",
638           "final": "\uFE8E"
639         },
640         "beh": {
641           "normal": [
642             "\u0628"
643           ],
644           "dotless": [
645             "\u066E"
646           ],
647           "three_dots_horizontally_below": [
648             "\u0750"
649           ],
650           "dot_below_three_dots_above": [
651             "\u0751"
652           ],
653           "three_dots_pointing_upwards_below": [
654             "\u0752"
655           ],
656           "three_dots_pointing_upwards_below_two_dots_above": [
657             "\u0753"
658           ],
659           "two_dots_below_dot_above": [
660             "\u0754"
661           ],
662           "inverted_small_v_below": [
663             "\u0755"
664           ],
665           "small_v": [
666             "\u0756"
667           ],
668           "small_v_below": [
669             "\u08A0"
670           ],
671           "hamza_above": [
672             "\u08A1"
673           ],
674           "small_meem_above": [
675             "\u08B6"
676           ],
677           "isolated": "\uFE8F",
678           "final": "\uFE90",
679           "initial": "\uFE91",
680           "medial": "\uFE92"
681         },
682         "teh marbuta": {
683           "normal": [
684             "\u0629"
685           ],
686           "isolated": "\uFE93",
687           "final": "\uFE94"
688         },
689         "teh": {
690           "normal": [
691             "\u062A"
692           ],
693           "ring": [
694             "\u067C"
695           ],
696           "three_dots_above_downwards": [
697             "\u067D"
698           ],
699           "small_teh_above": [
700             "\u08B8"
701           ],
702           "isolated": "\uFE95",
703           "final": "\uFE96",
704           "initial": "\uFE97",
705           "medial": "\uFE98"
706         },
707         "theh": {
708           "normal": [
709             "\u062B"
710           ],
711           "isolated": "\uFE99",
712           "final": "\uFE9A",
713           "initial": "\uFE9B",
714           "medial": "\uFE9C"
715         },
716         "jeem": {
717           "normal": [
718             "\u062C"
719           ],
720           "two_dots_above": [
721             "\u08A2"
722           ],
723           "isolated": "\uFE9D",
724           "final": "\uFE9E",
725           "initial": "\uFE9F",
726           "medial": "\uFEA0"
727         },
728         "hah": {
729           "normal": [
730             "\u062D"
731           ],
732           "hamza_above": [
733             "\u0681"
734           ],
735           "two_dots_vertical_above": [
736             "\u0682"
737           ],
738           "three_dots_above": [
739             "\u0685"
740           ],
741           "two_dots_above": [
742             "\u0757"
743           ],
744           "three_dots_pointing_upwards_below": [
745             "\u0758"
746           ],
747           "small_tah_below": [
748             "\u076E"
749           ],
750           "small_tah_two_dots": [
751             "\u076F"
752           ],
753           "small_tah_above": [
754             "\u0772"
755           ],
756           "indic_four_below": [
757             "\u077C"
758           ],
759           "isolated": "\uFEA1",
760           "final": "\uFEA2",
761           "initial": "\uFEA3",
762           "medial": "\uFEA4"
763         },
764         "khah": {
765           "normal": [
766             "\u062E"
767           ],
768           "isolated": "\uFEA5",
769           "final": "\uFEA6",
770           "initial": "\uFEA7",
771           "medial": "\uFEA8"
772         },
773         "dal": {
774           "normal": [
775             "\u062F"
776           ],
777           "ring": [
778             "\u0689"
779           ],
780           "dot_below": [
781             "\u068A"
782           ],
783           "dot_below_small_tah": [
784             "\u068B"
785           ],
786           "three_dots_above_downwards": [
787             "\u068F"
788           ],
789           "four_dots_above": [
790             "\u0690"
791           ],
792           "inverted_v": [
793             "\u06EE"
794           ],
795           "two_dots_vertically_below_small_tah": [
796             "\u0759"
797           ],
798           "inverted_small_v_below": [
799             "\u075A"
800           ],
801           "three_dots_below": [
802             "\u08AE"
803           ],
804           "isolated": "\uFEA9",
805           "final": "\uFEAA"
806         },
807         "thal": {
808           "normal": [
809             "\u0630"
810           ],
811           "isolated": "\uFEAB",
812           "final": "\uFEAC"
813         },
814         "reh": {
815           "normal": [
816             "\u0631"
817           ],
818           "small_v": [
819             "\u0692"
820           ],
821           "ring": [
822             "\u0693"
823           ],
824           "dot_below": [
825             "\u0694"
826           ],
827           "small_v_below": [
828             "\u0695"
829           ],
830           "dot_below_dot_above": [
831             "\u0696"
832           ],
833           "two_dots_above": [
834             "\u0697"
835           ],
836           "four_dots_above": [
837             "\u0699"
838           ],
839           "inverted_v": [
840             "\u06EF"
841           ],
842           "stroke": [
843             "\u075B"
844           ],
845           "two_dots_vertically_above": [
846             "\u076B"
847           ],
848           "hamza_above": [
849             "\u076C"
850           ],
851           "small_tah_two_dots": [
852             "\u0771"
853           ],
854           "loop": [
855             "\u08AA"
856           ],
857           "small_noon_above": [
858             "\u08B9"
859           ],
860           "isolated": "\uFEAD",
861           "final": "\uFEAE"
862         },
863         "zain": {
864           "normal": [
865             "\u0632"
866           ],
867           "inverted_v_above": [
868             "\u08B2"
869           ],
870           "isolated": "\uFEAF",
871           "final": "\uFEB0"
872         },
873         "seen": {
874           "normal": [
875             "\u0633"
876           ],
877           "dot_below_dot_above": [
878             "\u069A"
879           ],
880           "three_dots_below": [
881             "\u069B"
882           ],
883           "three_dots_below_three_dots_above": [
884             "\u069C"
885           ],
886           "four_dots_above": [
887             "\u075C"
888           ],
889           "two_dots_vertically_above": [
890             "\u076D"
891           ],
892           "small_tah_two_dots": [
893             "\u0770"
894           ],
895           "indic_four_above": [
896             "\u077D"
897           ],
898           "inverted_v": [
899             "\u077E"
900           ],
901           "isolated": "\uFEB1",
902           "final": "\uFEB2",
903           "initial": "\uFEB3",
904           "medial": "\uFEB4"
905         },
906         "sheen": {
907           "normal": [
908             "\u0634"
909           ],
910           "dot_below": [
911             "\u06FA"
912           ],
913           "isolated": "\uFEB5",
914           "final": "\uFEB6",
915           "initial": "\uFEB7",
916           "medial": "\uFEB8"
917         },
918         "sad": {
919           "normal": [
920             "\u0635"
921           ],
922           "two_dots_below": [
923             "\u069D"
924           ],
925           "three_dots_above": [
926             "\u069E"
927           ],
928           "three_dots_below": [
929             "\u08AF"
930           ],
931           "isolated": "\uFEB9",
932           "final": "\uFEBA",
933           "initial": "\uFEBB",
934           "medial": "\uFEBC"
935         },
936         "dad": {
937           "normal": [
938             "\u0636"
939           ],
940           "dot_below": [
941             "\u06FB"
942           ],
943           "isolated": "\uFEBD",
944           "final": "\uFEBE",
945           "initial": "\uFEBF",
946           "medial": "\uFEC0"
947         },
948         "tah": {
949           "normal": [
950             "\u0637"
951           ],
952           "three_dots_above": [
953             "\u069F"
954           ],
955           "two_dots_above": [
956             "\u08A3"
957           ],
958           "isolated": "\uFEC1",
959           "final": "\uFEC2",
960           "initial": "\uFEC3",
961           "medial": "\uFEC4"
962         },
963         "zah": {
964           "normal": [
965             "\u0638"
966           ],
967           "isolated": "\uFEC5",
968           "final": "\uFEC6",
969           "initial": "\uFEC7",
970           "medial": "\uFEC8"
971         },
972         "ain": {
973           "normal": [
974             "\u0639"
975           ],
976           "three_dots_above": [
977             "\u06A0"
978           ],
979           "two_dots_above": [
980             "\u075D"
981           ],
982           "three_dots_pointing_downwards_above": [
983             "\u075E"
984           ],
985           "two_dots_vertically_above": [
986             "\u075F"
987           ],
988           "three_dots_below": [
989             "\u08B3"
990           ],
991           "isolated": "\uFEC9",
992           "final": "\uFECA",
993           "initial": "\uFECB",
994           "medial": "\uFECC"
995         },
996         "ghain": {
997           "normal": [
998             "\u063A"
999           ],
1000           "dot_below": [
1001             "\u06FC"
1002           ],
1003           "isolated": "\uFECD",
1004           "final": "\uFECE",
1005           "initial": "\uFECF",
1006           "medial": "\uFED0"
1007         },
1008         "feh": {
1009           "normal": [
1010             "\u0641"
1011           ],
1012           "dotless": [
1013             "\u06A1"
1014           ],
1015           "dot_moved_below": [
1016             "\u06A2"
1017           ],
1018           "dot_below": [
1019             "\u06A3"
1020           ],
1021           "three_dots_below": [
1022             "\u06A5"
1023           ],
1024           "two_dots_below": [
1025             "\u0760"
1026           ],
1027           "three_dots_pointing_upwards_below": [
1028             "\u0761"
1029           ],
1030           "dot_below_three_dots_above": [
1031             "\u08A4"
1032           ],
1033           "isolated": "\uFED1",
1034           "final": "\uFED2",
1035           "initial": "\uFED3",
1036           "medial": "\uFED4"
1037         },
1038         "qaf": {
1039           "normal": [
1040             "\u0642"
1041           ],
1042           "dotless": [
1043             "\u066F"
1044           ],
1045           "dot_above": [
1046             "\u06A7"
1047           ],
1048           "three_dots_above": [
1049             "\u06A8"
1050           ],
1051           "dot_below": [
1052             "\u08A5"
1053           ],
1054           "isolated": "\uFED5",
1055           "final": "\uFED6",
1056           "initial": "\uFED7",
1057           "medial": "\uFED8"
1058         },
1059         "kaf": {
1060           "normal": [
1061             "\u0643"
1062           ],
1063           "swash": [
1064             "\u06AA"
1065           ],
1066           "ring": [
1067             "\u06AB"
1068           ],
1069           "dot_above": [
1070             "\u06AC"
1071           ],
1072           "three_dots_below": [
1073             "\u06AE"
1074           ],
1075           "two_dots_above": [
1076             "\u077F"
1077           ],
1078           "dot_below": [
1079             "\u08B4"
1080           ],
1081           "isolated": "\uFED9",
1082           "final": "\uFEDA",
1083           "initial": "\uFEDB",
1084           "medial": "\uFEDC"
1085         },
1086         "lam": {
1087           "normal": [
1088             "\u0644"
1089           ],
1090           "small_v": [
1091             "\u06B5"
1092           ],
1093           "dot_above": [
1094             "\u06B6"
1095           ],
1096           "three_dots_above": [
1097             "\u06B7"
1098           ],
1099           "three_dots_below": [
1100             "\u06B8"
1101           ],
1102           "bar": [
1103             "\u076A"
1104           ],
1105           "double_bar": [
1106             "\u08A6"
1107           ],
1108           "isolated": "\uFEDD",
1109           "final": "\uFEDE",
1110           "initial": "\uFEDF",
1111           "medial": "\uFEE0"
1112         },
1113         "meem": {
1114           "normal": [
1115             "\u0645"
1116           ],
1117           "dot_above": [
1118             "\u0765"
1119           ],
1120           "dot_below": [
1121             "\u0766"
1122           ],
1123           "three_dots_above": [
1124             "\u08A7"
1125           ],
1126           "isolated": "\uFEE1",
1127           "final": "\uFEE2",
1128           "initial": "\uFEE3",
1129           "medial": "\uFEE4"
1130         },
1131         "noon": {
1132           "normal": [
1133             "\u0646"
1134           ],
1135           "dot_below": [
1136             "\u06B9"
1137           ],
1138           "ring": [
1139             "\u06BC"
1140           ],
1141           "three_dots_above": [
1142             "\u06BD"
1143           ],
1144           "two_dots_below": [
1145             "\u0767"
1146           ],
1147           "small_tah": [
1148             "\u0768"
1149           ],
1150           "small_v": [
1151             "\u0769"
1152           ],
1153           "isolated": "\uFEE5",
1154           "final": "\uFEE6",
1155           "initial": "\uFEE7",
1156           "medial": "\uFEE8"
1157         },
1158         "heh": {
1159           "normal": [
1160             "\u0647"
1161           ],
1162           "isolated": "\uFEE9",
1163           "final": "\uFEEA",
1164           "initial": "\uFEEB",
1165           "medial": "\uFEEC"
1166         },
1167         "waw": {
1168           "normal": [
1169             "\u0648"
1170           ],
1171           "hamza_above": {
1172             "normal": [
1173               "\u0624",
1174               "\u0648\u0654"
1175             ],
1176             "isolated": "\uFE85",
1177             "final": "\uFE86"
1178           },
1179           "high_hamza": [
1180             "\u0676",
1181             "\u0648\u0674"
1182           ],
1183           "ring": [
1184             "\u06C4"
1185           ],
1186           "two_dots_above": [
1187             "\u06CA"
1188           ],
1189           "dot_above": [
1190             "\u06CF"
1191           ],
1192           "indic_two_above": [
1193             "\u0778"
1194           ],
1195           "indic_three_above": [
1196             "\u0779"
1197           ],
1198           "dot_within": [
1199             "\u08AB"
1200           ],
1201           "isolated": "\uFEED",
1202           "final": "\uFEEE"
1203         },
1204         "alef_maksura": {
1205           "normal": [
1206             "\u0649"
1207           ],
1208           "hamza_above": [
1209             "\u0626",
1210             "\u064A\u0654"
1211           ],
1212           "initial": "\uFBE8",
1213           "medial": "\uFBE9",
1214           "isolated": "\uFEEF",
1215           "final": "\uFEF0"
1216         },
1217         "yeh": {
1218           "normal": [
1219             "\u064A"
1220           ],
1221           "hamza_above": {
1222             "normal": [
1223               "\u0626",
1224               "\u0649\u0654"
1225             ],
1226             "isolated": "\uFE89",
1227             "final": "\uFE8A",
1228             "initial": "\uFE8B",
1229             "medial": "\uFE8C"
1230           },
1231           "two_dots_below_hamza_above": [
1232             "\u08A8"
1233           ],
1234           "high_hamza": [
1235             "\u0678",
1236             "\u064A\u0674"
1237           ],
1238           "tail": [
1239             "\u06CD"
1240           ],
1241           "small_v": [
1242             "\u06CE"
1243           ],
1244           "three_dots_below": [
1245             "\u06D1"
1246           ],
1247           "two_dots_below_dot_above": [
1248             "\u08A9"
1249           ],
1250           "two_dots_below_small_noon_above": [
1251             "\u08BA"
1252           ],
1253           "isolated": "\uFEF1",
1254           "final": "\uFEF2",
1255           "initial": "\uFEF3",
1256           "medial": "\uFEF4"
1257         },
1258         "tteh": {
1259           "normal": [
1260             "\u0679"
1261           ],
1262           "isolated": "\uFB66",
1263           "final": "\uFB67",
1264           "initial": "\uFB68",
1265           "medial": "\uFB69"
1266         },
1267         "tteheh": {
1268           "normal": [
1269             "\u067A"
1270           ],
1271           "isolated": "\uFB5E",
1272           "final": "\uFB5F",
1273           "initial": "\uFB60",
1274           "medial": "\uFB61"
1275         },
1276         "beeh": {
1277           "normal": [
1278             "\u067B"
1279           ],
1280           "isolated": "\uFB52",
1281           "final": "\uFB53",
1282           "initial": "\uFB54",
1283           "medial": "\uFB55"
1284         },
1285         "peh": {
1286           "normal": [
1287             "\u067E"
1288           ],
1289           "small_meem_above": [
1290             "\u08B7"
1291           ],
1292           "isolated": "\uFB56",
1293           "final": "\uFB57",
1294           "initial": "\uFB58",
1295           "medial": "\uFB59"
1296         },
1297         "teheh": {
1298           "normal": [
1299             "\u067F"
1300           ],
1301           "isolated": "\uFB62",
1302           "final": "\uFB63",
1303           "initial": "\uFB64",
1304           "medial": "\uFB65"
1305         },
1306         "beheh": {
1307           "normal": [
1308             "\u0680"
1309           ],
1310           "isolated": "\uFB5A",
1311           "final": "\uFB5B",
1312           "initial": "\uFB5C",
1313           "medial": "\uFB5D"
1314         },
1315         "nyeh": {
1316           "normal": [
1317             "\u0683"
1318           ],
1319           "isolated": "\uFB76",
1320           "final": "\uFB77",
1321           "initial": "\uFB78",
1322           "medial": "\uFB79"
1323         },
1324         "dyeh": {
1325           "normal": [
1326             "\u0684"
1327           ],
1328           "isolated": "\uFB72",
1329           "final": "\uFB73",
1330           "initial": "\uFB74",
1331           "medial": "\uFB75"
1332         },
1333         "tcheh": {
1334           "normal": [
1335             "\u0686"
1336           ],
1337           "dot_above": [
1338             "\u06BF"
1339           ],
1340           "isolated": "\uFB7A",
1341           "final": "\uFB7B",
1342           "initial": "\uFB7C",
1343           "medial": "\uFB7D"
1344         },
1345         "tcheheh": {
1346           "normal": [
1347             "\u0687"
1348           ],
1349           "isolated": "\uFB7E",
1350           "final": "\uFB7F",
1351           "initial": "\uFB80",
1352           "medial": "\uFB81"
1353         },
1354         "ddal": {
1355           "normal": [
1356             "\u0688"
1357           ],
1358           "isolated": "\uFB88",
1359           "final": "\uFB89"
1360         },
1361         "dahal": {
1362           "normal": [
1363             "\u068C"
1364           ],
1365           "isolated": "\uFB84",
1366           "final": "\uFB85"
1367         },
1368         "ddahal": {
1369           "normal": [
1370             "\u068D"
1371           ],
1372           "isolated": "\uFB82",
1373           "final": "\uFB83"
1374         },
1375         "dul": {
1376           "normal": [
1377             "\u068F",
1378             "\u068E"
1379           ],
1380           "isolated": "\uFB86",
1381           "final": "\uFB87"
1382         },
1383         "rreh": {
1384           "normal": [
1385             "\u0691"
1386           ],
1387           "isolated": "\uFB8C",
1388           "final": "\uFB8D"
1389         },
1390         "jeh": {
1391           "normal": [
1392             "\u0698"
1393           ],
1394           "isolated": "\uFB8A",
1395           "final": "\uFB8B"
1396         },
1397         "veh": {
1398           "normal": [
1399             "\u06A4"
1400           ],
1401           "isolated": "\uFB6A",
1402           "final": "\uFB6B",
1403           "initial": "\uFB6C",
1404           "medial": "\uFB6D"
1405         },
1406         "peheh": {
1407           "normal": [
1408             "\u06A6"
1409           ],
1410           "isolated": "\uFB6E",
1411           "final": "\uFB6F",
1412           "initial": "\uFB70",
1413           "medial": "\uFB71"
1414         },
1415         "keheh": {
1416           "normal": [
1417             "\u06A9"
1418           ],
1419           "dot_above": [
1420             "\u0762"
1421           ],
1422           "three_dots_above": [
1423             "\u0763"
1424           ],
1425           "three_dots_pointing_upwards_below": [
1426             "\u0764"
1427           ],
1428           "isolated": "\uFB8E",
1429           "final": "\uFB8F",
1430           "initial": "\uFB90",
1431           "medial": "\uFB91"
1432         },
1433         "ng": {
1434           "normal": [
1435             "\u06AD"
1436           ],
1437           "isolated": "\uFBD3",
1438           "final": "\uFBD4",
1439           "initial": "\uFBD5",
1440           "medial": "\uFBD6"
1441         },
1442         "gaf": {
1443           "normal": [
1444             "\u06AF"
1445           ],
1446           "ring": [
1447             "\u06B0"
1448           ],
1449           "two_dots_below": [
1450             "\u06B2"
1451           ],
1452           "three_dots_above": [
1453             "\u06B4"
1454           ],
1455           "inverted_stroke": [
1456             "\u08B0"
1457           ],
1458           "isolated": "\uFB92",
1459           "final": "\uFB93",
1460           "initial": "\uFB94",
1461           "medial": "\uFB95"
1462         },
1463         "ngoeh": {
1464           "normal": [
1465             "\u06B1"
1466           ],
1467           "isolated": "\uFB9A",
1468           "final": "\uFB9B",
1469           "initial": "\uFB9C",
1470           "medial": "\uFB9D"
1471         },
1472         "gueh": {
1473           "normal": [
1474             "\u06B3"
1475           ],
1476           "isolated": "\uFB96",
1477           "final": "\uFB97",
1478           "initial": "\uFB98",
1479           "medial": "\uFB99"
1480         },
1481         "noon ghunna": {
1482           "normal": [
1483             "\u06BA"
1484           ],
1485           "isolated": "\uFB9E",
1486           "final": "\uFB9F"
1487         },
1488         "rnoon": {
1489           "normal": [
1490             "\u06BB"
1491           ],
1492           "isolated": "\uFBA0",
1493           "final": "\uFBA1",
1494           "initial": "\uFBA2",
1495           "medial": "\uFBA3"
1496         },
1497         "heh doachashmee": {
1498           "normal": [
1499             "\u06BE"
1500           ],
1501           "isolated": "\uFBAA",
1502           "final": "\uFBAB",
1503           "initial": "\uFBAC",
1504           "medial": "\uFBAD"
1505         },
1506         "heh goal": {
1507           "normal": [
1508             "\u06C1"
1509           ],
1510           "hamza_above": [
1511             "\u06C1\u0654",
1512             "\u06C2"
1513           ],
1514           "isolated": "\uFBA6",
1515           "final": "\uFBA7",
1516           "initial": "\uFBA8",
1517           "medial": "\uFBA9"
1518         },
1519         "teh marbuta goal": {
1520           "normal": [
1521             "\u06C3"
1522           ]
1523         },
1524         "kirghiz oe": {
1525           "normal": [
1526             "\u06C5"
1527           ],
1528           "isolated": "\uFBE0",
1529           "final": "\uFBE1"
1530         },
1531         "oe": {
1532           "normal": [
1533             "\u06C6"
1534           ],
1535           "isolated": "\uFBD9",
1536           "final": "\uFBDA"
1537         },
1538         "u": {
1539           "normal": [
1540             "\u06C7"
1541           ],
1542           "hamza_above": {
1543             "normal": [
1544               "\u0677",
1545               "\u06C7\u0674"
1546             ],
1547             "isolated": "\uFBDD"
1548           },
1549           "isolated": "\uFBD7",
1550           "final": "\uFBD8"
1551         },
1552         "yu": {
1553           "normal": [
1554             "\u06C8"
1555           ],
1556           "isolated": "\uFBDB",
1557           "final": "\uFBDC"
1558         },
1559         "kirghiz yu": {
1560           "normal": [
1561             "\u06C9"
1562           ],
1563           "isolated": "\uFBE2",
1564           "final": "\uFBE3"
1565         },
1566         "ve": {
1567           "normal": [
1568             "\u06CB"
1569           ],
1570           "isolated": "\uFBDE",
1571           "final": "\uFBDF"
1572         },
1573         "farsi yeh": {
1574           "normal": [
1575             "\u06CC"
1576           ],
1577           "indic_two_above": [
1578             "\u0775"
1579           ],
1580           "indic_three_above": [
1581             "\u0776"
1582           ],
1583           "indic_four_above": [
1584             "\u0777"
1585           ],
1586           "isolated": "\uFBFC",
1587           "final": "\uFBFD",
1588           "initial": "\uFBFE",
1589           "medial": "\uFBFF"
1590         },
1591         "e": {
1592           "normal": [
1593             "\u06D0"
1594           ],
1595           "isolated": "\uFBE4",
1596           "final": "\uFBE5",
1597           "initial": "\uFBE6",
1598           "medial": "\uFBE7"
1599         },
1600         "yeh barree": {
1601           "normal": [
1602             "\u06D2"
1603           ],
1604           "hamza_above": {
1605             "normal": [
1606               "\u06D2\u0654",
1607               "\u06D3"
1608             ],
1609             "isolated": "\uFBB0",
1610             "final": "\uFBB1"
1611           },
1612           "indic_two_above": [
1613             "\u077A"
1614           ],
1615           "indic_three_above": [
1616             "\u077B"
1617           ],
1618           "isolated": "\uFBAE",
1619           "final": "\uFBAF"
1620         },
1621         "ae": {
1622           "normal": [
1623             "\u06D5"
1624           ],
1625           "isolated": "\u06D5",
1626           "final": "\uFEEA",
1627           "yeh_above": {
1628             "normal": [
1629               "\u06C0",
1630               "\u06D5\u0654"
1631             ],
1632             "isolated": "\uFBA4",
1633             "final": "\uFBA5"
1634           }
1635         },
1636         "rohingya yeh": {
1637           "normal": [
1638             "\u08AC"
1639           ]
1640         },
1641         "low alef": {
1642           "normal": [
1643             "\u08AD"
1644           ]
1645         },
1646         "straight waw": {
1647           "normal": [
1648             "\u08B1"
1649           ]
1650         },
1651         "african feh": {
1652           "normal": [
1653             "\u08BB"
1654           ]
1655         },
1656         "african qaf": {
1657           "normal": [
1658             "\u08BC"
1659           ]
1660         },
1661         "african noon": {
1662           "normal": [
1663             "\u08BD"
1664           ]
1665         }
1666       };
1667       exports2.default = arabicReference;
1668     }
1669   });
1670
1671   // node_modules/alif-toolkit/lib/unicode-ligatures.js
1672   var require_unicode_ligatures = __commonJS({
1673     "node_modules/alif-toolkit/lib/unicode-ligatures.js"(exports2) {
1674       "use strict";
1675       Object.defineProperty(exports2, "__esModule", { value: true });
1676       var ligatureReference = {
1677         "\u0626\u0627": {
1678           "isolated": "\uFBEA",
1679           "final": "\uFBEB"
1680         },
1681         "\u0626\u06D5": {
1682           "isolated": "\uFBEC",
1683           "final": "\uFBED"
1684         },
1685         "\u0626\u0648": {
1686           "isolated": "\uFBEE",
1687           "final": "\uFBEF"
1688         },
1689         "\u0626\u06C7": {
1690           "isolated": "\uFBF0",
1691           "final": "\uFBF1"
1692         },
1693         "\u0626\u06C6": {
1694           "isolated": "\uFBF2",
1695           "final": "\uFBF3"
1696         },
1697         "\u0626\u06C8": {
1698           "isolated": "\uFBF4",
1699           "final": "\uFBF5"
1700         },
1701         "\u0626\u06D0": {
1702           "isolated": "\uFBF6",
1703           "final": "\uFBF7",
1704           "initial": "\uFBF8"
1705         },
1706         "\u0626\u0649": {
1707           "uighur_kirghiz": {
1708             "isolated": "\uFBF9",
1709             "final": "\uFBFA",
1710             "initial": "\uFBFB"
1711           },
1712           "isolated": "\uFC03",
1713           "final": "\uFC68"
1714         },
1715         "\u0626\u062C": {
1716           "isolated": "\uFC00",
1717           "initial": "\uFC97"
1718         },
1719         "\u0626\u062D": {
1720           "isolated": "\uFC01",
1721           "initial": "\uFC98"
1722         },
1723         "\u0626\u0645": {
1724           "isolated": "\uFC02",
1725           "final": "\uFC66",
1726           "initial": "\uFC9A",
1727           "medial": "\uFCDF"
1728         },
1729         "\u0626\u064A": {
1730           "isolated": "\uFC04",
1731           "final": "\uFC69"
1732         },
1733         "\u0628\u062C": {
1734           "isolated": "\uFC05",
1735           "initial": "\uFC9C"
1736         },
1737         "\u0628\u062D": {
1738           "isolated": "\uFC06",
1739           "initial": "\uFC9D"
1740         },
1741         "\u0628\u062E": {
1742           "isolated": "\uFC07",
1743           "initial": "\uFC9E"
1744         },
1745         "\u0628\u0645": {
1746           "isolated": "\uFC08",
1747           "final": "\uFC6C",
1748           "initial": "\uFC9F",
1749           "medial": "\uFCE1"
1750         },
1751         "\u0628\u0649": {
1752           "isolated": "\uFC09",
1753           "final": "\uFC6E"
1754         },
1755         "\u0628\u064A": {
1756           "isolated": "\uFC0A",
1757           "final": "\uFC6F"
1758         },
1759         "\u062A\u062C": {
1760           "isolated": "\uFC0B",
1761           "initial": "\uFCA1"
1762         },
1763         "\u062A\u062D": {
1764           "isolated": "\uFC0C",
1765           "initial": "\uFCA2"
1766         },
1767         "\u062A\u062E": {
1768           "isolated": "\uFC0D",
1769           "initial": "\uFCA3"
1770         },
1771         "\u062A\u0645": {
1772           "isolated": "\uFC0E",
1773           "final": "\uFC72",
1774           "initial": "\uFCA4",
1775           "medial": "\uFCE3"
1776         },
1777         "\u062A\u0649": {
1778           "isolated": "\uFC0F",
1779           "final": "\uFC74"
1780         },
1781         "\u062A\u064A": {
1782           "isolated": "\uFC10",
1783           "final": "\uFC75"
1784         },
1785         "\u062B\u062C": {
1786           "isolated": "\uFC11"
1787         },
1788         "\u062B\u0645": {
1789           "isolated": "\uFC12",
1790           "final": "\uFC78",
1791           "initial": "\uFCA6",
1792           "medial": "\uFCE5"
1793         },
1794         "\u062B\u0649": {
1795           "isolated": "\uFC13",
1796           "final": "\uFC7A"
1797         },
1798         "\u062B\u0648": {
1799           "isolated": "\uFC14"
1800         },
1801         "\u062C\u062D": {
1802           "isolated": "\uFC15",
1803           "initial": "\uFCA7"
1804         },
1805         "\u062C\u0645": {
1806           "isolated": "\uFC16",
1807           "initial": "\uFCA8"
1808         },
1809         "\u062D\u062C": {
1810           "isolated": "\uFC17",
1811           "initial": "\uFCA9"
1812         },
1813         "\u062D\u0645": {
1814           "isolated": "\uFC18",
1815           "initial": "\uFCAA"
1816         },
1817         "\u062E\u062C": {
1818           "isolated": "\uFC19",
1819           "initial": "\uFCAB"
1820         },
1821         "\u062E\u062D": {
1822           "isolated": "\uFC1A"
1823         },
1824         "\u062E\u0645": {
1825           "isolated": "\uFC1B",
1826           "initial": "\uFCAC"
1827         },
1828         "\u0633\u062C": {
1829           "isolated": "\uFC1C",
1830           "initial": "\uFCAD",
1831           "medial": "\uFD34"
1832         },
1833         "\u0633\u062D": {
1834           "isolated": "\uFC1D",
1835           "initial": "\uFCAE",
1836           "medial": "\uFD35"
1837         },
1838         "\u0633\u062E": {
1839           "isolated": "\uFC1E",
1840           "initial": "\uFCAF",
1841           "medial": "\uFD36"
1842         },
1843         "\u0633\u0645": {
1844           "isolated": "\uFC1F",
1845           "initial": "\uFCB0",
1846           "medial": "\uFCE7"
1847         },
1848         "\u0635\u062D": {
1849           "isolated": "\uFC20",
1850           "initial": "\uFCB1"
1851         },
1852         "\u0635\u0645": {
1853           "isolated": "\uFC21",
1854           "initial": "\uFCB3"
1855         },
1856         "\u0636\u062C": {
1857           "isolated": "\uFC22",
1858           "initial": "\uFCB4"
1859         },
1860         "\u0636\u062D": {
1861           "isolated": "\uFC23",
1862           "initial": "\uFCB5"
1863         },
1864         "\u0636\u062E": {
1865           "isolated": "\uFC24",
1866           "initial": "\uFCB6"
1867         },
1868         "\u0636\u0645": {
1869           "isolated": "\uFC25",
1870           "initial": "\uFCB7"
1871         },
1872         "\u0637\u062D": {
1873           "isolated": "\uFC26",
1874           "initial": "\uFCB8"
1875         },
1876         "\u0637\u0645": {
1877           "isolated": "\uFC27",
1878           "initial": "\uFD33",
1879           "medial": "\uFD3A"
1880         },
1881         "\u0638\u0645": {
1882           "isolated": "\uFC28",
1883           "initial": "\uFCB9",
1884           "medial": "\uFD3B"
1885         },
1886         "\u0639\u062C": {
1887           "isolated": "\uFC29",
1888           "initial": "\uFCBA"
1889         },
1890         "\u0639\u0645": {
1891           "isolated": "\uFC2A",
1892           "initial": "\uFCBB"
1893         },
1894         "\u063A\u062C": {
1895           "isolated": "\uFC2B",
1896           "initial": "\uFCBC"
1897         },
1898         "\u063A\u0645": {
1899           "isolated": "\uFC2C",
1900           "initial": "\uFCBD"
1901         },
1902         "\u0641\u062C": {
1903           "isolated": "\uFC2D",
1904           "initial": "\uFCBE"
1905         },
1906         "\u0641\u062D": {
1907           "isolated": "\uFC2E",
1908           "initial": "\uFCBF"
1909         },
1910         "\u0641\u062E": {
1911           "isolated": "\uFC2F",
1912           "initial": "\uFCC0"
1913         },
1914         "\u0641\u0645": {
1915           "isolated": "\uFC30",
1916           "initial": "\uFCC1"
1917         },
1918         "\u0641\u0649": {
1919           "isolated": "\uFC31",
1920           "final": "\uFC7C"
1921         },
1922         "\u0641\u064A": {
1923           "isolated": "\uFC32",
1924           "final": "\uFC7D"
1925         },
1926         "\u0642\u062D": {
1927           "isolated": "\uFC33",
1928           "initial": "\uFCC2"
1929         },
1930         "\u0642\u0645": {
1931           "isolated": "\uFC34",
1932           "initial": "\uFCC3"
1933         },
1934         "\u0642\u0649": {
1935           "isolated": "\uFC35",
1936           "final": "\uFC7E"
1937         },
1938         "\u0642\u064A": {
1939           "isolated": "\uFC36",
1940           "final": "\uFC7F"
1941         },
1942         "\u0643\u0627": {
1943           "isolated": "\uFC37",
1944           "final": "\uFC80"
1945         },
1946         "\u0643\u062C": {
1947           "isolated": "\uFC38",
1948           "initial": "\uFCC4"
1949         },
1950         "\u0643\u062D": {
1951           "isolated": "\uFC39",
1952           "initial": "\uFCC5"
1953         },
1954         "\u0643\u062E": {
1955           "isolated": "\uFC3A",
1956           "initial": "\uFCC6"
1957         },
1958         "\u0643\u0644": {
1959           "isolated": "\uFC3B",
1960           "final": "\uFC81",
1961           "initial": "\uFCC7",
1962           "medial": "\uFCEB"
1963         },
1964         "\u0643\u0645": {
1965           "isolated": "\uFC3C",
1966           "final": "\uFC82",
1967           "initial": "\uFCC8",
1968           "medial": "\uFCEC"
1969         },
1970         "\u0643\u0649": {
1971           "isolated": "\uFC3D",
1972           "final": "\uFC83"
1973         },
1974         "\u0643\u064A": {
1975           "isolated": "\uFC3E",
1976           "final": "\uFC84"
1977         },
1978         "\u0644\u062C": {
1979           "isolated": "\uFC3F",
1980           "initial": "\uFCC9"
1981         },
1982         "\u0644\u062D": {
1983           "isolated": "\uFC40",
1984           "initial": "\uFCCA"
1985         },
1986         "\u0644\u062E": {
1987           "isolated": "\uFC41",
1988           "initial": "\uFCCB"
1989         },
1990         "\u0644\u0645": {
1991           "isolated": "\uFC42",
1992           "final": "\uFC85",
1993           "initial": "\uFCCC",
1994           "medial": "\uFCED"
1995         },
1996         "\u0644\u0649": {
1997           "isolated": "\uFC43",
1998           "final": "\uFC86"
1999         },
2000         "\u0644\u064A": {
2001           "isolated": "\uFC44",
2002           "final": "\uFC87"
2003         },
2004         "\u0645\u062C": {
2005           "isolated": "\uFC45",
2006           "initial": "\uFCCE"
2007         },
2008         "\u0645\u062D": {
2009           "isolated": "\uFC46",
2010           "initial": "\uFCCF"
2011         },
2012         "\u0645\u062E": {
2013           "isolated": "\uFC47",
2014           "initial": "\uFCD0"
2015         },
2016         "\u0645\u0645": {
2017           "isolated": "\uFC48",
2018           "final": "\uFC89",
2019           "initial": "\uFCD1"
2020         },
2021         "\u0645\u0649": {
2022           "isolated": "\uFC49"
2023         },
2024         "\u0645\u064A": {
2025           "isolated": "\uFC4A"
2026         },
2027         "\u0646\u062C": {
2028           "isolated": "\uFC4B",
2029           "initial": "\uFCD2"
2030         },
2031         "\u0646\u062D": {
2032           "isolated": "\uFC4C",
2033           "initial": "\uFCD3"
2034         },
2035         "\u0646\u062E": {
2036           "isolated": "\uFC4D",
2037           "initial": "\uFCD4"
2038         },
2039         "\u0646\u0645": {
2040           "isolated": "\uFC4E",
2041           "final": "\uFC8C",
2042           "initial": "\uFCD5",
2043           "medial": "\uFCEE"
2044         },
2045         "\u0646\u0649": {
2046           "isolated": "\uFC4F",
2047           "final": "\uFC8E"
2048         },
2049         "\u0646\u064A": {
2050           "isolated": "\uFC50",
2051           "final": "\uFC8F"
2052         },
2053         "\u0647\u062C": {
2054           "isolated": "\uFC51",
2055           "initial": "\uFCD7"
2056         },
2057         "\u0647\u0645": {
2058           "isolated": "\uFC52",
2059           "initial": "\uFCD8"
2060         },
2061         "\u0647\u0649": {
2062           "isolated": "\uFC53"
2063         },
2064         "\u0647\u064A": {
2065           "isolated": "\uFC54"
2066         },
2067         "\u064A\u062C": {
2068           "isolated": "\uFC55",
2069           "initial": "\uFCDA"
2070         },
2071         "\u064A\u062D": {
2072           "isolated": "\uFC56",
2073           "initial": "\uFCDB"
2074         },
2075         "\u064A\u062E": {
2076           "isolated": "\uFC57",
2077           "initial": "\uFCDC"
2078         },
2079         "\u064A\u0645": {
2080           "isolated": "\uFC58",
2081           "final": "\uFC93",
2082           "initial": "\uFCDD",
2083           "medial": "\uFCF0"
2084         },
2085         "\u064A\u0649": {
2086           "isolated": "\uFC59",
2087           "final": "\uFC95"
2088         },
2089         "\u064A\u064A": {
2090           "isolated": "\uFC5A",
2091           "final": "\uFC96"
2092         },
2093         "\u0630\u0670": {
2094           "isolated": "\uFC5B"
2095         },
2096         "\u0631\u0670": {
2097           "isolated": "\uFC5C"
2098         },
2099         "\u0649\u0670": {
2100           "isolated": "\uFC5D",
2101           "final": "\uFC90"
2102         },
2103         "\u064C\u0651": {
2104           "isolated": "\uFC5E"
2105         },
2106         "\u064D\u0651": {
2107           "isolated": "\uFC5F"
2108         },
2109         "\u064E\u0651": {
2110           "isolated": "\uFC60"
2111         },
2112         "\u064F\u0651": {
2113           "isolated": "\uFC61"
2114         },
2115         "\u0650\u0651": {
2116           "isolated": "\uFC62"
2117         },
2118         "\u0651\u0670": {
2119           "isolated": "\uFC63"
2120         },
2121         "\u0626\u0631": {
2122           "final": "\uFC64"
2123         },
2124         "\u0626\u0632": {
2125           "final": "\uFC65"
2126         },
2127         "\u0626\u0646": {
2128           "final": "\uFC67"
2129         },
2130         "\u0628\u0631": {
2131           "final": "\uFC6A"
2132         },
2133         "\u0628\u0632": {
2134           "final": "\uFC6B"
2135         },
2136         "\u0628\u0646": {
2137           "final": "\uFC6D"
2138         },
2139         "\u062A\u0631": {
2140           "final": "\uFC70"
2141         },
2142         "\u062A\u0632": {
2143           "final": "\uFC71"
2144         },
2145         "\u062A\u0646": {
2146           "final": "\uFC73"
2147         },
2148         "\u062B\u0631": {
2149           "final": "\uFC76"
2150         },
2151         "\u062B\u0632": {
2152           "final": "\uFC77"
2153         },
2154         "\u062B\u0646": {
2155           "final": "\uFC79"
2156         },
2157         "\u062B\u064A": {
2158           "final": "\uFC7B"
2159         },
2160         "\u0645\u0627": {
2161           "final": "\uFC88"
2162         },
2163         "\u0646\u0631": {
2164           "final": "\uFC8A"
2165         },
2166         "\u0646\u0632": {
2167           "final": "\uFC8B"
2168         },
2169         "\u0646\u0646": {
2170           "final": "\uFC8D"
2171         },
2172         "\u064A\u0631": {
2173           "final": "\uFC91"
2174         },
2175         "\u064A\u0632": {
2176           "final": "\uFC92"
2177         },
2178         "\u064A\u0646": {
2179           "final": "\uFC94"
2180         },
2181         "\u0626\u062E": {
2182           "initial": "\uFC99"
2183         },
2184         "\u0626\u0647": {
2185           "initial": "\uFC9B",
2186           "medial": "\uFCE0"
2187         },
2188         "\u0628\u0647": {
2189           "initial": "\uFCA0",
2190           "medial": "\uFCE2"
2191         },
2192         "\u062A\u0647": {
2193           "initial": "\uFCA5",
2194           "medial": "\uFCE4"
2195         },
2196         "\u0635\u062E": {
2197           "initial": "\uFCB2"
2198         },
2199         "\u0644\u0647": {
2200           "initial": "\uFCCD"
2201         },
2202         "\u0646\u0647": {
2203           "initial": "\uFCD6",
2204           "medial": "\uFCEF"
2205         },
2206         "\u0647\u0670": {
2207           "initial": "\uFCD9"
2208         },
2209         "\u064A\u0647": {
2210           "initial": "\uFCDE",
2211           "medial": "\uFCF1"
2212         },
2213         "\u062B\u0647": {
2214           "medial": "\uFCE6"
2215         },
2216         "\u0633\u0647": {
2217           "medial": "\uFCE8",
2218           "initial": "\uFD31"
2219         },
2220         "\u0634\u0645": {
2221           "medial": "\uFCE9",
2222           "isolated": "\uFD0C",
2223           "final": "\uFD28",
2224           "initial": "\uFD30"
2225         },
2226         "\u0634\u0647": {
2227           "medial": "\uFCEA",
2228           "initial": "\uFD32"
2229         },
2230         "\u0640\u064E\u0651": {
2231           "medial": "\uFCF2"
2232         },
2233         "\u0640\u064F\u0651": {
2234           "medial": "\uFCF3"
2235         },
2236         "\u0640\u0650\u0651": {
2237           "medial": "\uFCF4"
2238         },
2239         "\u0637\u0649": {
2240           "isolated": "\uFCF5",
2241           "final": "\uFD11"
2242         },
2243         "\u0637\u064A": {
2244           "isolated": "\uFCF6",
2245           "final": "\uFD12"
2246         },
2247         "\u0639\u0649": {
2248           "isolated": "\uFCF7",
2249           "final": "\uFD13"
2250         },
2251         "\u0639\u064A": {
2252           "isolated": "\uFCF8",
2253           "final": "\uFD14"
2254         },
2255         "\u063A\u0649": {
2256           "isolated": "\uFCF9",
2257           "final": "\uFD15"
2258         },
2259         "\u063A\u064A": {
2260           "isolated": "\uFCFA",
2261           "final": "\uFD16"
2262         },
2263         "\u0633\u0649": {
2264           "isolated": "\uFCFB"
2265         },
2266         "\u0633\u064A": {
2267           "isolated": "\uFCFC",
2268           "final": "\uFD18"
2269         },
2270         "\u0634\u0649": {
2271           "isolated": "\uFCFD",
2272           "final": "\uFD19"
2273         },
2274         "\u0634\u064A": {
2275           "isolated": "\uFCFE",
2276           "final": "\uFD1A"
2277         },
2278         "\u062D\u0649": {
2279           "isolated": "\uFCFF",
2280           "final": "\uFD1B"
2281         },
2282         "\u062D\u064A": {
2283           "isolated": "\uFD00",
2284           "final": "\uFD1C"
2285         },
2286         "\u062C\u0649": {
2287           "isolated": "\uFD01",
2288           "final": "\uFD1D"
2289         },
2290         "\u062C\u064A": {
2291           "isolated": "\uFD02",
2292           "final": "\uFD1E"
2293         },
2294         "\u062E\u0649": {
2295           "isolated": "\uFD03",
2296           "final": "\uFD1F"
2297         },
2298         "\u062E\u064A": {
2299           "isolated": "\uFD04",
2300           "final": "\uFD20"
2301         },
2302         "\u0635\u0649": {
2303           "isolated": "\uFD05",
2304           "final": "\uFD21"
2305         },
2306         "\u0635\u064A": {
2307           "isolated": "\uFD06",
2308           "final": "\uFD22"
2309         },
2310         "\u0636\u0649": {
2311           "isolated": "\uFD07",
2312           "final": "\uFD23"
2313         },
2314         "\u0636\u064A": {
2315           "isolated": "\uFD08",
2316           "final": "\uFD24"
2317         },
2318         "\u0634\u062C": {
2319           "isolated": "\uFD09",
2320           "final": "\uFD25",
2321           "initial": "\uFD2D",
2322           "medial": "\uFD37"
2323         },
2324         "\u0634\u062D": {
2325           "isolated": "\uFD0A",
2326           "final": "\uFD26",
2327           "initial": "\uFD2E",
2328           "medial": "\uFD38"
2329         },
2330         "\u0634\u062E": {
2331           "isolated": "\uFD0B",
2332           "final": "\uFD27",
2333           "initial": "\uFD2F",
2334           "medial": "\uFD39"
2335         },
2336         "\u0634\u0631": {
2337           "isolated": "\uFD0D",
2338           "final": "\uFD29"
2339         },
2340         "\u0633\u0631": {
2341           "isolated": "\uFD0E",
2342           "final": "\uFD2A"
2343         },
2344         "\u0635\u0631": {
2345           "isolated": "\uFD0F",
2346           "final": "\uFD2B"
2347         },
2348         "\u0636\u0631": {
2349           "isolated": "\uFD10",
2350           "final": "\uFD2C"
2351         },
2352         "\u0633\u0639": {
2353           "final": "\uFD17"
2354         },
2355         "\u062A\u062C\u0645": {
2356           "initial": "\uFD50"
2357         },
2358         "\u062A\u062D\u062C": {
2359           "final": "\uFD51",
2360           "initial": "\uFD52"
2361         },
2362         "\u062A\u062D\u0645": {
2363           "initial": "\uFD53"
2364         },
2365         "\u062A\u062E\u0645": {
2366           "initial": "\uFD54"
2367         },
2368         "\u062A\u0645\u062C": {
2369           "initial": "\uFD55"
2370         },
2371         "\u062A\u0645\u062D": {
2372           "initial": "\uFD56"
2373         },
2374         "\u062A\u0645\u062E": {
2375           "initial": "\uFD57"
2376         },
2377         "\u062C\u0645\u062D": {
2378           "final": "\uFD58",
2379           "initial": "\uFD59"
2380         },
2381         "\u062D\u0645\u064A": {
2382           "final": "\uFD5A"
2383         },
2384         "\u062D\u0645\u0649": {
2385           "final": "\uFD5B"
2386         },
2387         "\u0633\u062D\u062C": {
2388           "initial": "\uFD5C"
2389         },
2390         "\u0633\u062C\u062D": {
2391           "initial": "\uFD5D"
2392         },
2393         "\u0633\u062C\u0649": {
2394           "final": "\uFD5E"
2395         },
2396         "\u0633\u0645\u062D": {
2397           "final": "\uFD5F",
2398           "initial": "\uFD60"
2399         },
2400         "\u0633\u0645\u062C": {
2401           "initial": "\uFD61"
2402         },
2403         "\u0633\u0645\u0645": {
2404           "final": "\uFD62",
2405           "initial": "\uFD63"
2406         },
2407         "\u0635\u062D\u062D": {
2408           "final": "\uFD64",
2409           "initial": "\uFD65"
2410         },
2411         "\u0635\u0645\u0645": {
2412           "final": "\uFD66",
2413           "initial": "\uFDC5"
2414         },
2415         "\u0634\u062D\u0645": {
2416           "final": "\uFD67",
2417           "initial": "\uFD68"
2418         },
2419         "\u0634\u062C\u064A": {
2420           "final": "\uFD69"
2421         },
2422         "\u0634\u0645\u062E": {
2423           "final": "\uFD6A",
2424           "initial": "\uFD6B"
2425         },
2426         "\u0634\u0645\u0645": {
2427           "final": "\uFD6C",
2428           "initial": "\uFD6D"
2429         },
2430         "\u0636\u062D\u0649": {
2431           "final": "\uFD6E"
2432         },
2433         "\u0636\u062E\u0645": {
2434           "final": "\uFD6F",
2435           "initial": "\uFD70"
2436         },
2437         "\u0636\u0645\u062D": {
2438           "final": "\uFD71"
2439         },
2440         "\u0637\u0645\u062D": {
2441           "initial": "\uFD72"
2442         },
2443         "\u0637\u0645\u0645": {
2444           "initial": "\uFD73"
2445         },
2446         "\u0637\u0645\u064A": {
2447           "final": "\uFD74"
2448         },
2449         "\u0639\u062C\u0645": {
2450           "final": "\uFD75",
2451           "initial": "\uFDC4"
2452         },
2453         "\u0639\u0645\u0645": {
2454           "final": "\uFD76",
2455           "initial": "\uFD77"
2456         },
2457         "\u0639\u0645\u0649": {
2458           "final": "\uFD78"
2459         },
2460         "\u063A\u0645\u0645": {
2461           "final": "\uFD79"
2462         },
2463         "\u063A\u0645\u064A": {
2464           "final": "\uFD7A"
2465         },
2466         "\u063A\u0645\u0649": {
2467           "final": "\uFD7B"
2468         },
2469         "\u0641\u062E\u0645": {
2470           "final": "\uFD7C",
2471           "initial": "\uFD7D"
2472         },
2473         "\u0642\u0645\u062D": {
2474           "final": "\uFD7E",
2475           "initial": "\uFDB4"
2476         },
2477         "\u0642\u0645\u0645": {
2478           "final": "\uFD7F"
2479         },
2480         "\u0644\u062D\u0645": {
2481           "final": "\uFD80",
2482           "initial": "\uFDB5"
2483         },
2484         "\u0644\u062D\u064A": {
2485           "final": "\uFD81"
2486         },
2487         "\u0644\u062D\u0649": {
2488           "final": "\uFD82"
2489         },
2490         "\u0644\u062C\u062C": {
2491           "initial": "\uFD83",
2492           "final": "\uFD84"
2493         },
2494         "\u0644\u062E\u0645": {
2495           "final": "\uFD85",
2496           "initial": "\uFD86"
2497         },
2498         "\u0644\u0645\u062D": {
2499           "final": "\uFD87",
2500           "initial": "\uFD88"
2501         },
2502         "\u0645\u062D\u062C": {
2503           "initial": "\uFD89"
2504         },
2505         "\u0645\u062D\u0645": {
2506           "initial": "\uFD8A"
2507         },
2508         "\u0645\u062D\u064A": {
2509           "final": "\uFD8B"
2510         },
2511         "\u0645\u062C\u062D": {
2512           "initial": "\uFD8C"
2513         },
2514         "\u0645\u062C\u0645": {
2515           "initial": "\uFD8D"
2516         },
2517         "\u0645\u062E\u062C": {
2518           "initial": "\uFD8E"
2519         },
2520         "\u0645\u062E\u0645": {
2521           "initial": "\uFD8F"
2522         },
2523         "\u0645\u062C\u062E": {
2524           "initial": "\uFD92"
2525         },
2526         "\u0647\u0645\u062C": {
2527           "initial": "\uFD93"
2528         },
2529         "\u0647\u0645\u0645": {
2530           "initial": "\uFD94"
2531         },
2532         "\u0646\u062D\u0645": {
2533           "initial": "\uFD95"
2534         },
2535         "\u0646\u062D\u0649": {
2536           "final": "\uFD96"
2537         },
2538         "\u0646\u062C\u0645": {
2539           "final": "\uFD97",
2540           "initial": "\uFD98"
2541         },
2542         "\u0646\u062C\u0649": {
2543           "final": "\uFD99"
2544         },
2545         "\u0646\u0645\u064A": {
2546           "final": "\uFD9A"
2547         },
2548         "\u0646\u0645\u0649": {
2549           "final": "\uFD9B"
2550         },
2551         "\u064A\u0645\u0645": {
2552           "final": "\uFD9C",
2553           "initial": "\uFD9D"
2554         },
2555         "\u0628\u062E\u064A": {
2556           "final": "\uFD9E"
2557         },
2558         "\u062A\u062C\u064A": {
2559           "final": "\uFD9F"
2560         },
2561         "\u062A\u062C\u0649": {
2562           "final": "\uFDA0"
2563         },
2564         "\u062A\u062E\u064A": {
2565           "final": "\uFDA1"
2566         },
2567         "\u062A\u062E\u0649": {
2568           "final": "\uFDA2"
2569         },
2570         "\u062A\u0645\u064A": {
2571           "final": "\uFDA3"
2572         },
2573         "\u062A\u0645\u0649": {
2574           "final": "\uFDA4"
2575         },
2576         "\u062C\u0645\u064A": {
2577           "final": "\uFDA5"
2578         },
2579         "\u062C\u062D\u0649": {
2580           "final": "\uFDA6"
2581         },
2582         "\u062C\u0645\u0649": {
2583           "final": "\uFDA7"
2584         },
2585         "\u0633\u062E\u0649": {
2586           "final": "\uFDA8"
2587         },
2588         "\u0635\u062D\u064A": {
2589           "final": "\uFDA9"
2590         },
2591         "\u0634\u062D\u064A": {
2592           "final": "\uFDAA"
2593         },
2594         "\u0636\u062D\u064A": {
2595           "final": "\uFDAB"
2596         },
2597         "\u0644\u062C\u064A": {
2598           "final": "\uFDAC"
2599         },
2600         "\u0644\u0645\u064A": {
2601           "final": "\uFDAD"
2602         },
2603         "\u064A\u062D\u064A": {
2604           "final": "\uFDAE"
2605         },
2606         "\u064A\u062C\u064A": {
2607           "final": "\uFDAF"
2608         },
2609         "\u064A\u0645\u064A": {
2610           "final": "\uFDB0"
2611         },
2612         "\u0645\u0645\u064A": {
2613           "final": "\uFDB1"
2614         },
2615         "\u0642\u0645\u064A": {
2616           "final": "\uFDB2"
2617         },
2618         "\u0646\u062D\u064A": {
2619           "final": "\uFDB3"
2620         },
2621         "\u0639\u0645\u064A": {
2622           "final": "\uFDB6"
2623         },
2624         "\u0643\u0645\u064A": {
2625           "final": "\uFDB7"
2626         },
2627         "\u0646\u062C\u062D": {
2628           "initial": "\uFDB8",
2629           "final": "\uFDBD"
2630         },
2631         "\u0645\u062E\u064A": {
2632           "final": "\uFDB9"
2633         },
2634         "\u0644\u062C\u0645": {
2635           "initial": "\uFDBA",
2636           "final": "\uFDBC"
2637         },
2638         "\u0643\u0645\u0645": {
2639           "final": "\uFDBB",
2640           "initial": "\uFDC3"
2641         },
2642         "\u062C\u062D\u064A": {
2643           "final": "\uFDBE"
2644         },
2645         "\u062D\u062C\u064A": {
2646           "final": "\uFDBF"
2647         },
2648         "\u0645\u062C\u064A": {
2649           "final": "\uFDC0"
2650         },
2651         "\u0641\u0645\u064A": {
2652           "final": "\uFDC1"
2653         },
2654         "\u0628\u062D\u064A": {
2655           "final": "\uFDC2"
2656         },
2657         "\u0633\u062E\u064A": {
2658           "final": "\uFDC6"
2659         },
2660         "\u0646\u062C\u064A": {
2661           "final": "\uFDC7"
2662         },
2663         "\u0644\u0622": {
2664           "isolated": "\uFEF5",
2665           "final": "\uFEF6"
2666         },
2667         "\u0644\u0623": {
2668           "isolated": "\uFEF7",
2669           "final": "\uFEF8"
2670         },
2671         "\u0644\u0625": {
2672           "isolated": "\uFEF9",
2673           "final": "\uFEFA"
2674         },
2675         "\u0644\u0627": {
2676           "isolated": "\uFEFB",
2677           "final": "\uFEFC"
2678         },
2679         "words": {
2680           "\u0635\u0644\u06D2": "\uFDF0",
2681           "\u0642\u0644\u06D2": "\uFDF1",
2682           "\u0627\u0644\u0644\u0647": "\uFDF2",
2683           "\u0627\u0643\u0628\u0631": "\uFDF3",
2684           "\u0645\u062D\u0645\u062F": "\uFDF4",
2685           "\u0635\u0644\u0639\u0645": "\uFDF5",
2686           "\u0631\u0633\u0648\u0644": "\uFDF6",
2687           "\u0639\u0644\u064A\u0647": "\uFDF7",
2688           "\u0648\u0633\u0644\u0645": "\uFDF8",
2689           "\u0635\u0644\u0649": "\uFDF9",
2690           "\u0635\u0644\u0649\u0627\u0644\u0644\u0647\u0639\u0644\u064A\u0647\u0648\u0633\u0644\u0645": "\uFDFA",
2691           "\u062C\u0644\u062C\u0644\u0627\u0644\u0647": "\uFDFB",
2692           "\u0631\u06CC\u0627\u0644": "\uFDFC"
2693         }
2694       };
2695       exports2.default = ligatureReference;
2696     }
2697   });
2698
2699   // node_modules/alif-toolkit/lib/reference.js
2700   var require_reference = __commonJS({
2701     "node_modules/alif-toolkit/lib/reference.js"(exports2) {
2702       "use strict";
2703       Object.defineProperty(exports2, "__esModule", { value: true });
2704       var unicode_arabic_1 = require_unicode_arabic();
2705       var unicode_ligatures_1 = require_unicode_ligatures();
2706       var letterList = Object.keys(unicode_arabic_1.default);
2707       exports2.letterList = letterList;
2708       var ligatureList = Object.keys(unicode_ligatures_1.default);
2709       exports2.ligatureList = ligatureList;
2710       var ligatureWordList = Object.keys(unicode_ligatures_1.default.words);
2711       exports2.ligatureWordList = ligatureWordList;
2712       var lams = "\u0644\u06B5\u06B6\u06B7\u06B8";
2713       exports2.lams = lams;
2714       var alefs = "\u0627\u0622\u0623\u0625\u0671\u0672\u0673\u0675\u0773\u0774";
2715       exports2.alefs = alefs;
2716       var tashkeel = "\u0605\u0640\u0670\u0674\u06DF\u06E7\u06E8";
2717       exports2.tashkeel = tashkeel;
2718       function addToTashkeel(start2, finish) {
2719         for (var i3 = start2; i3 <= finish; i3++) {
2720           exports2.tashkeel = tashkeel += String.fromCharCode(i3);
2721         }
2722       }
2723       addToTashkeel(1552, 1562);
2724       addToTashkeel(1611, 1631);
2725       addToTashkeel(1750, 1756);
2726       addToTashkeel(1760, 1764);
2727       addToTashkeel(1770, 1773);
2728       addToTashkeel(2259, 2273);
2729       addToTashkeel(2275, 2303);
2730       addToTashkeel(65136, 65151);
2731       var lineBreakers = "\u0627\u0629\u0648\u06C0\u06CF\u06FD\u06FE\u076B\u076C\u0771\u0773\u0774\u0778\u0779\u08E2\u08B1\u08B2\u08B9";
2732       exports2.lineBreakers = lineBreakers;
2733       function addToLineBreakers(start2, finish) {
2734         for (var i3 = start2; i3 <= finish; i3++) {
2735           exports2.lineBreakers = lineBreakers += String.fromCharCode(i3);
2736         }
2737       }
2738       addToLineBreakers(1536, 1567);
2739       addToLineBreakers(1569, 1573);
2740       addToLineBreakers(1583, 1586);
2741       addToLineBreakers(1632, 1645);
2742       addToLineBreakers(1649, 1655);
2743       addToLineBreakers(1672, 1689);
2744       addToLineBreakers(1731, 1739);
2745       addToLineBreakers(1746, 1785);
2746       addToLineBreakers(1881, 1883);
2747       addToLineBreakers(2218, 2222);
2748       addToLineBreakers(64336, 65021);
2749       addToLineBreakers(65152, 65276);
2750       addToLineBreakers(69216, 69247);
2751       addToLineBreakers(126064, 126143);
2752       addToLineBreakers(126464, 126719);
2753     }
2754   });
2755
2756   // node_modules/alif-toolkit/lib/GlyphSplitter.js
2757   var require_GlyphSplitter = __commonJS({
2758     "node_modules/alif-toolkit/lib/GlyphSplitter.js"(exports2) {
2759       "use strict";
2760       Object.defineProperty(exports2, "__esModule", { value: true });
2761       var isArabic_1 = require_isArabic();
2762       var reference_1 = require_reference();
2763       function GlyphSplitter(word) {
2764         let letters = [];
2765         let lastLetter = "";
2766         word.split("").forEach((letter) => {
2767           if (isArabic_1.isArabic(letter)) {
2768             if (reference_1.tashkeel.indexOf(letter) > -1) {
2769               letters[letters.length - 1] += letter;
2770             } 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)) {
2771               letters[letters.length - 1] += letter;
2772             } else {
2773               letters.push(letter);
2774             }
2775           } else {
2776             letters.push(letter);
2777           }
2778           if (reference_1.tashkeel.indexOf(letter) === -1) {
2779             lastLetter = letter;
2780           }
2781         });
2782         return letters;
2783       }
2784       exports2.GlyphSplitter = GlyphSplitter;
2785     }
2786   });
2787
2788   // node_modules/alif-toolkit/lib/BaselineSplitter.js
2789   var require_BaselineSplitter = __commonJS({
2790     "node_modules/alif-toolkit/lib/BaselineSplitter.js"(exports2) {
2791       "use strict";
2792       Object.defineProperty(exports2, "__esModule", { value: true });
2793       var isArabic_1 = require_isArabic();
2794       var reference_1 = require_reference();
2795       function BaselineSplitter(word) {
2796         let letters = [];
2797         let lastLetter = "";
2798         word.split("").forEach((letter) => {
2799           if (isArabic_1.isArabic(letter) && isArabic_1.isArabic(lastLetter)) {
2800             if (lastLetter.length && reference_1.tashkeel.indexOf(letter) > -1) {
2801               letters[letters.length - 1] += letter;
2802             } else if (reference_1.lineBreakers.indexOf(lastLetter) > -1) {
2803               letters.push(letter);
2804             } else {
2805               letters[letters.length - 1] += letter;
2806             }
2807           } else {
2808             letters.push(letter);
2809           }
2810           if (reference_1.tashkeel.indexOf(letter) === -1) {
2811             lastLetter = letter;
2812           }
2813         });
2814         return letters;
2815       }
2816       exports2.BaselineSplitter = BaselineSplitter;
2817     }
2818   });
2819
2820   // node_modules/alif-toolkit/lib/Normalization.js
2821   var require_Normalization = __commonJS({
2822     "node_modules/alif-toolkit/lib/Normalization.js"(exports2) {
2823       "use strict";
2824       Object.defineProperty(exports2, "__esModule", { value: true });
2825       var unicode_arabic_1 = require_unicode_arabic();
2826       var unicode_ligatures_1 = require_unicode_ligatures();
2827       var isArabic_1 = require_isArabic();
2828       var reference_1 = require_reference();
2829       function Normal(word, breakPresentationForm) {
2830         if (typeof breakPresentationForm === "undefined") {
2831           breakPresentationForm = true;
2832         }
2833         let returnable = "";
2834         word.split("").forEach((letter) => {
2835           if (!isArabic_1.isArabic(letter)) {
2836             returnable += letter;
2837             return;
2838           }
2839           for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
2840             let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
2841             let versions = Object.keys(letterForms);
2842             for (let v2 = 0; v2 < versions.length; v2++) {
2843               let localVersion = letterForms[versions[v2]];
2844               if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2845                 let embeddedForms = Object.keys(localVersion);
2846                 for (let ef = 0; ef < embeddedForms.length; ef++) {
2847                   let form = localVersion[embeddedForms[ef]];
2848                   if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2849                     if (form === letter) {
2850                       if (breakPresentationForm && localVersion["normal"] && ["isolated", "initial", "medial", "final"].indexOf(embeddedForms[ef]) > -1) {
2851                         if (typeof localVersion["normal"] === "object") {
2852                           returnable += localVersion["normal"][0];
2853                         } else {
2854                           returnable += localVersion["normal"];
2855                         }
2856                         return;
2857                       }
2858                       returnable += letter;
2859                       return;
2860                     } else if (typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2861                       returnable += form[0];
2862                       return;
2863                     }
2864                   }
2865                 }
2866               } else if (localVersion === letter) {
2867                 if (breakPresentationForm && letterForms["normal"] && ["isolated", "initial", "medial", "final"].indexOf(versions[v2]) > -1) {
2868                   if (typeof letterForms["normal"] === "object") {
2869                     returnable += letterForms["normal"][0];
2870                   } else {
2871                     returnable += letterForms["normal"];
2872                   }
2873                   return;
2874                 }
2875                 returnable += letter;
2876                 return;
2877               } else if (typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2878                 returnable += localVersion[0];
2879                 return;
2880               }
2881             }
2882           }
2883           for (let v2 = 0; v2 < reference_1.ligatureList.length; v2++) {
2884             let normalForm = reference_1.ligatureList[v2];
2885             if (normalForm !== "words") {
2886               let ligForms = Object.keys(unicode_ligatures_1.default[normalForm]);
2887               for (let f3 = 0; f3 < ligForms.length; f3++) {
2888                 if (unicode_ligatures_1.default[normalForm][ligForms[f3]] === letter) {
2889                   returnable += normalForm;
2890                   return;
2891                 }
2892               }
2893             }
2894           }
2895           for (let v3 = 0; v3 < reference_1.ligatureWordList.length; v3++) {
2896             let normalForm = reference_1.ligatureWordList[v3];
2897             if (unicode_ligatures_1.default.words[normalForm] === letter) {
2898               returnable += normalForm;
2899               return;
2900             }
2901           }
2902           returnable += letter;
2903         });
2904         return returnable;
2905       }
2906       exports2.Normal = Normal;
2907     }
2908   });
2909
2910   // node_modules/alif-toolkit/lib/CharShaper.js
2911   var require_CharShaper = __commonJS({
2912     "node_modules/alif-toolkit/lib/CharShaper.js"(exports2) {
2913       "use strict";
2914       Object.defineProperty(exports2, "__esModule", { value: true });
2915       var unicode_arabic_1 = require_unicode_arabic();
2916       var isArabic_1 = require_isArabic();
2917       var reference_1 = require_reference();
2918       function CharShaper(letter, form) {
2919         if (!isArabic_1.isArabic(letter)) {
2920           throw new Error("Not Arabic");
2921         }
2922         if (letter === "\u0621") {
2923           return "\u0621";
2924         }
2925         for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
2926           let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
2927           let versions = Object.keys(letterForms);
2928           for (let v2 = 0; v2 < versions.length; v2++) {
2929             let localVersion = letterForms[versions[v2]];
2930             if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2931               if (versions.indexOf(form) > -1) {
2932                 return letterForms[form];
2933               }
2934             } else if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2935               let embeddedVersions = Object.keys(localVersion);
2936               for (let ev = 0; ev < embeddedVersions.length; ev++) {
2937                 if (localVersion[embeddedVersions[ev]] === letter || typeof localVersion[embeddedVersions[ev]] === "object" && localVersion[embeddedVersions[ev]].indexOf && localVersion[embeddedVersions[ev]].indexOf(letter) > -1) {
2938                   if (embeddedVersions.indexOf(form) > -1) {
2939                     return localVersion[form];
2940                   }
2941                 }
2942               }
2943             }
2944           }
2945         }
2946       }
2947       exports2.CharShaper = CharShaper;
2948     }
2949   });
2950
2951   // node_modules/alif-toolkit/lib/WordShaper.js
2952   var require_WordShaper = __commonJS({
2953     "node_modules/alif-toolkit/lib/WordShaper.js"(exports2) {
2954       "use strict";
2955       Object.defineProperty(exports2, "__esModule", { value: true });
2956       var isArabic_1 = require_isArabic();
2957       var reference_1 = require_reference();
2958       var CharShaper_1 = require_CharShaper();
2959       var unicode_ligatures_1 = require_unicode_ligatures();
2960       function WordShaper2(word) {
2961         let state = "initial";
2962         let output = "";
2963         for (let w2 = 0; w2 < word.length; w2++) {
2964           let nextLetter = " ";
2965           for (let nxw = w2 + 1; nxw < word.length; nxw++) {
2966             if (!isArabic_1.isArabic(word[nxw])) {
2967               break;
2968             }
2969             if (reference_1.tashkeel.indexOf(word[nxw]) === -1) {
2970               nextLetter = word[nxw];
2971               break;
2972             }
2973           }
2974           if (!isArabic_1.isArabic(word[w2]) || isArabic_1.isMath(word[w2])) {
2975             output += word[w2];
2976             state = "initial";
2977           } else if (reference_1.tashkeel.indexOf(word[w2]) > -1) {
2978             output += word[w2];
2979           } else if (nextLetter === " " || reference_1.lineBreakers.indexOf(word[w2]) > -1) {
2980             output += CharShaper_1.CharShaper(word[w2], state === "initial" ? "isolated" : "final");
2981             state = "initial";
2982           } else if (reference_1.lams.indexOf(word[w2]) > -1 && reference_1.alefs.indexOf(nextLetter) > -1) {
2983             output += unicode_ligatures_1.default[word[w2] + nextLetter][state === "initial" ? "isolated" : "final"];
2984             while (word[w2] !== nextLetter) {
2985               w2++;
2986             }
2987             state = "initial";
2988           } else {
2989             output += CharShaper_1.CharShaper(word[w2], state);
2990             state = "medial";
2991           }
2992         }
2993         return output;
2994       }
2995       exports2.WordShaper = WordShaper2;
2996     }
2997   });
2998
2999   // node_modules/alif-toolkit/lib/ParentLetter.js
3000   var require_ParentLetter = __commonJS({
3001     "node_modules/alif-toolkit/lib/ParentLetter.js"(exports2) {
3002       "use strict";
3003       Object.defineProperty(exports2, "__esModule", { value: true });
3004       var unicode_arabic_1 = require_unicode_arabic();
3005       var isArabic_1 = require_isArabic();
3006       var reference_1 = require_reference();
3007       function ParentLetter(letter) {
3008         if (!isArabic_1.isArabic(letter)) {
3009           throw new Error("Not an Arabic letter");
3010         }
3011         for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
3012           let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
3013           let versions = Object.keys(letterForms);
3014           for (let v2 = 0; v2 < versions.length; v2++) {
3015             let localVersion = letterForms[versions[v2]];
3016             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
3017               let embeddedForms = Object.keys(localVersion);
3018               for (let ef = 0; ef < embeddedForms.length; ef++) {
3019                 let form = localVersion[embeddedForms[ef]];
3020                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
3021                   return localVersion;
3022                 }
3023               }
3024             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
3025               return letterForms;
3026             }
3027           }
3028           return null;
3029         }
3030       }
3031       exports2.ParentLetter = ParentLetter;
3032       function GrandparentLetter(letter) {
3033         if (!isArabic_1.isArabic(letter)) {
3034           throw new Error("Not an Arabic letter");
3035         }
3036         for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
3037           let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
3038           let versions = Object.keys(letterForms);
3039           for (let v2 = 0; v2 < versions.length; v2++) {
3040             let localVersion = letterForms[versions[v2]];
3041             if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
3042               let embeddedForms = Object.keys(localVersion);
3043               for (let ef = 0; ef < embeddedForms.length; ef++) {
3044                 let form = localVersion[embeddedForms[ef]];
3045                 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
3046                   return letterForms;
3047                 }
3048               }
3049             } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
3050               return letterForms;
3051             }
3052           }
3053           return null;
3054         }
3055       }
3056       exports2.GrandparentLetter = GrandparentLetter;
3057     }
3058   });
3059
3060   // node_modules/alif-toolkit/lib/index.js
3061   var require_lib = __commonJS({
3062     "node_modules/alif-toolkit/lib/index.js"(exports2) {
3063       "use strict";
3064       Object.defineProperty(exports2, "__esModule", { value: true });
3065       var isArabic_1 = require_isArabic();
3066       exports2.isArabic = isArabic_1.isArabic;
3067       var GlyphSplitter_1 = require_GlyphSplitter();
3068       exports2.GlyphSplitter = GlyphSplitter_1.GlyphSplitter;
3069       var BaselineSplitter_1 = require_BaselineSplitter();
3070       exports2.BaselineSplitter = BaselineSplitter_1.BaselineSplitter;
3071       var Normalization_1 = require_Normalization();
3072       exports2.Normal = Normalization_1.Normal;
3073       var CharShaper_1 = require_CharShaper();
3074       exports2.CharShaper = CharShaper_1.CharShaper;
3075       var WordShaper_1 = require_WordShaper();
3076       exports2.WordShaper = WordShaper_1.WordShaper;
3077       var ParentLetter_1 = require_ParentLetter();
3078       exports2.ParentLetter = ParentLetter_1.ParentLetter;
3079       exports2.GrandparentLetter = ParentLetter_1.GrandparentLetter;
3080     }
3081   });
3082
3083   // node_modules/vparse/index.js
3084   var require_vparse = __commonJS({
3085     "node_modules/vparse/index.js"(exports2, module2) {
3086       (function(window2) {
3087         "use strict";
3088         function parseVersion3(v2) {
3089           var m2 = v2.replace(/[^0-9.]/g, "").match(/[0-9]*\.|[0-9]+/g) || [];
3090           v2 = {
3091             major: +m2[0] || 0,
3092             minor: +m2[1] || 0,
3093             patch: +m2[2] || 0,
3094             build: +m2[3] || 0
3095           };
3096           v2.isEmpty = !v2.major && !v2.minor && !v2.patch && !v2.build;
3097           v2.parsed = [v2.major, v2.minor, v2.patch, v2.build];
3098           v2.text = v2.parsed.join(".");
3099           v2.compare = compare;
3100           return v2;
3101         }
3102         function compare(v2) {
3103           if (typeof v2 === "string") {
3104             v2 = parseVersion3(v2);
3105           }
3106           for (var i3 = 0; i3 < 4; i3++) {
3107             if (this.parsed[i3] !== v2.parsed[i3]) {
3108               return this.parsed[i3] > v2.parsed[i3] ? 1 : -1;
3109             }
3110           }
3111           return 0;
3112         }
3113         if (typeof module2 === "object" && module2 && typeof module2.exports === "object") {
3114           module2.exports = parseVersion3;
3115         } else {
3116           window2.parseVersion = parseVersion3;
3117         }
3118       })(exports2);
3119     }
3120   });
3121
3122   // node_modules/which-polygon/node_modules/quickselect/quickselect.js
3123   var require_quickselect = __commonJS({
3124     "node_modules/which-polygon/node_modules/quickselect/quickselect.js"(exports2, module2) {
3125       (function(global2, factory) {
3126         typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global2.quickselect = factory();
3127       })(exports2, function() {
3128         "use strict";
3129         function quickselect2(arr, k2, left, right, compare) {
3130           quickselectStep(arr, k2, left || 0, right || arr.length - 1, compare || defaultCompare);
3131         }
3132         function quickselectStep(arr, k2, left, right, compare) {
3133           while (right > left) {
3134             if (right - left > 600) {
3135               var n3 = right - left + 1;
3136               var m2 = k2 - left + 1;
3137               var z2 = Math.log(n3);
3138               var s2 = 0.5 * Math.exp(2 * z2 / 3);
3139               var sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m2 - n3 / 2 < 0 ? -1 : 1);
3140               var newLeft = Math.max(left, Math.floor(k2 - m2 * s2 / n3 + sd));
3141               var newRight = Math.min(right, Math.floor(k2 + (n3 - m2) * s2 / n3 + sd));
3142               quickselectStep(arr, k2, newLeft, newRight, compare);
3143             }
3144             var t2 = arr[k2];
3145             var i3 = left;
3146             var j3 = right;
3147             swap2(arr, left, k2);
3148             if (compare(arr[right], t2) > 0)
3149               swap2(arr, left, right);
3150             while (i3 < j3) {
3151               swap2(arr, i3, j3);
3152               i3++;
3153               j3--;
3154               while (compare(arr[i3], t2) < 0)
3155                 i3++;
3156               while (compare(arr[j3], t2) > 0)
3157                 j3--;
3158             }
3159             if (compare(arr[left], t2) === 0)
3160               swap2(arr, left, j3);
3161             else {
3162               j3++;
3163               swap2(arr, j3, right);
3164             }
3165             if (j3 <= k2)
3166               left = j3 + 1;
3167             if (k2 <= j3)
3168               right = j3 - 1;
3169           }
3170         }
3171         function swap2(arr, i3, j3) {
3172           var tmp = arr[i3];
3173           arr[i3] = arr[j3];
3174           arr[j3] = tmp;
3175         }
3176         function defaultCompare(a2, b2) {
3177           return a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
3178         }
3179         return quickselect2;
3180       });
3181     }
3182   });
3183
3184   // node_modules/which-polygon/node_modules/rbush/index.js
3185   var require_rbush = __commonJS({
3186     "node_modules/which-polygon/node_modules/rbush/index.js"(exports2, module2) {
3187       "use strict";
3188       module2.exports = rbush;
3189       module2.exports.default = rbush;
3190       var quickselect2 = require_quickselect();
3191       function rbush(maxEntries, format2) {
3192         if (!(this instanceof rbush))
3193           return new rbush(maxEntries, format2);
3194         this._maxEntries = Math.max(4, maxEntries || 9);
3195         this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
3196         if (format2) {
3197           this._initFormat(format2);
3198         }
3199         this.clear();
3200       }
3201       rbush.prototype = {
3202         all: function() {
3203           return this._all(this.data, []);
3204         },
3205         search: function(bbox2) {
3206           var node = this.data, result = [], toBBox = this.toBBox;
3207           if (!intersects(bbox2, node))
3208             return result;
3209           var nodesToSearch = [], i3, len, child, childBBox;
3210           while (node) {
3211             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
3212               child = node.children[i3];
3213               childBBox = node.leaf ? toBBox(child) : child;
3214               if (intersects(bbox2, childBBox)) {
3215                 if (node.leaf)
3216                   result.push(child);
3217                 else if (contains(bbox2, childBBox))
3218                   this._all(child, result);
3219                 else
3220                   nodesToSearch.push(child);
3221               }
3222             }
3223             node = nodesToSearch.pop();
3224           }
3225           return result;
3226         },
3227         collides: function(bbox2) {
3228           var node = this.data, toBBox = this.toBBox;
3229           if (!intersects(bbox2, node))
3230             return false;
3231           var nodesToSearch = [], i3, len, child, childBBox;
3232           while (node) {
3233             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
3234               child = node.children[i3];
3235               childBBox = node.leaf ? toBBox(child) : child;
3236               if (intersects(bbox2, childBBox)) {
3237                 if (node.leaf || contains(bbox2, childBBox))
3238                   return true;
3239                 nodesToSearch.push(child);
3240               }
3241             }
3242             node = nodesToSearch.pop();
3243           }
3244           return false;
3245         },
3246         load: function(data) {
3247           if (!(data && data.length))
3248             return this;
3249           if (data.length < this._minEntries) {
3250             for (var i3 = 0, len = data.length; i3 < len; i3++) {
3251               this.insert(data[i3]);
3252             }
3253             return this;
3254           }
3255           var node = this._build(data.slice(), 0, data.length - 1, 0);
3256           if (!this.data.children.length) {
3257             this.data = node;
3258           } else if (this.data.height === node.height) {
3259             this._splitRoot(this.data, node);
3260           } else {
3261             if (this.data.height < node.height) {
3262               var tmpNode = this.data;
3263               this.data = node;
3264               node = tmpNode;
3265             }
3266             this._insert(node, this.data.height - node.height - 1, true);
3267           }
3268           return this;
3269         },
3270         insert: function(item) {
3271           if (item)
3272             this._insert(item, this.data.height - 1);
3273           return this;
3274         },
3275         clear: function() {
3276           this.data = createNode([]);
3277           return this;
3278         },
3279         remove: function(item, equalsFn) {
3280           if (!item)
3281             return this;
3282           var node = this.data, bbox2 = this.toBBox(item), path = [], indexes = [], i3, parent, index, goingUp;
3283           while (node || path.length) {
3284             if (!node) {
3285               node = path.pop();
3286               parent = path[path.length - 1];
3287               i3 = indexes.pop();
3288               goingUp = true;
3289             }
3290             if (node.leaf) {
3291               index = findItem(item, node.children, equalsFn);
3292               if (index !== -1) {
3293                 node.children.splice(index, 1);
3294                 path.push(node);
3295                 this._condense(path);
3296                 return this;
3297               }
3298             }
3299             if (!goingUp && !node.leaf && contains(node, bbox2)) {
3300               path.push(node);
3301               indexes.push(i3);
3302               i3 = 0;
3303               parent = node;
3304               node = node.children[0];
3305             } else if (parent) {
3306               i3++;
3307               node = parent.children[i3];
3308               goingUp = false;
3309             } else
3310               node = null;
3311           }
3312           return this;
3313         },
3314         toBBox: function(item) {
3315           return item;
3316         },
3317         compareMinX: compareNodeMinX,
3318         compareMinY: compareNodeMinY,
3319         toJSON: function() {
3320           return this.data;
3321         },
3322         fromJSON: function(data) {
3323           this.data = data;
3324           return this;
3325         },
3326         _all: function(node, result) {
3327           var nodesToSearch = [];
3328           while (node) {
3329             if (node.leaf)
3330               result.push.apply(result, node.children);
3331             else
3332               nodesToSearch.push.apply(nodesToSearch, node.children);
3333             node = nodesToSearch.pop();
3334           }
3335           return result;
3336         },
3337         _build: function(items, left, right, height) {
3338           var N2 = right - left + 1, M2 = this._maxEntries, node;
3339           if (N2 <= M2) {
3340             node = createNode(items.slice(left, right + 1));
3341             calcBBox(node, this.toBBox);
3342             return node;
3343           }
3344           if (!height) {
3345             height = Math.ceil(Math.log(N2) / Math.log(M2));
3346             M2 = Math.ceil(N2 / Math.pow(M2, height - 1));
3347           }
3348           node = createNode([]);
3349           node.leaf = false;
3350           node.height = height;
3351           var N22 = Math.ceil(N2 / M2), N1 = N22 * Math.ceil(Math.sqrt(M2)), i3, j3, right2, right3;
3352           multiSelect(items, left, right, N1, this.compareMinX);
3353           for (i3 = left; i3 <= right; i3 += N1) {
3354             right2 = Math.min(i3 + N1 - 1, right);
3355             multiSelect(items, i3, right2, N22, this.compareMinY);
3356             for (j3 = i3; j3 <= right2; j3 += N22) {
3357               right3 = Math.min(j3 + N22 - 1, right2);
3358               node.children.push(this._build(items, j3, right3, height - 1));
3359             }
3360           }
3361           calcBBox(node, this.toBBox);
3362           return node;
3363         },
3364         _chooseSubtree: function(bbox2, node, level, path) {
3365           var i3, len, child, targetNode, area, enlargement, minArea, minEnlargement;
3366           while (true) {
3367             path.push(node);
3368             if (node.leaf || path.length - 1 === level)
3369               break;
3370             minArea = minEnlargement = Infinity;
3371             for (i3 = 0, len = node.children.length; i3 < len; i3++) {
3372               child = node.children[i3];
3373               area = bboxArea(child);
3374               enlargement = enlargedArea(bbox2, child) - area;
3375               if (enlargement < minEnlargement) {
3376                 minEnlargement = enlargement;
3377                 minArea = area < minArea ? area : minArea;
3378                 targetNode = child;
3379               } else if (enlargement === minEnlargement) {
3380                 if (area < minArea) {
3381                   minArea = area;
3382                   targetNode = child;
3383                 }
3384               }
3385             }
3386             node = targetNode || node.children[0];
3387           }
3388           return node;
3389         },
3390         _insert: function(item, level, isNode) {
3391           var toBBox = this.toBBox, bbox2 = isNode ? item : toBBox(item), insertPath = [];
3392           var node = this._chooseSubtree(bbox2, this.data, level, insertPath);
3393           node.children.push(item);
3394           extend2(node, bbox2);
3395           while (level >= 0) {
3396             if (insertPath[level].children.length > this._maxEntries) {
3397               this._split(insertPath, level);
3398               level--;
3399             } else
3400               break;
3401           }
3402           this._adjustParentBBoxes(bbox2, insertPath, level);
3403         },
3404         // split overflowed node into two
3405         _split: function(insertPath, level) {
3406           var node = insertPath[level], M2 = node.children.length, m2 = this._minEntries;
3407           this._chooseSplitAxis(node, m2, M2);
3408           var splitIndex = this._chooseSplitIndex(node, m2, M2);
3409           var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
3410           newNode.height = node.height;
3411           newNode.leaf = node.leaf;
3412           calcBBox(node, this.toBBox);
3413           calcBBox(newNode, this.toBBox);
3414           if (level)
3415             insertPath[level - 1].children.push(newNode);
3416           else
3417             this._splitRoot(node, newNode);
3418         },
3419         _splitRoot: function(node, newNode) {
3420           this.data = createNode([node, newNode]);
3421           this.data.height = node.height + 1;
3422           this.data.leaf = false;
3423           calcBBox(this.data, this.toBBox);
3424         },
3425         _chooseSplitIndex: function(node, m2, M2) {
3426           var i3, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
3427           minOverlap = minArea = Infinity;
3428           for (i3 = m2; i3 <= M2 - m2; i3++) {
3429             bbox1 = distBBox(node, 0, i3, this.toBBox);
3430             bbox2 = distBBox(node, i3, M2, this.toBBox);
3431             overlap = intersectionArea(bbox1, bbox2);
3432             area = bboxArea(bbox1) + bboxArea(bbox2);
3433             if (overlap < minOverlap) {
3434               minOverlap = overlap;
3435               index = i3;
3436               minArea = area < minArea ? area : minArea;
3437             } else if (overlap === minOverlap) {
3438               if (area < minArea) {
3439                 minArea = area;
3440                 index = i3;
3441               }
3442             }
3443           }
3444           return index;
3445         },
3446         // sorts node children by the best axis for split
3447         _chooseSplitAxis: function(node, m2, M2) {
3448           var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX, compareMinY = node.leaf ? this.compareMinY : compareNodeMinY, xMargin = this._allDistMargin(node, m2, M2, compareMinX), yMargin = this._allDistMargin(node, m2, M2, compareMinY);
3449           if (xMargin < yMargin)
3450             node.children.sort(compareMinX);
3451         },
3452         // total margin of all possible split distributions where each node is at least m full
3453         _allDistMargin: function(node, m2, M2, compare) {
3454           node.children.sort(compare);
3455           var toBBox = this.toBBox, leftBBox = distBBox(node, 0, m2, toBBox), rightBBox = distBBox(node, M2 - m2, M2, toBBox), margin = bboxMargin(leftBBox) + bboxMargin(rightBBox), i3, child;
3456           for (i3 = m2; i3 < M2 - m2; i3++) {
3457             child = node.children[i3];
3458             extend2(leftBBox, node.leaf ? toBBox(child) : child);
3459             margin += bboxMargin(leftBBox);
3460           }
3461           for (i3 = M2 - m2 - 1; i3 >= m2; i3--) {
3462             child = node.children[i3];
3463             extend2(rightBBox, node.leaf ? toBBox(child) : child);
3464             margin += bboxMargin(rightBBox);
3465           }
3466           return margin;
3467         },
3468         _adjustParentBBoxes: function(bbox2, path, level) {
3469           for (var i3 = level; i3 >= 0; i3--) {
3470             extend2(path[i3], bbox2);
3471           }
3472         },
3473         _condense: function(path) {
3474           for (var i3 = path.length - 1, siblings; i3 >= 0; i3--) {
3475             if (path[i3].children.length === 0) {
3476               if (i3 > 0) {
3477                 siblings = path[i3 - 1].children;
3478                 siblings.splice(siblings.indexOf(path[i3]), 1);
3479               } else
3480                 this.clear();
3481             } else
3482               calcBBox(path[i3], this.toBBox);
3483           }
3484         },
3485         _initFormat: function(format2) {
3486           var compareArr = ["return a", " - b", ";"];
3487           this.compareMinX = new Function("a", "b", compareArr.join(format2[0]));
3488           this.compareMinY = new Function("a", "b", compareArr.join(format2[1]));
3489           this.toBBox = new Function(
3490             "a",
3491             "return {minX: a" + format2[0] + ", minY: a" + format2[1] + ", maxX: a" + format2[2] + ", maxY: a" + format2[3] + "};"
3492           );
3493         }
3494       };
3495       function findItem(item, items, equalsFn) {
3496         if (!equalsFn)
3497           return items.indexOf(item);
3498         for (var i3 = 0; i3 < items.length; i3++) {
3499           if (equalsFn(item, items[i3]))
3500             return i3;
3501         }
3502         return -1;
3503       }
3504       function calcBBox(node, toBBox) {
3505         distBBox(node, 0, node.children.length, toBBox, node);
3506       }
3507       function distBBox(node, k2, p2, toBBox, destNode) {
3508         if (!destNode)
3509           destNode = createNode(null);
3510         destNode.minX = Infinity;
3511         destNode.minY = Infinity;
3512         destNode.maxX = -Infinity;
3513         destNode.maxY = -Infinity;
3514         for (var i3 = k2, child; i3 < p2; i3++) {
3515           child = node.children[i3];
3516           extend2(destNode, node.leaf ? toBBox(child) : child);
3517         }
3518         return destNode;
3519       }
3520       function extend2(a2, b2) {
3521         a2.minX = Math.min(a2.minX, b2.minX);
3522         a2.minY = Math.min(a2.minY, b2.minY);
3523         a2.maxX = Math.max(a2.maxX, b2.maxX);
3524         a2.maxY = Math.max(a2.maxY, b2.maxY);
3525         return a2;
3526       }
3527       function compareNodeMinX(a2, b2) {
3528         return a2.minX - b2.minX;
3529       }
3530       function compareNodeMinY(a2, b2) {
3531         return a2.minY - b2.minY;
3532       }
3533       function bboxArea(a2) {
3534         return (a2.maxX - a2.minX) * (a2.maxY - a2.minY);
3535       }
3536       function bboxMargin(a2) {
3537         return a2.maxX - a2.minX + (a2.maxY - a2.minY);
3538       }
3539       function enlargedArea(a2, b2) {
3540         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));
3541       }
3542       function intersectionArea(a2, b2) {
3543         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);
3544         return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
3545       }
3546       function contains(a2, b2) {
3547         return a2.minX <= b2.minX && a2.minY <= b2.minY && b2.maxX <= a2.maxX && b2.maxY <= a2.maxY;
3548       }
3549       function intersects(a2, b2) {
3550         return b2.minX <= a2.maxX && b2.minY <= a2.maxY && b2.maxX >= a2.minX && b2.maxY >= a2.minY;
3551       }
3552       function createNode(children2) {
3553         return {
3554           children: children2,
3555           height: 1,
3556           leaf: true,
3557           minX: Infinity,
3558           minY: Infinity,
3559           maxX: -Infinity,
3560           maxY: -Infinity
3561         };
3562       }
3563       function multiSelect(arr, left, right, n3, compare) {
3564         var stack = [left, right], mid;
3565         while (stack.length) {
3566           right = stack.pop();
3567           left = stack.pop();
3568           if (right - left <= n3)
3569             continue;
3570           mid = left + Math.ceil((right - left) / n3 / 2) * n3;
3571           quickselect2(arr, mid, left, right, compare);
3572           stack.push(left, mid, mid, right);
3573         }
3574       }
3575     }
3576   });
3577
3578   // node_modules/lineclip/index.js
3579   var require_lineclip = __commonJS({
3580     "node_modules/lineclip/index.js"(exports2, module2) {
3581       "use strict";
3582       module2.exports = lineclip2;
3583       lineclip2.polyline = lineclip2;
3584       lineclip2.polygon = polygonclip2;
3585       function lineclip2(points, bbox2, result) {
3586         var len = points.length, codeA = bitCode2(points[0], bbox2), part = [], i3, a2, b2, codeB, lastCode;
3587         if (!result)
3588           result = [];
3589         for (i3 = 1; i3 < len; i3++) {
3590           a2 = points[i3 - 1];
3591           b2 = points[i3];
3592           codeB = lastCode = bitCode2(b2, bbox2);
3593           while (true) {
3594             if (!(codeA | codeB)) {
3595               part.push(a2);
3596               if (codeB !== lastCode) {
3597                 part.push(b2);
3598                 if (i3 < len - 1) {
3599                   result.push(part);
3600                   part = [];
3601                 }
3602               } else if (i3 === len - 1) {
3603                 part.push(b2);
3604               }
3605               break;
3606             } else if (codeA & codeB) {
3607               break;
3608             } else if (codeA) {
3609               a2 = intersect2(a2, b2, codeA, bbox2);
3610               codeA = bitCode2(a2, bbox2);
3611             } else {
3612               b2 = intersect2(a2, b2, codeB, bbox2);
3613               codeB = bitCode2(b2, bbox2);
3614             }
3615           }
3616           codeA = lastCode;
3617         }
3618         if (part.length)
3619           result.push(part);
3620         return result;
3621       }
3622       function polygonclip2(points, bbox2) {
3623         var result, edge, prev, prevInside, i3, p2, inside;
3624         for (edge = 1; edge <= 8; edge *= 2) {
3625           result = [];
3626           prev = points[points.length - 1];
3627           prevInside = !(bitCode2(prev, bbox2) & edge);
3628           for (i3 = 0; i3 < points.length; i3++) {
3629             p2 = points[i3];
3630             inside = !(bitCode2(p2, bbox2) & edge);
3631             if (inside !== prevInside)
3632               result.push(intersect2(prev, p2, edge, bbox2));
3633             if (inside)
3634               result.push(p2);
3635             prev = p2;
3636             prevInside = inside;
3637           }
3638           points = result;
3639           if (!points.length)
3640             break;
3641         }
3642         return result;
3643       }
3644       function intersect2(a2, b2, edge, bbox2) {
3645         return edge & 8 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[3] - a2[1]) / (b2[1] - a2[1]), bbox2[3]] : (
3646           // top
3647           edge & 4 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[1] - a2[1]) / (b2[1] - a2[1]), bbox2[1]] : (
3648             // bottom
3649             edge & 2 ? [bbox2[2], a2[1] + (b2[1] - a2[1]) * (bbox2[2] - a2[0]) / (b2[0] - a2[0])] : (
3650               // right
3651               edge & 1 ? [bbox2[0], a2[1] + (b2[1] - a2[1]) * (bbox2[0] - a2[0]) / (b2[0] - a2[0])] : (
3652                 // left
3653                 null
3654               )
3655             )
3656           )
3657         );
3658       }
3659       function bitCode2(p2, bbox2) {
3660         var code = 0;
3661         if (p2[0] < bbox2[0])
3662           code |= 1;
3663         else if (p2[0] > bbox2[2])
3664           code |= 2;
3665         if (p2[1] < bbox2[1])
3666           code |= 4;
3667         else if (p2[1] > bbox2[3])
3668           code |= 8;
3669         return code;
3670       }
3671     }
3672   });
3673
3674   // node_modules/which-polygon/index.js
3675   var require_which_polygon = __commonJS({
3676     "node_modules/which-polygon/index.js"(exports2, module2) {
3677       "use strict";
3678       var rbush = require_rbush();
3679       var lineclip2 = require_lineclip();
3680       module2.exports = whichPolygon5;
3681       function whichPolygon5(data) {
3682         var bboxes = [];
3683         for (var i3 = 0; i3 < data.features.length; i3++) {
3684           var feature3 = data.features[i3];
3685           if (!feature3.geometry)
3686             continue;
3687           var coords = feature3.geometry.coordinates;
3688           if (feature3.geometry.type === "Polygon") {
3689             bboxes.push(treeItem(coords, feature3.properties));
3690           } else if (feature3.geometry.type === "MultiPolygon") {
3691             for (var j3 = 0; j3 < coords.length; j3++) {
3692               bboxes.push(treeItem(coords[j3], feature3.properties));
3693             }
3694           }
3695         }
3696         var tree = rbush().load(bboxes);
3697         function query(p2, multi) {
3698           var output = [], result = tree.search({
3699             minX: p2[0],
3700             minY: p2[1],
3701             maxX: p2[0],
3702             maxY: p2[1]
3703           });
3704           for (var i4 = 0; i4 < result.length; i4++) {
3705             if (insidePolygon(result[i4].coords, p2)) {
3706               if (multi)
3707                 output.push(result[i4].props);
3708               else
3709                 return result[i4].props;
3710             }
3711           }
3712           return multi && output.length ? output : null;
3713         }
3714         query.tree = tree;
3715         query.bbox = function queryBBox(bbox2) {
3716           var output = [];
3717           var result = tree.search({
3718             minX: bbox2[0],
3719             minY: bbox2[1],
3720             maxX: bbox2[2],
3721             maxY: bbox2[3]
3722           });
3723           for (var i4 = 0; i4 < result.length; i4++) {
3724             if (polygonIntersectsBBox(result[i4].coords, bbox2)) {
3725               output.push(result[i4].props);
3726             }
3727           }
3728           return output;
3729         };
3730         return query;
3731       }
3732       function polygonIntersectsBBox(polygon2, bbox2) {
3733         var bboxCenter = [
3734           (bbox2[0] + bbox2[2]) / 2,
3735           (bbox2[1] + bbox2[3]) / 2
3736         ];
3737         if (insidePolygon(polygon2, bboxCenter))
3738           return true;
3739         for (var i3 = 0; i3 < polygon2.length; i3++) {
3740           if (lineclip2(polygon2[i3], bbox2).length > 0)
3741             return true;
3742         }
3743         return false;
3744       }
3745       function insidePolygon(rings, p2) {
3746         var inside = false;
3747         for (var i3 = 0, len = rings.length; i3 < len; i3++) {
3748           var ring = rings[i3];
3749           for (var j3 = 0, len2 = ring.length, k2 = len2 - 1; j3 < len2; k2 = j3++) {
3750             if (rayIntersect(p2, ring[j3], ring[k2]))
3751               inside = !inside;
3752           }
3753         }
3754         return inside;
3755       }
3756       function rayIntersect(p2, p1, p22) {
3757         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];
3758       }
3759       function treeItem(coords, props) {
3760         var item = {
3761           minX: Infinity,
3762           minY: Infinity,
3763           maxX: -Infinity,
3764           maxY: -Infinity,
3765           coords,
3766           props
3767         };
3768         for (var i3 = 0; i3 < coords[0].length; i3++) {
3769           var p2 = coords[0][i3];
3770           item.minX = Math.min(item.minX, p2[0]);
3771           item.minY = Math.min(item.minY, p2[1]);
3772           item.maxX = Math.max(item.maxX, p2[0]);
3773           item.maxY = Math.max(item.maxY, p2[1]);
3774         }
3775         return item;
3776       }
3777     }
3778   });
3779
3780   // node_modules/wgs84/index.js
3781   var require_wgs84 = __commonJS({
3782     "node_modules/wgs84/index.js"(exports2, module2) {
3783       module2.exports.RADIUS = 6378137;
3784       module2.exports.FLATTENING = 1 / 298.257223563;
3785       module2.exports.POLAR_RADIUS = 63567523142e-4;
3786     }
3787   });
3788
3789   // node_modules/@mapbox/geojson-area/index.js
3790   var require_geojson_area = __commonJS({
3791     "node_modules/@mapbox/geojson-area/index.js"(exports2, module2) {
3792       var wgs84 = require_wgs84();
3793       module2.exports.geometry = geometry;
3794       module2.exports.ring = ringArea;
3795       function geometry(_2) {
3796         var area = 0, i3;
3797         switch (_2.type) {
3798           case "Polygon":
3799             return polygonArea(_2.coordinates);
3800           case "MultiPolygon":
3801             for (i3 = 0; i3 < _2.coordinates.length; i3++) {
3802               area += polygonArea(_2.coordinates[i3]);
3803             }
3804             return area;
3805           case "Point":
3806           case "MultiPoint":
3807           case "LineString":
3808           case "MultiLineString":
3809             return 0;
3810           case "GeometryCollection":
3811             for (i3 = 0; i3 < _2.geometries.length; i3++) {
3812               area += geometry(_2.geometries[i3]);
3813             }
3814             return area;
3815         }
3816       }
3817       function polygonArea(coords) {
3818         var area = 0;
3819         if (coords && coords.length > 0) {
3820           area += Math.abs(ringArea(coords[0]));
3821           for (var i3 = 1; i3 < coords.length; i3++) {
3822             area -= Math.abs(ringArea(coords[i3]));
3823           }
3824         }
3825         return area;
3826       }
3827       function ringArea(coords) {
3828         var p1, p2, p3, lowerIndex, middleIndex, upperIndex, i3, area = 0, coordsLength = coords.length;
3829         if (coordsLength > 2) {
3830           for (i3 = 0; i3 < coordsLength; i3++) {
3831             if (i3 === coordsLength - 2) {
3832               lowerIndex = coordsLength - 2;
3833               middleIndex = coordsLength - 1;
3834               upperIndex = 0;
3835             } else if (i3 === coordsLength - 1) {
3836               lowerIndex = coordsLength - 1;
3837               middleIndex = 0;
3838               upperIndex = 1;
3839             } else {
3840               lowerIndex = i3;
3841               middleIndex = i3 + 1;
3842               upperIndex = i3 + 2;
3843             }
3844             p1 = coords[lowerIndex];
3845             p2 = coords[middleIndex];
3846             p3 = coords[upperIndex];
3847             area += (rad(p3[0]) - rad(p1[0])) * Math.sin(rad(p2[1]));
3848           }
3849           area = area * wgs84.RADIUS * wgs84.RADIUS / 2;
3850         }
3851         return area;
3852       }
3853       function rad(_2) {
3854         return _2 * Math.PI / 180;
3855       }
3856     }
3857   });
3858
3859   // node_modules/circle-to-polygon/input-validation/validateCenter.js
3860   var require_validateCenter = __commonJS({
3861     "node_modules/circle-to-polygon/input-validation/validateCenter.js"(exports2) {
3862       exports2.validateCenter = function validateCenter(center) {
3863         var validCenterLengths = [2, 3];
3864         if (!Array.isArray(center) || !validCenterLengths.includes(center.length)) {
3865           throw new Error("ERROR! Center has to be an array of length two or three");
3866         }
3867         var [lng, lat] = center;
3868         if (typeof lng !== "number" || typeof lat !== "number") {
3869           throw new Error(
3870             "ERROR! Longitude and Latitude has to be numbers but where ".concat(typeof lng, " and ").concat(typeof lat)
3871           );
3872         }
3873         if (lng > 180 || lng < -180) {
3874           throw new Error("ERROR! Longitude has to be between -180 and 180 but was ".concat(lng));
3875         }
3876         if (lat > 90 || lat < -90) {
3877           throw new Error("ERROR! Latitude has to be between -90 and 90 but was ".concat(lat));
3878         }
3879       };
3880     }
3881   });
3882
3883   // node_modules/circle-to-polygon/input-validation/validateRadius.js
3884   var require_validateRadius = __commonJS({
3885     "node_modules/circle-to-polygon/input-validation/validateRadius.js"(exports2) {
3886       exports2.validateRadius = function validateRadius(radius) {
3887         if (typeof radius !== "number") {
3888           throw new Error("ERROR! Radius has to be a positive number but was: ".concat(typeof radius));
3889         }
3890         if (radius <= 0) {
3891           throw new Error("ERROR! Radius has to be a positive number but was: ".concat(radius));
3892         }
3893       };
3894     }
3895   });
3896
3897   // node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js
3898   var require_validateNumberOfEdges = __commonJS({
3899     "node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js"(exports2) {
3900       exports2.validateNumberOfEdges = function validateNumberOfEdges(numberOfEdges) {
3901         if (typeof numberOfEdges !== "number") {
3902           const ARGUMENT_TYPE = Array.isArray(numberOfEdges) ? "array" : typeof numberOfEdges;
3903           throw new Error("ERROR! Number of edges has to be a number but was: ".concat(ARGUMENT_TYPE));
3904         }
3905         if (numberOfEdges < 3) {
3906           throw new Error("ERROR! Number of edges has to be at least 3 but was: ".concat(numberOfEdges));
3907         }
3908       };
3909     }
3910   });
3911
3912   // node_modules/circle-to-polygon/input-validation/validateEarthRadius.js
3913   var require_validateEarthRadius = __commonJS({
3914     "node_modules/circle-to-polygon/input-validation/validateEarthRadius.js"(exports2) {
3915       exports2.validateEarthRadius = function validateEarthRadius(earthRadius2) {
3916         if (typeof earthRadius2 !== "number") {
3917           const ARGUMENT_TYPE = Array.isArray(earthRadius2) ? "array" : typeof earthRadius2;
3918           throw new Error("ERROR! Earth radius has to be a number but was: ".concat(ARGUMENT_TYPE));
3919         }
3920         if (earthRadius2 <= 0) {
3921           throw new Error("ERROR! Earth radius has to be a positive number but was: ".concat(earthRadius2));
3922         }
3923       };
3924     }
3925   });
3926
3927   // node_modules/circle-to-polygon/input-validation/validateBearing.js
3928   var require_validateBearing = __commonJS({
3929     "node_modules/circle-to-polygon/input-validation/validateBearing.js"(exports2) {
3930       exports2.validateBearing = function validateBearing(bearing) {
3931         if (typeof bearing !== "number") {
3932           const ARGUMENT_TYPE = Array.isArray(bearing) ? "array" : typeof bearing;
3933           throw new Error("ERROR! Bearing has to be a number but was: ".concat(ARGUMENT_TYPE));
3934         }
3935       };
3936     }
3937   });
3938
3939   // node_modules/circle-to-polygon/input-validation/index.js
3940   var require_input_validation = __commonJS({
3941     "node_modules/circle-to-polygon/input-validation/index.js"(exports2) {
3942       var validateCenter = require_validateCenter().validateCenter;
3943       var validateRadius = require_validateRadius().validateRadius;
3944       var validateNumberOfEdges = require_validateNumberOfEdges().validateNumberOfEdges;
3945       var validateEarthRadius = require_validateEarthRadius().validateEarthRadius;
3946       var validateBearing = require_validateBearing().validateBearing;
3947       function validateInput({ center, radius, numberOfEdges, earthRadius: earthRadius2, bearing }) {
3948         validateCenter(center);
3949         validateRadius(radius);
3950         validateNumberOfEdges(numberOfEdges);
3951         validateEarthRadius(earthRadius2);
3952         validateBearing(bearing);
3953       }
3954       exports2.validateCenter = validateCenter;
3955       exports2.validateRadius = validateRadius;
3956       exports2.validateNumberOfEdges = validateNumberOfEdges;
3957       exports2.validateEarthRadius = validateEarthRadius;
3958       exports2.validateBearing = validateBearing;
3959       exports2.validateInput = validateInput;
3960     }
3961   });
3962
3963   // node_modules/circle-to-polygon/index.js
3964   var require_circle_to_polygon = __commonJS({
3965     "node_modules/circle-to-polygon/index.js"(exports2, module2) {
3966       "use strict";
3967       var { validateInput } = require_input_validation();
3968       var defaultEarthRadius = 6378137;
3969       function toRadians(angleInDegrees) {
3970         return angleInDegrees * Math.PI / 180;
3971       }
3972       function toDegrees(angleInRadians) {
3973         return angleInRadians * 180 / Math.PI;
3974       }
3975       function offset(c1, distance, earthRadius2, bearing) {
3976         var lat1 = toRadians(c1[1]);
3977         var lon1 = toRadians(c1[0]);
3978         var dByR = distance / earthRadius2;
3979         var lat = Math.asin(
3980           Math.sin(lat1) * Math.cos(dByR) + Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing)
3981         );
3982         var lon = lon1 + Math.atan2(
3983           Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1),
3984           Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat)
3985         );
3986         return [toDegrees(lon), toDegrees(lat)];
3987       }
3988       module2.exports = function circleToPolygon2(center, radius, options2) {
3989         var n3 = getNumberOfEdges(options2);
3990         var earthRadius2 = getEarthRadius(options2);
3991         var bearing = getBearing(options2);
3992         var direction = getDirection(options2);
3993         validateInput({ center, radius, numberOfEdges: n3, earthRadius: earthRadius2, bearing });
3994         var start2 = toRadians(bearing);
3995         var coordinates = [];
3996         for (var i3 = 0; i3 < n3; ++i3) {
3997           coordinates.push(
3998             offset(
3999               center,
4000               radius,
4001               earthRadius2,
4002               start2 + direction * 2 * Math.PI * -i3 / n3
4003             )
4004           );
4005         }
4006         coordinates.push(coordinates[0]);
4007         return {
4008           type: "Polygon",
4009           coordinates: [coordinates]
4010         };
4011       };
4012       function getNumberOfEdges(options2) {
4013         if (isUndefinedOrNull(options2)) {
4014           return 32;
4015         } else if (isObjectNotArray(options2)) {
4016           var numberOfEdges = options2.numberOfEdges;
4017           return numberOfEdges === void 0 ? 32 : numberOfEdges;
4018         }
4019         return options2;
4020       }
4021       function getEarthRadius(options2) {
4022         if (isUndefinedOrNull(options2)) {
4023           return defaultEarthRadius;
4024         } else if (isObjectNotArray(options2)) {
4025           var earthRadius2 = options2.earthRadius;
4026           return earthRadius2 === void 0 ? defaultEarthRadius : earthRadius2;
4027         }
4028         return defaultEarthRadius;
4029       }
4030       function getDirection(options2) {
4031         if (isObjectNotArray(options2) && options2.rightHandRule) {
4032           return -1;
4033         }
4034         return 1;
4035       }
4036       function getBearing(options2) {
4037         if (isUndefinedOrNull(options2)) {
4038           return 0;
4039         } else if (isObjectNotArray(options2)) {
4040           var bearing = options2.bearing;
4041           return bearing === void 0 ? 0 : bearing;
4042         }
4043         return 0;
4044       }
4045       function isObjectNotArray(argument) {
4046         return argument !== null && typeof argument === "object" && !Array.isArray(argument);
4047       }
4048       function isUndefinedOrNull(argument) {
4049         return argument === null || argument === void 0;
4050       }
4051     }
4052   });
4053
4054   // node_modules/polygon-clipping/dist/polygon-clipping.umd.js
4055   var require_polygon_clipping_umd = __commonJS({
4056     "node_modules/polygon-clipping/dist/polygon-clipping.umd.js"(exports2, module2) {
4057       (function(global2, factory) {
4058         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());
4059       })(exports2, function() {
4060         "use strict";
4061         function _classCallCheck(instance, Constructor) {
4062           if (!(instance instanceof Constructor)) {
4063             throw new TypeError("Cannot call a class as a function");
4064           }
4065         }
4066         function _defineProperties(target, props) {
4067           for (var i3 = 0; i3 < props.length; i3++) {
4068             var descriptor = props[i3];
4069             descriptor.enumerable = descriptor.enumerable || false;
4070             descriptor.configurable = true;
4071             if ("value" in descriptor)
4072               descriptor.writable = true;
4073             Object.defineProperty(target, descriptor.key, descriptor);
4074           }
4075         }
4076         function _createClass(Constructor, protoProps, staticProps) {
4077           if (protoProps)
4078             _defineProperties(Constructor.prototype, protoProps);
4079           if (staticProps)
4080             _defineProperties(Constructor, staticProps);
4081           return Constructor;
4082         }
4083         var Node = (
4084           /** @class */
4085           function() {
4086             function Node2(key, data) {
4087               this.next = null;
4088               this.key = key;
4089               this.data = data;
4090               this.left = null;
4091               this.right = null;
4092             }
4093             return Node2;
4094           }()
4095         );
4096         function DEFAULT_COMPARE(a2, b2) {
4097           return a2 > b2 ? 1 : a2 < b2 ? -1 : 0;
4098         }
4099         function splay(i3, t2, comparator) {
4100           var N2 = new Node(null, null);
4101           var l2 = N2;
4102           var r2 = N2;
4103           while (true) {
4104             var cmp2 = comparator(i3, t2.key);
4105             if (cmp2 < 0) {
4106               if (t2.left === null)
4107                 break;
4108               if (comparator(i3, t2.left.key) < 0) {
4109                 var y2 = t2.left;
4110                 t2.left = y2.right;
4111                 y2.right = t2;
4112                 t2 = y2;
4113                 if (t2.left === null)
4114                   break;
4115               }
4116               r2.left = t2;
4117               r2 = t2;
4118               t2 = t2.left;
4119             } else if (cmp2 > 0) {
4120               if (t2.right === null)
4121                 break;
4122               if (comparator(i3, t2.right.key) > 0) {
4123                 var y2 = t2.right;
4124                 t2.right = y2.left;
4125                 y2.left = t2;
4126                 t2 = y2;
4127                 if (t2.right === null)
4128                   break;
4129               }
4130               l2.right = t2;
4131               l2 = t2;
4132               t2 = t2.right;
4133             } else
4134               break;
4135           }
4136           l2.right = t2.left;
4137           r2.left = t2.right;
4138           t2.left = N2.right;
4139           t2.right = N2.left;
4140           return t2;
4141         }
4142         function insert(i3, data, t2, comparator) {
4143           var node = new Node(i3, data);
4144           if (t2 === null) {
4145             node.left = node.right = null;
4146             return node;
4147           }
4148           t2 = splay(i3, t2, comparator);
4149           var cmp2 = comparator(i3, t2.key);
4150           if (cmp2 < 0) {
4151             node.left = t2.left;
4152             node.right = t2;
4153             t2.left = null;
4154           } else if (cmp2 >= 0) {
4155             node.right = t2.right;
4156             node.left = t2;
4157             t2.right = null;
4158           }
4159           return node;
4160         }
4161         function split(key, v2, comparator) {
4162           var left = null;
4163           var right = null;
4164           if (v2) {
4165             v2 = splay(key, v2, comparator);
4166             var cmp2 = comparator(v2.key, key);
4167             if (cmp2 === 0) {
4168               left = v2.left;
4169               right = v2.right;
4170             } else if (cmp2 < 0) {
4171               right = v2.right;
4172               v2.right = null;
4173               left = v2;
4174             } else {
4175               left = v2.left;
4176               v2.left = null;
4177               right = v2;
4178             }
4179           }
4180           return {
4181             left,
4182             right
4183           };
4184         }
4185         function merge2(left, right, comparator) {
4186           if (right === null)
4187             return left;
4188           if (left === null)
4189             return right;
4190           right = splay(left.key, right, comparator);
4191           right.left = left;
4192           return right;
4193         }
4194         function printRow(root3, prefix, isTail, out, printNode) {
4195           if (root3) {
4196             out("" + prefix + (isTail ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ") + printNode(root3) + "\n");
4197             var indent2 = prefix + (isTail ? "    " : "\u2502   ");
4198             if (root3.left)
4199               printRow(root3.left, indent2, false, out, printNode);
4200             if (root3.right)
4201               printRow(root3.right, indent2, true, out, printNode);
4202           }
4203         }
4204         var Tree = (
4205           /** @class */
4206           function() {
4207             function Tree2(comparator) {
4208               if (comparator === void 0) {
4209                 comparator = DEFAULT_COMPARE;
4210               }
4211               this._root = null;
4212               this._size = 0;
4213               this._comparator = comparator;
4214             }
4215             Tree2.prototype.insert = function(key, data) {
4216               this._size++;
4217               return this._root = insert(key, data, this._root, this._comparator);
4218             };
4219             Tree2.prototype.add = function(key, data) {
4220               var node = new Node(key, data);
4221               if (this._root === null) {
4222                 node.left = node.right = null;
4223                 this._size++;
4224                 this._root = node;
4225               }
4226               var comparator = this._comparator;
4227               var t2 = splay(key, this._root, comparator);
4228               var cmp2 = comparator(key, t2.key);
4229               if (cmp2 === 0)
4230                 this._root = t2;
4231               else {
4232                 if (cmp2 < 0) {
4233                   node.left = t2.left;
4234                   node.right = t2;
4235                   t2.left = null;
4236                 } else if (cmp2 > 0) {
4237                   node.right = t2.right;
4238                   node.left = t2;
4239                   t2.right = null;
4240                 }
4241                 this._size++;
4242                 this._root = node;
4243               }
4244               return this._root;
4245             };
4246             Tree2.prototype.remove = function(key) {
4247               this._root = this._remove(key, this._root, this._comparator);
4248             };
4249             Tree2.prototype._remove = function(i3, t2, comparator) {
4250               var x2;
4251               if (t2 === null)
4252                 return null;
4253               t2 = splay(i3, t2, comparator);
4254               var cmp2 = comparator(i3, t2.key);
4255               if (cmp2 === 0) {
4256                 if (t2.left === null) {
4257                   x2 = t2.right;
4258                 } else {
4259                   x2 = splay(i3, t2.left, comparator);
4260                   x2.right = t2.right;
4261                 }
4262                 this._size--;
4263                 return x2;
4264               }
4265               return t2;
4266             };
4267             Tree2.prototype.pop = function() {
4268               var node = this._root;
4269               if (node) {
4270                 while (node.left) {
4271                   node = node.left;
4272                 }
4273                 this._root = splay(node.key, this._root, this._comparator);
4274                 this._root = this._remove(node.key, this._root, this._comparator);
4275                 return {
4276                   key: node.key,
4277                   data: node.data
4278                 };
4279               }
4280               return null;
4281             };
4282             Tree2.prototype.findStatic = function(key) {
4283               var current = this._root;
4284               var compare = this._comparator;
4285               while (current) {
4286                 var cmp2 = compare(key, current.key);
4287                 if (cmp2 === 0)
4288                   return current;
4289                 else if (cmp2 < 0)
4290                   current = current.left;
4291                 else
4292                   current = current.right;
4293               }
4294               return null;
4295             };
4296             Tree2.prototype.find = function(key) {
4297               if (this._root) {
4298                 this._root = splay(key, this._root, this._comparator);
4299                 if (this._comparator(key, this._root.key) !== 0)
4300                   return null;
4301               }
4302               return this._root;
4303             };
4304             Tree2.prototype.contains = function(key) {
4305               var current = this._root;
4306               var compare = this._comparator;
4307               while (current) {
4308                 var cmp2 = compare(key, current.key);
4309                 if (cmp2 === 0)
4310                   return true;
4311                 else if (cmp2 < 0)
4312                   current = current.left;
4313                 else
4314                   current = current.right;
4315               }
4316               return false;
4317             };
4318             Tree2.prototype.forEach = function(visitor, ctx) {
4319               var current = this._root;
4320               var Q2 = [];
4321               var done = false;
4322               while (!done) {
4323                 if (current !== null) {
4324                   Q2.push(current);
4325                   current = current.left;
4326                 } else {
4327                   if (Q2.length !== 0) {
4328                     current = Q2.pop();
4329                     visitor.call(ctx, current);
4330                     current = current.right;
4331                   } else
4332                     done = true;
4333                 }
4334               }
4335               return this;
4336             };
4337             Tree2.prototype.range = function(low, high, fn, ctx) {
4338               var Q2 = [];
4339               var compare = this._comparator;
4340               var node = this._root;
4341               var cmp2;
4342               while (Q2.length !== 0 || node) {
4343                 if (node) {
4344                   Q2.push(node);
4345                   node = node.left;
4346                 } else {
4347                   node = Q2.pop();
4348                   cmp2 = compare(node.key, high);
4349                   if (cmp2 > 0) {
4350                     break;
4351                   } else if (compare(node.key, low) >= 0) {
4352                     if (fn.call(ctx, node))
4353                       return this;
4354                   }
4355                   node = node.right;
4356                 }
4357               }
4358               return this;
4359             };
4360             Tree2.prototype.keys = function() {
4361               var keys2 = [];
4362               this.forEach(function(_a) {
4363                 var key = _a.key;
4364                 return keys2.push(key);
4365               });
4366               return keys2;
4367             };
4368             Tree2.prototype.values = function() {
4369               var values = [];
4370               this.forEach(function(_a) {
4371                 var data = _a.data;
4372                 return values.push(data);
4373               });
4374               return values;
4375             };
4376             Tree2.prototype.min = function() {
4377               if (this._root)
4378                 return this.minNode(this._root).key;
4379               return null;
4380             };
4381             Tree2.prototype.max = function() {
4382               if (this._root)
4383                 return this.maxNode(this._root).key;
4384               return null;
4385             };
4386             Tree2.prototype.minNode = function(t2) {
4387               if (t2 === void 0) {
4388                 t2 = this._root;
4389               }
4390               if (t2)
4391                 while (t2.left) {
4392                   t2 = t2.left;
4393                 }
4394               return t2;
4395             };
4396             Tree2.prototype.maxNode = function(t2) {
4397               if (t2 === void 0) {
4398                 t2 = this._root;
4399               }
4400               if (t2)
4401                 while (t2.right) {
4402                   t2 = t2.right;
4403                 }
4404               return t2;
4405             };
4406             Tree2.prototype.at = function(index2) {
4407               var current = this._root;
4408               var done = false;
4409               var i3 = 0;
4410               var Q2 = [];
4411               while (!done) {
4412                 if (current) {
4413                   Q2.push(current);
4414                   current = current.left;
4415                 } else {
4416                   if (Q2.length > 0) {
4417                     current = Q2.pop();
4418                     if (i3 === index2)
4419                       return current;
4420                     i3++;
4421                     current = current.right;
4422                   } else
4423                     done = true;
4424                 }
4425               }
4426               return null;
4427             };
4428             Tree2.prototype.next = function(d2) {
4429               var root3 = this._root;
4430               var successor = null;
4431               if (d2.right) {
4432                 successor = d2.right;
4433                 while (successor.left) {
4434                   successor = successor.left;
4435                 }
4436                 return successor;
4437               }
4438               var comparator = this._comparator;
4439               while (root3) {
4440                 var cmp2 = comparator(d2.key, root3.key);
4441                 if (cmp2 === 0)
4442                   break;
4443                 else if (cmp2 < 0) {
4444                   successor = root3;
4445                   root3 = root3.left;
4446                 } else
4447                   root3 = root3.right;
4448               }
4449               return successor;
4450             };
4451             Tree2.prototype.prev = function(d2) {
4452               var root3 = this._root;
4453               var predecessor = null;
4454               if (d2.left !== null) {
4455                 predecessor = d2.left;
4456                 while (predecessor.right) {
4457                   predecessor = predecessor.right;
4458                 }
4459                 return predecessor;
4460               }
4461               var comparator = this._comparator;
4462               while (root3) {
4463                 var cmp2 = comparator(d2.key, root3.key);
4464                 if (cmp2 === 0)
4465                   break;
4466                 else if (cmp2 < 0)
4467                   root3 = root3.left;
4468                 else {
4469                   predecessor = root3;
4470                   root3 = root3.right;
4471                 }
4472               }
4473               return predecessor;
4474             };
4475             Tree2.prototype.clear = function() {
4476               this._root = null;
4477               this._size = 0;
4478               return this;
4479             };
4480             Tree2.prototype.toList = function() {
4481               return toList(this._root);
4482             };
4483             Tree2.prototype.load = function(keys2, values, presort) {
4484               if (values === void 0) {
4485                 values = [];
4486               }
4487               if (presort === void 0) {
4488                 presort = false;
4489               }
4490               var size = keys2.length;
4491               var comparator = this._comparator;
4492               if (presort)
4493                 sort(keys2, values, 0, size - 1, comparator);
4494               if (this._root === null) {
4495                 this._root = loadRecursive(keys2, values, 0, size);
4496                 this._size = size;
4497               } else {
4498                 var mergedList = mergeLists(this.toList(), createList(keys2, values), comparator);
4499                 size = this._size + size;
4500                 this._root = sortedListToBST({
4501                   head: mergedList
4502                 }, 0, size);
4503               }
4504               return this;
4505             };
4506             Tree2.prototype.isEmpty = function() {
4507               return this._root === null;
4508             };
4509             Object.defineProperty(Tree2.prototype, "size", {
4510               get: function get4() {
4511                 return this._size;
4512               },
4513               enumerable: true,
4514               configurable: true
4515             });
4516             Object.defineProperty(Tree2.prototype, "root", {
4517               get: function get4() {
4518                 return this._root;
4519               },
4520               enumerable: true,
4521               configurable: true
4522             });
4523             Tree2.prototype.toString = function(printNode) {
4524               if (printNode === void 0) {
4525                 printNode = function printNode2(n3) {
4526                   return String(n3.key);
4527                 };
4528               }
4529               var out = [];
4530               printRow(this._root, "", true, function(v2) {
4531                 return out.push(v2);
4532               }, printNode);
4533               return out.join("");
4534             };
4535             Tree2.prototype.update = function(key, newKey, newData) {
4536               var comparator = this._comparator;
4537               var _a = split(key, this._root, comparator), left = _a.left, right = _a.right;
4538               if (comparator(key, newKey) < 0) {
4539                 right = insert(newKey, newData, right, comparator);
4540               } else {
4541                 left = insert(newKey, newData, left, comparator);
4542               }
4543               this._root = merge2(left, right, comparator);
4544             };
4545             Tree2.prototype.split = function(key) {
4546               return split(key, this._root, this._comparator);
4547             };
4548             return Tree2;
4549           }()
4550         );
4551         function loadRecursive(keys2, values, start2, end) {
4552           var size = end - start2;
4553           if (size > 0) {
4554             var middle = start2 + Math.floor(size / 2);
4555             var key = keys2[middle];
4556             var data = values[middle];
4557             var node = new Node(key, data);
4558             node.left = loadRecursive(keys2, values, start2, middle);
4559             node.right = loadRecursive(keys2, values, middle + 1, end);
4560             return node;
4561           }
4562           return null;
4563         }
4564         function createList(keys2, values) {
4565           var head = new Node(null, null);
4566           var p2 = head;
4567           for (var i3 = 0; i3 < keys2.length; i3++) {
4568             p2 = p2.next = new Node(keys2[i3], values[i3]);
4569           }
4570           p2.next = null;
4571           return head.next;
4572         }
4573         function toList(root3) {
4574           var current = root3;
4575           var Q2 = [];
4576           var done = false;
4577           var head = new Node(null, null);
4578           var p2 = head;
4579           while (!done) {
4580             if (current) {
4581               Q2.push(current);
4582               current = current.left;
4583             } else {
4584               if (Q2.length > 0) {
4585                 current = p2 = p2.next = Q2.pop();
4586                 current = current.right;
4587               } else
4588                 done = true;
4589             }
4590           }
4591           p2.next = null;
4592           return head.next;
4593         }
4594         function sortedListToBST(list, start2, end) {
4595           var size = end - start2;
4596           if (size > 0) {
4597             var middle = start2 + Math.floor(size / 2);
4598             var left = sortedListToBST(list, start2, middle);
4599             var root3 = list.head;
4600             root3.left = left;
4601             list.head = list.head.next;
4602             root3.right = sortedListToBST(list, middle + 1, end);
4603             return root3;
4604           }
4605           return null;
4606         }
4607         function mergeLists(l1, l2, compare) {
4608           var head = new Node(null, null);
4609           var p2 = head;
4610           var p1 = l1;
4611           var p22 = l2;
4612           while (p1 !== null && p22 !== null) {
4613             if (compare(p1.key, p22.key) < 0) {
4614               p2.next = p1;
4615               p1 = p1.next;
4616             } else {
4617               p2.next = p22;
4618               p22 = p22.next;
4619             }
4620             p2 = p2.next;
4621           }
4622           if (p1 !== null) {
4623             p2.next = p1;
4624           } else if (p22 !== null) {
4625             p2.next = p22;
4626           }
4627           return head.next;
4628         }
4629         function sort(keys2, values, left, right, compare) {
4630           if (left >= right)
4631             return;
4632           var pivot = keys2[left + right >> 1];
4633           var i3 = left - 1;
4634           var j3 = right + 1;
4635           while (true) {
4636             do {
4637               i3++;
4638             } while (compare(keys2[i3], pivot) < 0);
4639             do {
4640               j3--;
4641             } while (compare(keys2[j3], pivot) > 0);
4642             if (i3 >= j3)
4643               break;
4644             var tmp = keys2[i3];
4645             keys2[i3] = keys2[j3];
4646             keys2[j3] = tmp;
4647             tmp = values[i3];
4648             values[i3] = values[j3];
4649             values[j3] = tmp;
4650           }
4651           sort(keys2, values, left, j3, compare);
4652           sort(keys2, values, j3 + 1, right, compare);
4653         }
4654         var isInBbox = function isInBbox2(bbox2, point2) {
4655           return bbox2.ll.x <= point2.x && point2.x <= bbox2.ur.x && bbox2.ll.y <= point2.y && point2.y <= bbox2.ur.y;
4656         };
4657         var getBboxOverlap = function getBboxOverlap2(b1, b2) {
4658           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)
4659             return null;
4660           var lowerX = b1.ll.x < b2.ll.x ? b2.ll.x : b1.ll.x;
4661           var upperX = b1.ur.x < b2.ur.x ? b1.ur.x : b2.ur.x;
4662           var lowerY = b1.ll.y < b2.ll.y ? b2.ll.y : b1.ll.y;
4663           var upperY = b1.ur.y < b2.ur.y ? b1.ur.y : b2.ur.y;
4664           return {
4665             ll: {
4666               x: lowerX,
4667               y: lowerY
4668             },
4669             ur: {
4670               x: upperX,
4671               y: upperY
4672             }
4673           };
4674         };
4675         var epsilon3 = Number.EPSILON;
4676         if (epsilon3 === void 0)
4677           epsilon3 = Math.pow(2, -52);
4678         var EPSILON_SQ = epsilon3 * epsilon3;
4679         var cmp = function cmp2(a2, b2) {
4680           if (-epsilon3 < a2 && a2 < epsilon3) {
4681             if (-epsilon3 < b2 && b2 < epsilon3) {
4682               return 0;
4683             }
4684           }
4685           var ab = a2 - b2;
4686           if (ab * ab < EPSILON_SQ * a2 * b2) {
4687             return 0;
4688           }
4689           return a2 < b2 ? -1 : 1;
4690         };
4691         var PtRounder = /* @__PURE__ */ function() {
4692           function PtRounder2() {
4693             _classCallCheck(this, PtRounder2);
4694             this.reset();
4695           }
4696           _createClass(PtRounder2, [{
4697             key: "reset",
4698             value: function reset() {
4699               this.xRounder = new CoordRounder();
4700               this.yRounder = new CoordRounder();
4701             }
4702           }, {
4703             key: "round",
4704             value: function round(x2, y2) {
4705               return {
4706                 x: this.xRounder.round(x2),
4707                 y: this.yRounder.round(y2)
4708               };
4709             }
4710           }]);
4711           return PtRounder2;
4712         }();
4713         var CoordRounder = /* @__PURE__ */ function() {
4714           function CoordRounder2() {
4715             _classCallCheck(this, CoordRounder2);
4716             this.tree = new Tree();
4717             this.round(0);
4718           }
4719           _createClass(CoordRounder2, [{
4720             key: "round",
4721             value: function round(coord2) {
4722               var node = this.tree.add(coord2);
4723               var prevNode = this.tree.prev(node);
4724               if (prevNode !== null && cmp(node.key, prevNode.key) === 0) {
4725                 this.tree.remove(coord2);
4726                 return prevNode.key;
4727               }
4728               var nextNode = this.tree.next(node);
4729               if (nextNode !== null && cmp(node.key, nextNode.key) === 0) {
4730                 this.tree.remove(coord2);
4731                 return nextNode.key;
4732               }
4733               return coord2;
4734             }
4735           }]);
4736           return CoordRounder2;
4737         }();
4738         var rounder = new PtRounder();
4739         var crossProduct = function crossProduct2(a2, b2) {
4740           return a2.x * b2.y - a2.y * b2.x;
4741         };
4742         var dotProduct = function dotProduct2(a2, b2) {
4743           return a2.x * b2.x + a2.y * b2.y;
4744         };
4745         var compareVectorAngles = function compareVectorAngles2(basePt, endPt1, endPt2) {
4746           var v1 = {
4747             x: endPt1.x - basePt.x,
4748             y: endPt1.y - basePt.y
4749           };
4750           var v2 = {
4751             x: endPt2.x - basePt.x,
4752             y: endPt2.y - basePt.y
4753           };
4754           var kross = crossProduct(v1, v2);
4755           return cmp(kross, 0);
4756         };
4757         var length = function length2(v2) {
4758           return Math.sqrt(dotProduct(v2, v2));
4759         };
4760         var sineOfAngle = function sineOfAngle2(pShared, pBase, pAngle) {
4761           var vBase = {
4762             x: pBase.x - pShared.x,
4763             y: pBase.y - pShared.y
4764           };
4765           var vAngle = {
4766             x: pAngle.x - pShared.x,
4767             y: pAngle.y - pShared.y
4768           };
4769           return crossProduct(vAngle, vBase) / length(vAngle) / length(vBase);
4770         };
4771         var cosineOfAngle = function cosineOfAngle2(pShared, pBase, pAngle) {
4772           var vBase = {
4773             x: pBase.x - pShared.x,
4774             y: pBase.y - pShared.y
4775           };
4776           var vAngle = {
4777             x: pAngle.x - pShared.x,
4778             y: pAngle.y - pShared.y
4779           };
4780           return dotProduct(vAngle, vBase) / length(vAngle) / length(vBase);
4781         };
4782         var horizontalIntersection = function horizontalIntersection2(pt2, v2, y2) {
4783           if (v2.y === 0)
4784             return null;
4785           return {
4786             x: pt2.x + v2.x / v2.y * (y2 - pt2.y),
4787             y: y2
4788           };
4789         };
4790         var verticalIntersection = function verticalIntersection2(pt2, v2, x2) {
4791           if (v2.x === 0)
4792             return null;
4793           return {
4794             x: x2,
4795             y: pt2.y + v2.y / v2.x * (x2 - pt2.x)
4796           };
4797         };
4798         var intersection = function intersection2(pt1, v1, pt2, v2) {
4799           if (v1.x === 0)
4800             return verticalIntersection(pt2, v2, pt1.x);
4801           if (v2.x === 0)
4802             return verticalIntersection(pt1, v1, pt2.x);
4803           if (v1.y === 0)
4804             return horizontalIntersection(pt2, v2, pt1.y);
4805           if (v2.y === 0)
4806             return horizontalIntersection(pt1, v1, pt2.y);
4807           var kross = crossProduct(v1, v2);
4808           if (kross == 0)
4809             return null;
4810           var ve2 = {
4811             x: pt2.x - pt1.x,
4812             y: pt2.y - pt1.y
4813           };
4814           var d1 = crossProduct(ve2, v1) / kross;
4815           var d2 = crossProduct(ve2, v2) / kross;
4816           var x12 = pt1.x + d2 * v1.x, x2 = pt2.x + d1 * v2.x;
4817           var y12 = pt1.y + d2 * v1.y, y2 = pt2.y + d1 * v2.y;
4818           var x3 = (x12 + x2) / 2;
4819           var y3 = (y12 + y2) / 2;
4820           return {
4821             x: x3,
4822             y: y3
4823           };
4824         };
4825         var SweepEvent = /* @__PURE__ */ function() {
4826           _createClass(SweepEvent2, null, [{
4827             key: "compare",
4828             // for ordering sweep events in the sweep event queue
4829             value: function compare(a2, b2) {
4830               var ptCmp = SweepEvent2.comparePoints(a2.point, b2.point);
4831               if (ptCmp !== 0)
4832                 return ptCmp;
4833               if (a2.point !== b2.point)
4834                 a2.link(b2);
4835               if (a2.isLeft !== b2.isLeft)
4836                 return a2.isLeft ? 1 : -1;
4837               return Segment.compare(a2.segment, b2.segment);
4838             }
4839             // for ordering points in sweep line order
4840           }, {
4841             key: "comparePoints",
4842             value: function comparePoints(aPt, bPt) {
4843               if (aPt.x < bPt.x)
4844                 return -1;
4845               if (aPt.x > bPt.x)
4846                 return 1;
4847               if (aPt.y < bPt.y)
4848                 return -1;
4849               if (aPt.y > bPt.y)
4850                 return 1;
4851               return 0;
4852             }
4853             // Warning: 'point' input will be modified and re-used (for performance)
4854           }]);
4855           function SweepEvent2(point2, isLeft) {
4856             _classCallCheck(this, SweepEvent2);
4857             if (point2.events === void 0)
4858               point2.events = [this];
4859             else
4860               point2.events.push(this);
4861             this.point = point2;
4862             this.isLeft = isLeft;
4863           }
4864           _createClass(SweepEvent2, [{
4865             key: "link",
4866             value: function link2(other) {
4867               if (other.point === this.point) {
4868                 throw new Error("Tried to link already linked events");
4869               }
4870               var otherEvents = other.point.events;
4871               for (var i3 = 0, iMax = otherEvents.length; i3 < iMax; i3++) {
4872                 var evt = otherEvents[i3];
4873                 this.point.events.push(evt);
4874                 evt.point = this.point;
4875               }
4876               this.checkForConsuming();
4877             }
4878             /* Do a pass over our linked events and check to see if any pair
4879              * of segments match, and should be consumed. */
4880           }, {
4881             key: "checkForConsuming",
4882             value: function checkForConsuming() {
4883               var numEvents = this.point.events.length;
4884               for (var i3 = 0; i3 < numEvents; i3++) {
4885                 var evt1 = this.point.events[i3];
4886                 if (evt1.segment.consumedBy !== void 0)
4887                   continue;
4888                 for (var j3 = i3 + 1; j3 < numEvents; j3++) {
4889                   var evt2 = this.point.events[j3];
4890                   if (evt2.consumedBy !== void 0)
4891                     continue;
4892                   if (evt1.otherSE.point.events !== evt2.otherSE.point.events)
4893                     continue;
4894                   evt1.segment.consume(evt2.segment);
4895                 }
4896               }
4897             }
4898           }, {
4899             key: "getAvailableLinkedEvents",
4900             value: function getAvailableLinkedEvents() {
4901               var events = [];
4902               for (var i3 = 0, iMax = this.point.events.length; i3 < iMax; i3++) {
4903                 var evt = this.point.events[i3];
4904                 if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
4905                   events.push(evt);
4906                 }
4907               }
4908               return events;
4909             }
4910             /**
4911              * Returns a comparator function for sorting linked events that will
4912              * favor the event that will give us the smallest left-side angle.
4913              * All ring construction starts as low as possible heading to the right,
4914              * so by always turning left as sharp as possible we'll get polygons
4915              * without uncessary loops & holes.
4916              *
4917              * The comparator function has a compute cache such that it avoids
4918              * re-computing already-computed values.
4919              */
4920           }, {
4921             key: "getLeftmostComparator",
4922             value: function getLeftmostComparator(baseEvent) {
4923               var _this = this;
4924               var cache = /* @__PURE__ */ new Map();
4925               var fillCache = function fillCache2(linkedEvent) {
4926                 var nextEvent = linkedEvent.otherSE;
4927                 cache.set(linkedEvent, {
4928                   sine: sineOfAngle(_this.point, baseEvent.point, nextEvent.point),
4929                   cosine: cosineOfAngle(_this.point, baseEvent.point, nextEvent.point)
4930                 });
4931               };
4932               return function(a2, b2) {
4933                 if (!cache.has(a2))
4934                   fillCache(a2);
4935                 if (!cache.has(b2))
4936                   fillCache(b2);
4937                 var _cache$get = cache.get(a2), asine = _cache$get.sine, acosine = _cache$get.cosine;
4938                 var _cache$get2 = cache.get(b2), bsine = _cache$get2.sine, bcosine = _cache$get2.cosine;
4939                 if (asine >= 0 && bsine >= 0) {
4940                   if (acosine < bcosine)
4941                     return 1;
4942                   if (acosine > bcosine)
4943                     return -1;
4944                   return 0;
4945                 }
4946                 if (asine < 0 && bsine < 0) {
4947                   if (acosine < bcosine)
4948                     return -1;
4949                   if (acosine > bcosine)
4950                     return 1;
4951                   return 0;
4952                 }
4953                 if (bsine < asine)
4954                   return -1;
4955                 if (bsine > asine)
4956                   return 1;
4957                 return 0;
4958               };
4959             }
4960           }]);
4961           return SweepEvent2;
4962         }();
4963         var segmentId = 0;
4964         var Segment = /* @__PURE__ */ function() {
4965           _createClass(Segment2, null, [{
4966             key: "compare",
4967             /* This compare() function is for ordering segments in the sweep
4968              * line tree, and does so according to the following criteria:
4969              *
4970              * Consider the vertical line that lies an infinestimal step to the
4971              * right of the right-more of the two left endpoints of the input
4972              * segments. Imagine slowly moving a point up from negative infinity
4973              * in the increasing y direction. Which of the two segments will that
4974              * point intersect first? That segment comes 'before' the other one.
4975              *
4976              * If neither segment would be intersected by such a line, (if one
4977              * or more of the segments are vertical) then the line to be considered
4978              * is directly on the right-more of the two left inputs.
4979              */
4980             value: function compare(a2, b2) {
4981               var alx = a2.leftSE.point.x;
4982               var blx = b2.leftSE.point.x;
4983               var arx = a2.rightSE.point.x;
4984               var brx = b2.rightSE.point.x;
4985               if (brx < alx)
4986                 return 1;
4987               if (arx < blx)
4988                 return -1;
4989               var aly = a2.leftSE.point.y;
4990               var bly = b2.leftSE.point.y;
4991               var ary = a2.rightSE.point.y;
4992               var bry = b2.rightSE.point.y;
4993               if (alx < blx) {
4994                 if (bly < aly && bly < ary)
4995                   return 1;
4996                 if (bly > aly && bly > ary)
4997                   return -1;
4998                 var aCmpBLeft = a2.comparePoint(b2.leftSE.point);
4999                 if (aCmpBLeft < 0)
5000                   return 1;
5001                 if (aCmpBLeft > 0)
5002                   return -1;
5003                 var bCmpARight = b2.comparePoint(a2.rightSE.point);
5004                 if (bCmpARight !== 0)
5005                   return bCmpARight;
5006                 return -1;
5007               }
5008               if (alx > blx) {
5009                 if (aly < bly && aly < bry)
5010                   return -1;
5011                 if (aly > bly && aly > bry)
5012                   return 1;
5013                 var bCmpALeft = b2.comparePoint(a2.leftSE.point);
5014                 if (bCmpALeft !== 0)
5015                   return bCmpALeft;
5016                 var aCmpBRight = a2.comparePoint(b2.rightSE.point);
5017                 if (aCmpBRight < 0)
5018                   return 1;
5019                 if (aCmpBRight > 0)
5020                   return -1;
5021                 return 1;
5022               }
5023               if (aly < bly)
5024                 return -1;
5025               if (aly > bly)
5026                 return 1;
5027               if (arx < brx) {
5028                 var _bCmpARight = b2.comparePoint(a2.rightSE.point);
5029                 if (_bCmpARight !== 0)
5030                   return _bCmpARight;
5031               }
5032               if (arx > brx) {
5033                 var _aCmpBRight = a2.comparePoint(b2.rightSE.point);
5034                 if (_aCmpBRight < 0)
5035                   return 1;
5036                 if (_aCmpBRight > 0)
5037                   return -1;
5038               }
5039               if (arx !== brx) {
5040                 var ay = ary - aly;
5041                 var ax = arx - alx;
5042                 var by = bry - bly;
5043                 var bx = brx - blx;
5044                 if (ay > ax && by < bx)
5045                   return 1;
5046                 if (ay < ax && by > bx)
5047                   return -1;
5048               }
5049               if (arx > brx)
5050                 return 1;
5051               if (arx < brx)
5052                 return -1;
5053               if (ary < bry)
5054                 return -1;
5055               if (ary > bry)
5056                 return 1;
5057               if (a2.id < b2.id)
5058                 return -1;
5059               if (a2.id > b2.id)
5060                 return 1;
5061               return 0;
5062             }
5063             /* Warning: a reference to ringWindings input will be stored,
5064              *  and possibly will be later modified */
5065           }]);
5066           function Segment2(leftSE, rightSE, rings, windings) {
5067             _classCallCheck(this, Segment2);
5068             this.id = ++segmentId;
5069             this.leftSE = leftSE;
5070             leftSE.segment = this;
5071             leftSE.otherSE = rightSE;
5072             this.rightSE = rightSE;
5073             rightSE.segment = this;
5074             rightSE.otherSE = leftSE;
5075             this.rings = rings;
5076             this.windings = windings;
5077           }
5078           _createClass(Segment2, [{
5079             key: "replaceRightSE",
5080             /* When a segment is split, the rightSE is replaced with a new sweep event */
5081             value: function replaceRightSE(newRightSE) {
5082               this.rightSE = newRightSE;
5083               this.rightSE.segment = this;
5084               this.rightSE.otherSE = this.leftSE;
5085               this.leftSE.otherSE = this.rightSE;
5086             }
5087           }, {
5088             key: "bbox",
5089             value: function bbox2() {
5090               var y12 = this.leftSE.point.y;
5091               var y2 = this.rightSE.point.y;
5092               return {
5093                 ll: {
5094                   x: this.leftSE.point.x,
5095                   y: y12 < y2 ? y12 : y2
5096                 },
5097                 ur: {
5098                   x: this.rightSE.point.x,
5099                   y: y12 > y2 ? y12 : y2
5100                 }
5101               };
5102             }
5103             /* A vector from the left point to the right */
5104           }, {
5105             key: "vector",
5106             value: function vector() {
5107               return {
5108                 x: this.rightSE.point.x - this.leftSE.point.x,
5109                 y: this.rightSE.point.y - this.leftSE.point.y
5110               };
5111             }
5112           }, {
5113             key: "isAnEndpoint",
5114             value: function isAnEndpoint(pt2) {
5115               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;
5116             }
5117             /* Compare this segment with a point.
5118              *
5119              * A point P is considered to be colinear to a segment if there
5120              * exists a distance D such that if we travel along the segment
5121              * from one * endpoint towards the other a distance D, we find
5122              * ourselves at point P.
5123              *
5124              * Return value indicates:
5125              *
5126              *   1: point lies above the segment (to the left of vertical)
5127              *   0: point is colinear to segment
5128              *  -1: point lies below the segment (to the right of vertical)
5129              */
5130           }, {
5131             key: "comparePoint",
5132             value: function comparePoint(point2) {
5133               if (this.isAnEndpoint(point2))
5134                 return 0;
5135               var lPt = this.leftSE.point;
5136               var rPt = this.rightSE.point;
5137               var v2 = this.vector();
5138               if (lPt.x === rPt.x) {
5139                 if (point2.x === lPt.x)
5140                   return 0;
5141                 return point2.x < lPt.x ? 1 : -1;
5142               }
5143               var yDist = (point2.y - lPt.y) / v2.y;
5144               var xFromYDist = lPt.x + yDist * v2.x;
5145               if (point2.x === xFromYDist)
5146                 return 0;
5147               var xDist = (point2.x - lPt.x) / v2.x;
5148               var yFromXDist = lPt.y + xDist * v2.y;
5149               if (point2.y === yFromXDist)
5150                 return 0;
5151               return point2.y < yFromXDist ? -1 : 1;
5152             }
5153             /**
5154              * Given another segment, returns the first non-trivial intersection
5155              * between the two segments (in terms of sweep line ordering), if it exists.
5156              *
5157              * A 'non-trivial' intersection is one that will cause one or both of the
5158              * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
5159              *
5160              *   * endpoint of segA with endpoint of segB --> trivial
5161              *   * endpoint of segA with point along segB --> non-trivial
5162              *   * endpoint of segB with point along segA --> non-trivial
5163              *   * point along segA with point along segB --> non-trivial
5164              *
5165              * If no non-trivial intersection exists, return null
5166              * Else, return null.
5167              */
5168           }, {
5169             key: "getIntersection",
5170             value: function getIntersection(other) {
5171               var tBbox = this.bbox();
5172               var oBbox = other.bbox();
5173               var bboxOverlap = getBboxOverlap(tBbox, oBbox);
5174               if (bboxOverlap === null)
5175                 return null;
5176               var tlp = this.leftSE.point;
5177               var trp = this.rightSE.point;
5178               var olp = other.leftSE.point;
5179               var orp = other.rightSE.point;
5180               var touchesOtherLSE = isInBbox(tBbox, olp) && this.comparePoint(olp) === 0;
5181               var touchesThisLSE = isInBbox(oBbox, tlp) && other.comparePoint(tlp) === 0;
5182               var touchesOtherRSE = isInBbox(tBbox, orp) && this.comparePoint(orp) === 0;
5183               var touchesThisRSE = isInBbox(oBbox, trp) && other.comparePoint(trp) === 0;
5184               if (touchesThisLSE && touchesOtherLSE) {
5185                 if (touchesThisRSE && !touchesOtherRSE)
5186                   return trp;
5187                 if (!touchesThisRSE && touchesOtherRSE)
5188                   return orp;
5189                 return null;
5190               }
5191               if (touchesThisLSE) {
5192                 if (touchesOtherRSE) {
5193                   if (tlp.x === orp.x && tlp.y === orp.y)
5194                     return null;
5195                 }
5196                 return tlp;
5197               }
5198               if (touchesOtherLSE) {
5199                 if (touchesThisRSE) {
5200                   if (trp.x === olp.x && trp.y === olp.y)
5201                     return null;
5202                 }
5203                 return olp;
5204               }
5205               if (touchesThisRSE && touchesOtherRSE)
5206                 return null;
5207               if (touchesThisRSE)
5208                 return trp;
5209               if (touchesOtherRSE)
5210                 return orp;
5211               var pt2 = intersection(tlp, this.vector(), olp, other.vector());
5212               if (pt2 === null)
5213                 return null;
5214               if (!isInBbox(bboxOverlap, pt2))
5215                 return null;
5216               return rounder.round(pt2.x, pt2.y);
5217             }
5218             /**
5219              * Split the given segment into multiple segments on the given points.
5220              *  * Each existing segment will retain its leftSE and a new rightSE will be
5221              *    generated for it.
5222              *  * A new segment will be generated which will adopt the original segment's
5223              *    rightSE, and a new leftSE will be generated for it.
5224              *  * If there are more than two points given to split on, new segments
5225              *    in the middle will be generated with new leftSE and rightSE's.
5226              *  * An array of the newly generated SweepEvents will be returned.
5227              *
5228              * Warning: input array of points is modified
5229              */
5230           }, {
5231             key: "split",
5232             value: function split2(point2) {
5233               var newEvents = [];
5234               var alreadyLinked = point2.events !== void 0;
5235               var newLeftSE = new SweepEvent(point2, true);
5236               var newRightSE = new SweepEvent(point2, false);
5237               var oldRightSE = this.rightSE;
5238               this.replaceRightSE(newRightSE);
5239               newEvents.push(newRightSE);
5240               newEvents.push(newLeftSE);
5241               var newSeg = new Segment2(newLeftSE, oldRightSE, this.rings.slice(), this.windings.slice());
5242               if (SweepEvent.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
5243                 newSeg.swapEvents();
5244               }
5245               if (SweepEvent.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
5246                 this.swapEvents();
5247               }
5248               if (alreadyLinked) {
5249                 newLeftSE.checkForConsuming();
5250                 newRightSE.checkForConsuming();
5251               }
5252               return newEvents;
5253             }
5254             /* Swap which event is left and right */
5255           }, {
5256             key: "swapEvents",
5257             value: function swapEvents() {
5258               var tmpEvt = this.rightSE;
5259               this.rightSE = this.leftSE;
5260               this.leftSE = tmpEvt;
5261               this.leftSE.isLeft = true;
5262               this.rightSE.isLeft = false;
5263               for (var i3 = 0, iMax = this.windings.length; i3 < iMax; i3++) {
5264                 this.windings[i3] *= -1;
5265               }
5266             }
5267             /* Consume another segment. We take their rings under our wing
5268              * and mark them as consumed. Use for perfectly overlapping segments */
5269           }, {
5270             key: "consume",
5271             value: function consume(other) {
5272               var consumer = this;
5273               var consumee = other;
5274               while (consumer.consumedBy) {
5275                 consumer = consumer.consumedBy;
5276               }
5277               while (consumee.consumedBy) {
5278                 consumee = consumee.consumedBy;
5279               }
5280               var cmp2 = Segment2.compare(consumer, consumee);
5281               if (cmp2 === 0)
5282                 return;
5283               if (cmp2 > 0) {
5284                 var tmp = consumer;
5285                 consumer = consumee;
5286                 consumee = tmp;
5287               }
5288               if (consumer.prev === consumee) {
5289                 var _tmp = consumer;
5290                 consumer = consumee;
5291                 consumee = _tmp;
5292               }
5293               for (var i3 = 0, iMax = consumee.rings.length; i3 < iMax; i3++) {
5294                 var ring = consumee.rings[i3];
5295                 var winding = consumee.windings[i3];
5296                 var index2 = consumer.rings.indexOf(ring);
5297                 if (index2 === -1) {
5298                   consumer.rings.push(ring);
5299                   consumer.windings.push(winding);
5300                 } else
5301                   consumer.windings[index2] += winding;
5302               }
5303               consumee.rings = null;
5304               consumee.windings = null;
5305               consumee.consumedBy = consumer;
5306               consumee.leftSE.consumedBy = consumer.leftSE;
5307               consumee.rightSE.consumedBy = consumer.rightSE;
5308             }
5309             /* The first segment previous segment chain that is in the result */
5310           }, {
5311             key: "prevInResult",
5312             value: function prevInResult() {
5313               if (this._prevInResult !== void 0)
5314                 return this._prevInResult;
5315               if (!this.prev)
5316                 this._prevInResult = null;
5317               else if (this.prev.isInResult())
5318                 this._prevInResult = this.prev;
5319               else
5320                 this._prevInResult = this.prev.prevInResult();
5321               return this._prevInResult;
5322             }
5323           }, {
5324             key: "beforeState",
5325             value: function beforeState() {
5326               if (this._beforeState !== void 0)
5327                 return this._beforeState;
5328               if (!this.prev)
5329                 this._beforeState = {
5330                   rings: [],
5331                   windings: [],
5332                   multiPolys: []
5333                 };
5334               else {
5335                 var seg = this.prev.consumedBy || this.prev;
5336                 this._beforeState = seg.afterState();
5337               }
5338               return this._beforeState;
5339             }
5340           }, {
5341             key: "afterState",
5342             value: function afterState() {
5343               if (this._afterState !== void 0)
5344                 return this._afterState;
5345               var beforeState = this.beforeState();
5346               this._afterState = {
5347                 rings: beforeState.rings.slice(0),
5348                 windings: beforeState.windings.slice(0),
5349                 multiPolys: []
5350               };
5351               var ringsAfter = this._afterState.rings;
5352               var windingsAfter = this._afterState.windings;
5353               var mpsAfter = this._afterState.multiPolys;
5354               for (var i3 = 0, iMax = this.rings.length; i3 < iMax; i3++) {
5355                 var ring = this.rings[i3];
5356                 var winding = this.windings[i3];
5357                 var index2 = ringsAfter.indexOf(ring);
5358                 if (index2 === -1) {
5359                   ringsAfter.push(ring);
5360                   windingsAfter.push(winding);
5361                 } else
5362                   windingsAfter[index2] += winding;
5363               }
5364               var polysAfter = [];
5365               var polysExclude = [];
5366               for (var _i = 0, _iMax = ringsAfter.length; _i < _iMax; _i++) {
5367                 if (windingsAfter[_i] === 0)
5368                   continue;
5369                 var _ring = ringsAfter[_i];
5370                 var poly = _ring.poly;
5371                 if (polysExclude.indexOf(poly) !== -1)
5372                   continue;
5373                 if (_ring.isExterior)
5374                   polysAfter.push(poly);
5375                 else {
5376                   if (polysExclude.indexOf(poly) === -1)
5377                     polysExclude.push(poly);
5378                   var _index = polysAfter.indexOf(_ring.poly);
5379                   if (_index !== -1)
5380                     polysAfter.splice(_index, 1);
5381                 }
5382               }
5383               for (var _i2 = 0, _iMax2 = polysAfter.length; _i2 < _iMax2; _i2++) {
5384                 var mp = polysAfter[_i2].multiPoly;
5385                 if (mpsAfter.indexOf(mp) === -1)
5386                   mpsAfter.push(mp);
5387               }
5388               return this._afterState;
5389             }
5390             /* Is this segment part of the final result? */
5391           }, {
5392             key: "isInResult",
5393             value: function isInResult() {
5394               if (this.consumedBy)
5395                 return false;
5396               if (this._isInResult !== void 0)
5397                 return this._isInResult;
5398               var mpsBefore = this.beforeState().multiPolys;
5399               var mpsAfter = this.afterState().multiPolys;
5400               switch (operation.type) {
5401                 case "union": {
5402                   var noBefores = mpsBefore.length === 0;
5403                   var noAfters = mpsAfter.length === 0;
5404                   this._isInResult = noBefores !== noAfters;
5405                   break;
5406                 }
5407                 case "intersection": {
5408                   var least;
5409                   var most;
5410                   if (mpsBefore.length < mpsAfter.length) {
5411                     least = mpsBefore.length;
5412                     most = mpsAfter.length;
5413                   } else {
5414                     least = mpsAfter.length;
5415                     most = mpsBefore.length;
5416                   }
5417                   this._isInResult = most === operation.numMultiPolys && least < most;
5418                   break;
5419                 }
5420                 case "xor": {
5421                   var diff = Math.abs(mpsBefore.length - mpsAfter.length);
5422                   this._isInResult = diff % 2 === 1;
5423                   break;
5424                 }
5425                 case "difference": {
5426                   var isJustSubject = function isJustSubject2(mps) {
5427                     return mps.length === 1 && mps[0].isSubject;
5428                   };
5429                   this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
5430                   break;
5431                 }
5432                 default:
5433                   throw new Error("Unrecognized operation type found ".concat(operation.type));
5434               }
5435               return this._isInResult;
5436             }
5437           }], [{
5438             key: "fromRing",
5439             value: function fromRing(pt1, pt2, ring) {
5440               var leftPt, rightPt, winding;
5441               var cmpPts = SweepEvent.comparePoints(pt1, pt2);
5442               if (cmpPts < 0) {
5443                 leftPt = pt1;
5444                 rightPt = pt2;
5445                 winding = 1;
5446               } else if (cmpPts > 0) {
5447                 leftPt = pt2;
5448                 rightPt = pt1;
5449                 winding = -1;
5450               } else
5451                 throw new Error("Tried to create degenerate segment at [".concat(pt1.x, ", ").concat(pt1.y, "]"));
5452               var leftSE = new SweepEvent(leftPt, true);
5453               var rightSE = new SweepEvent(rightPt, false);
5454               return new Segment2(leftSE, rightSE, [ring], [winding]);
5455             }
5456           }]);
5457           return Segment2;
5458         }();
5459         var RingIn = /* @__PURE__ */ function() {
5460           function RingIn2(geomRing, poly, isExterior) {
5461             _classCallCheck(this, RingIn2);
5462             if (!Array.isArray(geomRing) || geomRing.length === 0) {
5463               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5464             }
5465             this.poly = poly;
5466             this.isExterior = isExterior;
5467             this.segments = [];
5468             if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
5469               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5470             }
5471             var firstPoint = rounder.round(geomRing[0][0], geomRing[0][1]);
5472             this.bbox = {
5473               ll: {
5474                 x: firstPoint.x,
5475                 y: firstPoint.y
5476               },
5477               ur: {
5478                 x: firstPoint.x,
5479                 y: firstPoint.y
5480               }
5481             };
5482             var prevPoint = firstPoint;
5483             for (var i3 = 1, iMax = geomRing.length; i3 < iMax; i3++) {
5484               if (typeof geomRing[i3][0] !== "number" || typeof geomRing[i3][1] !== "number") {
5485                 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5486               }
5487               var point2 = rounder.round(geomRing[i3][0], geomRing[i3][1]);
5488               if (point2.x === prevPoint.x && point2.y === prevPoint.y)
5489                 continue;
5490               this.segments.push(Segment.fromRing(prevPoint, point2, this));
5491               if (point2.x < this.bbox.ll.x)
5492                 this.bbox.ll.x = point2.x;
5493               if (point2.y < this.bbox.ll.y)
5494                 this.bbox.ll.y = point2.y;
5495               if (point2.x > this.bbox.ur.x)
5496                 this.bbox.ur.x = point2.x;
5497               if (point2.y > this.bbox.ur.y)
5498                 this.bbox.ur.y = point2.y;
5499               prevPoint = point2;
5500             }
5501             if (firstPoint.x !== prevPoint.x || firstPoint.y !== prevPoint.y) {
5502               this.segments.push(Segment.fromRing(prevPoint, firstPoint, this));
5503             }
5504           }
5505           _createClass(RingIn2, [{
5506             key: "getSweepEvents",
5507             value: function getSweepEvents() {
5508               var sweepEvents = [];
5509               for (var i3 = 0, iMax = this.segments.length; i3 < iMax; i3++) {
5510                 var segment = this.segments[i3];
5511                 sweepEvents.push(segment.leftSE);
5512                 sweepEvents.push(segment.rightSE);
5513               }
5514               return sweepEvents;
5515             }
5516           }]);
5517           return RingIn2;
5518         }();
5519         var PolyIn = /* @__PURE__ */ function() {
5520           function PolyIn2(geomPoly, multiPoly) {
5521             _classCallCheck(this, PolyIn2);
5522             if (!Array.isArray(geomPoly)) {
5523               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5524             }
5525             this.exteriorRing = new RingIn(geomPoly[0], this, true);
5526             this.bbox = {
5527               ll: {
5528                 x: this.exteriorRing.bbox.ll.x,
5529                 y: this.exteriorRing.bbox.ll.y
5530               },
5531               ur: {
5532                 x: this.exteriorRing.bbox.ur.x,
5533                 y: this.exteriorRing.bbox.ur.y
5534               }
5535             };
5536             this.interiorRings = [];
5537             for (var i3 = 1, iMax = geomPoly.length; i3 < iMax; i3++) {
5538               var ring = new RingIn(geomPoly[i3], this, false);
5539               if (ring.bbox.ll.x < this.bbox.ll.x)
5540                 this.bbox.ll.x = ring.bbox.ll.x;
5541               if (ring.bbox.ll.y < this.bbox.ll.y)
5542                 this.bbox.ll.y = ring.bbox.ll.y;
5543               if (ring.bbox.ur.x > this.bbox.ur.x)
5544                 this.bbox.ur.x = ring.bbox.ur.x;
5545               if (ring.bbox.ur.y > this.bbox.ur.y)
5546                 this.bbox.ur.y = ring.bbox.ur.y;
5547               this.interiorRings.push(ring);
5548             }
5549             this.multiPoly = multiPoly;
5550           }
5551           _createClass(PolyIn2, [{
5552             key: "getSweepEvents",
5553             value: function getSweepEvents() {
5554               var sweepEvents = this.exteriorRing.getSweepEvents();
5555               for (var i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
5556                 var ringSweepEvents = this.interiorRings[i3].getSweepEvents();
5557                 for (var j3 = 0, jMax = ringSweepEvents.length; j3 < jMax; j3++) {
5558                   sweepEvents.push(ringSweepEvents[j3]);
5559                 }
5560               }
5561               return sweepEvents;
5562             }
5563           }]);
5564           return PolyIn2;
5565         }();
5566         var MultiPolyIn = /* @__PURE__ */ function() {
5567           function MultiPolyIn2(geom, isSubject) {
5568             _classCallCheck(this, MultiPolyIn2);
5569             if (!Array.isArray(geom)) {
5570               throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
5571             }
5572             try {
5573               if (typeof geom[0][0][0] === "number")
5574                 geom = [geom];
5575             } catch (ex) {
5576             }
5577             this.polys = [];
5578             this.bbox = {
5579               ll: {
5580                 x: Number.POSITIVE_INFINITY,
5581                 y: Number.POSITIVE_INFINITY
5582               },
5583               ur: {
5584                 x: Number.NEGATIVE_INFINITY,
5585                 y: Number.NEGATIVE_INFINITY
5586               }
5587             };
5588             for (var i3 = 0, iMax = geom.length; i3 < iMax; i3++) {
5589               var poly = new PolyIn(geom[i3], this);
5590               if (poly.bbox.ll.x < this.bbox.ll.x)
5591                 this.bbox.ll.x = poly.bbox.ll.x;
5592               if (poly.bbox.ll.y < this.bbox.ll.y)
5593                 this.bbox.ll.y = poly.bbox.ll.y;
5594               if (poly.bbox.ur.x > this.bbox.ur.x)
5595                 this.bbox.ur.x = poly.bbox.ur.x;
5596               if (poly.bbox.ur.y > this.bbox.ur.y)
5597                 this.bbox.ur.y = poly.bbox.ur.y;
5598               this.polys.push(poly);
5599             }
5600             this.isSubject = isSubject;
5601           }
5602           _createClass(MultiPolyIn2, [{
5603             key: "getSweepEvents",
5604             value: function getSweepEvents() {
5605               var sweepEvents = [];
5606               for (var i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
5607                 var polySweepEvents = this.polys[i3].getSweepEvents();
5608                 for (var j3 = 0, jMax = polySweepEvents.length; j3 < jMax; j3++) {
5609                   sweepEvents.push(polySweepEvents[j3]);
5610                 }
5611               }
5612               return sweepEvents;
5613             }
5614           }]);
5615           return MultiPolyIn2;
5616         }();
5617         var RingOut = /* @__PURE__ */ function() {
5618           _createClass(RingOut2, null, [{
5619             key: "factory",
5620             /* Given the segments from the sweep line pass, compute & return a series
5621              * of closed rings from all the segments marked to be part of the result */
5622             value: function factory(allSegments) {
5623               var ringsOut = [];
5624               for (var i3 = 0, iMax = allSegments.length; i3 < iMax; i3++) {
5625                 var segment = allSegments[i3];
5626                 if (!segment.isInResult() || segment.ringOut)
5627                   continue;
5628                 var prevEvent = null;
5629                 var event = segment.leftSE;
5630                 var nextEvent = segment.rightSE;
5631                 var events = [event];
5632                 var startingPoint = event.point;
5633                 var intersectionLEs = [];
5634                 while (true) {
5635                   prevEvent = event;
5636                   event = nextEvent;
5637                   events.push(event);
5638                   if (event.point === startingPoint)
5639                     break;
5640                   while (true) {
5641                     var availableLEs = event.getAvailableLinkedEvents();
5642                     if (availableLEs.length === 0) {
5643                       var firstPt = events[0].point;
5644                       var lastPt = events[events.length - 1].point;
5645                       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, "]."));
5646                     }
5647                     if (availableLEs.length === 1) {
5648                       nextEvent = availableLEs[0].otherSE;
5649                       break;
5650                     }
5651                     var indexLE = null;
5652                     for (var j3 = 0, jMax = intersectionLEs.length; j3 < jMax; j3++) {
5653                       if (intersectionLEs[j3].point === event.point) {
5654                         indexLE = j3;
5655                         break;
5656                       }
5657                     }
5658                     if (indexLE !== null) {
5659                       var intersectionLE = intersectionLEs.splice(indexLE)[0];
5660                       var ringEvents = events.splice(intersectionLE.index);
5661                       ringEvents.unshift(ringEvents[0].otherSE);
5662                       ringsOut.push(new RingOut2(ringEvents.reverse()));
5663                       continue;
5664                     }
5665                     intersectionLEs.push({
5666                       index: events.length,
5667                       point: event.point
5668                     });
5669                     var comparator = event.getLeftmostComparator(prevEvent);
5670                     nextEvent = availableLEs.sort(comparator)[0].otherSE;
5671                     break;
5672                   }
5673                 }
5674                 ringsOut.push(new RingOut2(events));
5675               }
5676               return ringsOut;
5677             }
5678           }]);
5679           function RingOut2(events) {
5680             _classCallCheck(this, RingOut2);
5681             this.events = events;
5682             for (var i3 = 0, iMax = events.length; i3 < iMax; i3++) {
5683               events[i3].segment.ringOut = this;
5684             }
5685             this.poly = null;
5686           }
5687           _createClass(RingOut2, [{
5688             key: "getGeom",
5689             value: function getGeom2() {
5690               var prevPt = this.events[0].point;
5691               var points = [prevPt];
5692               for (var i3 = 1, iMax = this.events.length - 1; i3 < iMax; i3++) {
5693                 var _pt = this.events[i3].point;
5694                 var _nextPt = this.events[i3 + 1].point;
5695                 if (compareVectorAngles(_pt, prevPt, _nextPt) === 0)
5696                   continue;
5697                 points.push(_pt);
5698                 prevPt = _pt;
5699               }
5700               if (points.length === 1)
5701                 return null;
5702               var pt2 = points[0];
5703               var nextPt = points[1];
5704               if (compareVectorAngles(pt2, prevPt, nextPt) === 0)
5705                 points.shift();
5706               points.push(points[0]);
5707               var step = this.isExteriorRing() ? 1 : -1;
5708               var iStart = this.isExteriorRing() ? 0 : points.length - 1;
5709               var iEnd = this.isExteriorRing() ? points.length : -1;
5710               var orderedPoints = [];
5711               for (var _i = iStart; _i != iEnd; _i += step) {
5712                 orderedPoints.push([points[_i].x, points[_i].y]);
5713               }
5714               return orderedPoints;
5715             }
5716           }, {
5717             key: "isExteriorRing",
5718             value: function isExteriorRing() {
5719               if (this._isExteriorRing === void 0) {
5720                 var enclosing = this.enclosingRing();
5721                 this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
5722               }
5723               return this._isExteriorRing;
5724             }
5725           }, {
5726             key: "enclosingRing",
5727             value: function enclosingRing() {
5728               if (this._enclosingRing === void 0) {
5729                 this._enclosingRing = this._calcEnclosingRing();
5730               }
5731               return this._enclosingRing;
5732             }
5733             /* Returns the ring that encloses this one, if any */
5734           }, {
5735             key: "_calcEnclosingRing",
5736             value: function _calcEnclosingRing() {
5737               var leftMostEvt = this.events[0];
5738               for (var i3 = 1, iMax = this.events.length; i3 < iMax; i3++) {
5739                 var evt = this.events[i3];
5740                 if (SweepEvent.compare(leftMostEvt, evt) > 0)
5741                   leftMostEvt = evt;
5742               }
5743               var prevSeg = leftMostEvt.segment.prevInResult();
5744               var prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
5745               while (true) {
5746                 if (!prevSeg)
5747                   return null;
5748                 if (!prevPrevSeg)
5749                   return prevSeg.ringOut;
5750                 if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
5751                   if (prevPrevSeg.ringOut.enclosingRing() !== prevSeg.ringOut) {
5752                     return prevSeg.ringOut;
5753                   } else
5754                     return prevSeg.ringOut.enclosingRing();
5755                 }
5756                 prevSeg = prevPrevSeg.prevInResult();
5757                 prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
5758               }
5759             }
5760           }]);
5761           return RingOut2;
5762         }();
5763         var PolyOut = /* @__PURE__ */ function() {
5764           function PolyOut2(exteriorRing) {
5765             _classCallCheck(this, PolyOut2);
5766             this.exteriorRing = exteriorRing;
5767             exteriorRing.poly = this;
5768             this.interiorRings = [];
5769           }
5770           _createClass(PolyOut2, [{
5771             key: "addInterior",
5772             value: function addInterior(ring) {
5773               this.interiorRings.push(ring);
5774               ring.poly = this;
5775             }
5776           }, {
5777             key: "getGeom",
5778             value: function getGeom2() {
5779               var geom = [this.exteriorRing.getGeom()];
5780               if (geom[0] === null)
5781                 return null;
5782               for (var i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
5783                 var ringGeom = this.interiorRings[i3].getGeom();
5784                 if (ringGeom === null)
5785                   continue;
5786                 geom.push(ringGeom);
5787               }
5788               return geom;
5789             }
5790           }]);
5791           return PolyOut2;
5792         }();
5793         var MultiPolyOut = /* @__PURE__ */ function() {
5794           function MultiPolyOut2(rings) {
5795             _classCallCheck(this, MultiPolyOut2);
5796             this.rings = rings;
5797             this.polys = this._composePolys(rings);
5798           }
5799           _createClass(MultiPolyOut2, [{
5800             key: "getGeom",
5801             value: function getGeom2() {
5802               var geom = [];
5803               for (var i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
5804                 var polyGeom = this.polys[i3].getGeom();
5805                 if (polyGeom === null)
5806                   continue;
5807                 geom.push(polyGeom);
5808               }
5809               return geom;
5810             }
5811           }, {
5812             key: "_composePolys",
5813             value: function _composePolys(rings) {
5814               var polys = [];
5815               for (var i3 = 0, iMax = rings.length; i3 < iMax; i3++) {
5816                 var ring = rings[i3];
5817                 if (ring.poly)
5818                   continue;
5819                 if (ring.isExteriorRing())
5820                   polys.push(new PolyOut(ring));
5821                 else {
5822                   var enclosingRing = ring.enclosingRing();
5823                   if (!enclosingRing.poly)
5824                     polys.push(new PolyOut(enclosingRing));
5825                   enclosingRing.poly.addInterior(ring);
5826                 }
5827               }
5828               return polys;
5829             }
5830           }]);
5831           return MultiPolyOut2;
5832         }();
5833         var SweepLine = /* @__PURE__ */ function() {
5834           function SweepLine2(queue) {
5835             var comparator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Segment.compare;
5836             _classCallCheck(this, SweepLine2);
5837             this.queue = queue;
5838             this.tree = new Tree(comparator);
5839             this.segments = [];
5840           }
5841           _createClass(SweepLine2, [{
5842             key: "process",
5843             value: function process2(event) {
5844               var segment = event.segment;
5845               var newEvents = [];
5846               if (event.consumedBy) {
5847                 if (event.isLeft)
5848                   this.queue.remove(event.otherSE);
5849                 else
5850                   this.tree.remove(segment);
5851                 return newEvents;
5852               }
5853               var node = event.isLeft ? this.tree.insert(segment) : this.tree.find(segment);
5854               if (!node)
5855                 throw new Error("Unable to find segment #".concat(segment.id, " ") + "[".concat(segment.leftSE.point.x, ", ").concat(segment.leftSE.point.y, "] -> ") + "[".concat(segment.rightSE.point.x, ", ").concat(segment.rightSE.point.y, "] ") + "in SweepLine tree. Please submit a bug report.");
5856               var prevNode = node;
5857               var nextNode = node;
5858               var prevSeg = void 0;
5859               var nextSeg = void 0;
5860               while (prevSeg === void 0) {
5861                 prevNode = this.tree.prev(prevNode);
5862                 if (prevNode === null)
5863                   prevSeg = null;
5864                 else if (prevNode.key.consumedBy === void 0)
5865                   prevSeg = prevNode.key;
5866               }
5867               while (nextSeg === void 0) {
5868                 nextNode = this.tree.next(nextNode);
5869                 if (nextNode === null)
5870                   nextSeg = null;
5871                 else if (nextNode.key.consumedBy === void 0)
5872                   nextSeg = nextNode.key;
5873               }
5874               if (event.isLeft) {
5875                 var prevMySplitter = null;
5876                 if (prevSeg) {
5877                   var prevInter = prevSeg.getIntersection(segment);
5878                   if (prevInter !== null) {
5879                     if (!segment.isAnEndpoint(prevInter))
5880                       prevMySplitter = prevInter;
5881                     if (!prevSeg.isAnEndpoint(prevInter)) {
5882                       var newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
5883                       for (var i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
5884                         newEvents.push(newEventsFromSplit[i3]);
5885                       }
5886                     }
5887                   }
5888                 }
5889                 var nextMySplitter = null;
5890                 if (nextSeg) {
5891                   var nextInter = nextSeg.getIntersection(segment);
5892                   if (nextInter !== null) {
5893                     if (!segment.isAnEndpoint(nextInter))
5894                       nextMySplitter = nextInter;
5895                     if (!nextSeg.isAnEndpoint(nextInter)) {
5896                       var _newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
5897                       for (var _i = 0, _iMax = _newEventsFromSplit.length; _i < _iMax; _i++) {
5898                         newEvents.push(_newEventsFromSplit[_i]);
5899                       }
5900                     }
5901                   }
5902                 }
5903                 if (prevMySplitter !== null || nextMySplitter !== null) {
5904                   var mySplitter = null;
5905                   if (prevMySplitter === null)
5906                     mySplitter = nextMySplitter;
5907                   else if (nextMySplitter === null)
5908                     mySplitter = prevMySplitter;
5909                   else {
5910                     var cmpSplitters = SweepEvent.comparePoints(prevMySplitter, nextMySplitter);
5911                     mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
5912                   }
5913                   this.queue.remove(segment.rightSE);
5914                   newEvents.push(segment.rightSE);
5915                   var _newEventsFromSplit2 = segment.split(mySplitter);
5916                   for (var _i2 = 0, _iMax2 = _newEventsFromSplit2.length; _i2 < _iMax2; _i2++) {
5917                     newEvents.push(_newEventsFromSplit2[_i2]);
5918                   }
5919                 }
5920                 if (newEvents.length > 0) {
5921                   this.tree.remove(segment);
5922                   newEvents.push(event);
5923                 } else {
5924                   this.segments.push(segment);
5925                   segment.prev = prevSeg;
5926                 }
5927               } else {
5928                 if (prevSeg && nextSeg) {
5929                   var inter = prevSeg.getIntersection(nextSeg);
5930                   if (inter !== null) {
5931                     if (!prevSeg.isAnEndpoint(inter)) {
5932                       var _newEventsFromSplit3 = this._splitSafely(prevSeg, inter);
5933                       for (var _i3 = 0, _iMax3 = _newEventsFromSplit3.length; _i3 < _iMax3; _i3++) {
5934                         newEvents.push(_newEventsFromSplit3[_i3]);
5935                       }
5936                     }
5937                     if (!nextSeg.isAnEndpoint(inter)) {
5938                       var _newEventsFromSplit4 = this._splitSafely(nextSeg, inter);
5939                       for (var _i4 = 0, _iMax4 = _newEventsFromSplit4.length; _i4 < _iMax4; _i4++) {
5940                         newEvents.push(_newEventsFromSplit4[_i4]);
5941                       }
5942                     }
5943                   }
5944                 }
5945                 this.tree.remove(segment);
5946               }
5947               return newEvents;
5948             }
5949             /* Safely split a segment that is currently in the datastructures
5950              * IE - a segment other than the one that is currently being processed. */
5951           }, {
5952             key: "_splitSafely",
5953             value: function _splitSafely(seg, pt2) {
5954               this.tree.remove(seg);
5955               var rightSE = seg.rightSE;
5956               this.queue.remove(rightSE);
5957               var newEvents = seg.split(pt2);
5958               newEvents.push(rightSE);
5959               if (seg.consumedBy === void 0)
5960                 this.tree.insert(seg);
5961               return newEvents;
5962             }
5963           }]);
5964           return SweepLine2;
5965         }();
5966         var POLYGON_CLIPPING_MAX_QUEUE_SIZE = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6;
5967         var POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1e6;
5968         var Operation = /* @__PURE__ */ function() {
5969           function Operation2() {
5970             _classCallCheck(this, Operation2);
5971           }
5972           _createClass(Operation2, [{
5973             key: "run",
5974             value: function run(type2, geom, moreGeoms) {
5975               operation.type = type2;
5976               rounder.reset();
5977               var multipolys = [new MultiPolyIn(geom, true)];
5978               for (var i3 = 0, iMax = moreGeoms.length; i3 < iMax; i3++) {
5979                 multipolys.push(new MultiPolyIn(moreGeoms[i3], false));
5980               }
5981               operation.numMultiPolys = multipolys.length;
5982               if (operation.type === "difference") {
5983                 var subject = multipolys[0];
5984                 var _i = 1;
5985                 while (_i < multipolys.length) {
5986                   if (getBboxOverlap(multipolys[_i].bbox, subject.bbox) !== null)
5987                     _i++;
5988                   else
5989                     multipolys.splice(_i, 1);
5990                 }
5991               }
5992               if (operation.type === "intersection") {
5993                 for (var _i2 = 0, _iMax = multipolys.length; _i2 < _iMax; _i2++) {
5994                   var mpA = multipolys[_i2];
5995                   for (var j3 = _i2 + 1, jMax = multipolys.length; j3 < jMax; j3++) {
5996                     if (getBboxOverlap(mpA.bbox, multipolys[j3].bbox) === null)
5997                       return [];
5998                   }
5999                 }
6000               }
6001               var queue = new Tree(SweepEvent.compare);
6002               for (var _i3 = 0, _iMax2 = multipolys.length; _i3 < _iMax2; _i3++) {
6003                 var sweepEvents = multipolys[_i3].getSweepEvents();
6004                 for (var _j = 0, _jMax = sweepEvents.length; _j < _jMax; _j++) {
6005                   queue.insert(sweepEvents[_j]);
6006                   if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
6007                     throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");
6008                   }
6009                 }
6010               }
6011               var sweepLine = new SweepLine(queue);
6012               var prevQueueSize = queue.size;
6013               var node = queue.pop();
6014               while (node) {
6015                 var evt = node.key;
6016                 if (queue.size === prevQueueSize) {
6017                   var seg = evt.segment;
6018                   throw new Error("Unable to pop() ".concat(evt.isLeft ? "left" : "right", " SweepEvent ") + "[".concat(evt.point.x, ", ").concat(evt.point.y, "] from segment #").concat(seg.id, " ") + "[".concat(seg.leftSE.point.x, ", ").concat(seg.leftSE.point.y, "] -> ") + "[".concat(seg.rightSE.point.x, ", ").concat(seg.rightSE.point.y, "] from queue. ") + "Please file a bug report.");
6019                 }
6020                 if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
6021                   throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");
6022                 }
6023                 if (sweepLine.segments.length > POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS) {
6024                   throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");
6025                 }
6026                 var newEvents = sweepLine.process(evt);
6027                 for (var _i4 = 0, _iMax3 = newEvents.length; _i4 < _iMax3; _i4++) {
6028                   var _evt = newEvents[_i4];
6029                   if (_evt.consumedBy === void 0)
6030                     queue.insert(_evt);
6031                 }
6032                 prevQueueSize = queue.size;
6033                 node = queue.pop();
6034               }
6035               rounder.reset();
6036               var ringsOut = RingOut.factory(sweepLine.segments);
6037               var result = new MultiPolyOut(ringsOut);
6038               return result.getGeom();
6039             }
6040           }]);
6041           return Operation2;
6042         }();
6043         var operation = new Operation();
6044         var union = function union2(geom) {
6045           for (var _len = arguments.length, moreGeoms = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
6046             moreGeoms[_key - 1] = arguments[_key];
6047           }
6048           return operation.run("union", geom, moreGeoms);
6049         };
6050         var intersection$1 = function intersection2(geom) {
6051           for (var _len2 = arguments.length, moreGeoms = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
6052             moreGeoms[_key2 - 1] = arguments[_key2];
6053           }
6054           return operation.run("intersection", geom, moreGeoms);
6055         };
6056         var xor = function xor2(geom) {
6057           for (var _len3 = arguments.length, moreGeoms = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
6058             moreGeoms[_key3 - 1] = arguments[_key3];
6059           }
6060           return operation.run("xor", geom, moreGeoms);
6061         };
6062         var difference = function difference2(subjectGeom) {
6063           for (var _len4 = arguments.length, clippingGeoms = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
6064             clippingGeoms[_key4 - 1] = arguments[_key4];
6065           }
6066           return operation.run("difference", subjectGeom, clippingGeoms);
6067         };
6068         var index = {
6069           union,
6070           intersection: intersection$1,
6071           xor,
6072           difference
6073         };
6074         return index;
6075       });
6076     }
6077   });
6078
6079   // node_modules/geojson-precision/index.js
6080   var require_geojson_precision = __commonJS({
6081     "node_modules/geojson-precision/index.js"(exports2, module2) {
6082       (function() {
6083         function parse(t2, coordinatePrecision, extrasPrecision) {
6084           function point2(p2) {
6085             return p2.map(function(e3, index) {
6086               if (index < 2) {
6087                 return 1 * e3.toFixed(coordinatePrecision);
6088               } else {
6089                 return 1 * e3.toFixed(extrasPrecision);
6090               }
6091             });
6092           }
6093           function multi(l2) {
6094             return l2.map(point2);
6095           }
6096           function poly(p2) {
6097             return p2.map(multi);
6098           }
6099           function multiPoly(m2) {
6100             return m2.map(poly);
6101           }
6102           function geometry(obj) {
6103             if (!obj) {
6104               return {};
6105             }
6106             switch (obj.type) {
6107               case "Point":
6108                 obj.coordinates = point2(obj.coordinates);
6109                 return obj;
6110               case "LineString":
6111               case "MultiPoint":
6112                 obj.coordinates = multi(obj.coordinates);
6113                 return obj;
6114               case "Polygon":
6115               case "MultiLineString":
6116                 obj.coordinates = poly(obj.coordinates);
6117                 return obj;
6118               case "MultiPolygon":
6119                 obj.coordinates = multiPoly(obj.coordinates);
6120                 return obj;
6121               case "GeometryCollection":
6122                 obj.geometries = obj.geometries.map(geometry);
6123                 return obj;
6124               default:
6125                 return {};
6126             }
6127           }
6128           function feature3(obj) {
6129             obj.geometry = geometry(obj.geometry);
6130             return obj;
6131           }
6132           function featureCollection(f3) {
6133             f3.features = f3.features.map(feature3);
6134             return f3;
6135           }
6136           function geometryCollection(g3) {
6137             g3.geometries = g3.geometries.map(geometry);
6138             return g3;
6139           }
6140           if (!t2) {
6141             return t2;
6142           }
6143           switch (t2.type) {
6144             case "Feature":
6145               return feature3(t2);
6146             case "GeometryCollection":
6147               return geometryCollection(t2);
6148             case "FeatureCollection":
6149               return featureCollection(t2);
6150             case "Point":
6151             case "LineString":
6152             case "Polygon":
6153             case "MultiPoint":
6154             case "MultiPolygon":
6155             case "MultiLineString":
6156               return geometry(t2);
6157             default:
6158               return t2;
6159           }
6160         }
6161         module2.exports = parse;
6162         module2.exports.parse = parse;
6163       })();
6164     }
6165   });
6166
6167   // node_modules/@aitodotai/json-stringify-pretty-compact/index.js
6168   var require_json_stringify_pretty_compact = __commonJS({
6169     "node_modules/@aitodotai/json-stringify-pretty-compact/index.js"(exports2, module2) {
6170       function isObject3(obj) {
6171         return typeof obj === "object" && obj !== null;
6172       }
6173       function forEach(obj, cb) {
6174         if (Array.isArray(obj)) {
6175           obj.forEach(cb);
6176         } else if (isObject3(obj)) {
6177           Object.keys(obj).forEach(function(key) {
6178             var val = obj[key];
6179             cb(val, key);
6180           });
6181         }
6182       }
6183       function getTreeDepth(obj) {
6184         var depth = 0;
6185         if (Array.isArray(obj) || isObject3(obj)) {
6186           forEach(obj, function(val) {
6187             if (Array.isArray(val) || isObject3(val)) {
6188               var tmpDepth = getTreeDepth(val);
6189               if (tmpDepth > depth) {
6190                 depth = tmpDepth;
6191               }
6192             }
6193           });
6194           return depth + 1;
6195         }
6196         return depth;
6197       }
6198       function stringify3(obj, options2) {
6199         options2 = options2 || {};
6200         var indent2 = JSON.stringify([1], null, get4(options2, "indent", 2)).slice(2, -3);
6201         var addMargin = get4(options2, "margins", false);
6202         var addArrayMargin = get4(options2, "arrayMargins", false);
6203         var addObjectMargin = get4(options2, "objectMargins", false);
6204         var maxLength = indent2 === "" ? Infinity : get4(options2, "maxLength", 80);
6205         var maxNesting = get4(options2, "maxNesting", Infinity);
6206         return function _stringify(obj2, currentIndent, reserved) {
6207           if (obj2 && typeof obj2.toJSON === "function") {
6208             obj2 = obj2.toJSON();
6209           }
6210           var string = JSON.stringify(obj2);
6211           if (string === void 0) {
6212             return string;
6213           }
6214           var length = maxLength - currentIndent.length - reserved;
6215           var treeDepth = getTreeDepth(obj2);
6216           if (treeDepth <= maxNesting && string.length <= length) {
6217             var prettified = prettify(string, {
6218               addMargin,
6219               addArrayMargin,
6220               addObjectMargin
6221             });
6222             if (prettified.length <= length) {
6223               return prettified;
6224             }
6225           }
6226           if (isObject3(obj2)) {
6227             var nextIndent = currentIndent + indent2;
6228             var items = [];
6229             var delimiters;
6230             var comma = function(array2, index2) {
6231               return index2 === array2.length - 1 ? 0 : 1;
6232             };
6233             if (Array.isArray(obj2)) {
6234               for (var index = 0; index < obj2.length; index++) {
6235                 items.push(
6236                   _stringify(obj2[index], nextIndent, comma(obj2, index)) || "null"
6237                 );
6238               }
6239               delimiters = "[]";
6240             } else {
6241               Object.keys(obj2).forEach(function(key, index2, array2) {
6242                 var keyPart = JSON.stringify(key) + ": ";
6243                 var value = _stringify(
6244                   obj2[key],
6245                   nextIndent,
6246                   keyPart.length + comma(array2, index2)
6247                 );
6248                 if (value !== void 0) {
6249                   items.push(keyPart + value);
6250                 }
6251               });
6252               delimiters = "{}";
6253             }
6254             if (items.length > 0) {
6255               return [
6256                 delimiters[0],
6257                 indent2 + items.join(",\n" + nextIndent),
6258                 delimiters[1]
6259               ].join("\n" + currentIndent);
6260             }
6261           }
6262           return string;
6263         }(obj, "", 0);
6264       }
6265       var stringOrChar = /("(?:[^\\"]|\\.)*")|[:,\][}{]/g;
6266       function prettify(string, options2) {
6267         options2 = options2 || {};
6268         var tokens = {
6269           "{": "{",
6270           "}": "}",
6271           "[": "[",
6272           "]": "]",
6273           ",": ", ",
6274           ":": ": "
6275         };
6276         if (options2.addMargin || options2.addObjectMargin) {
6277           tokens["{"] = "{ ";
6278           tokens["}"] = " }";
6279         }
6280         if (options2.addMargin || options2.addArrayMargin) {
6281           tokens["["] = "[ ";
6282           tokens["]"] = " ]";
6283         }
6284         return string.replace(stringOrChar, function(match, string2) {
6285           return string2 ? match : tokens[match];
6286         });
6287       }
6288       function get4(options2, name, defaultValue) {
6289         return name in options2 ? options2[name] : defaultValue;
6290       }
6291       module2.exports = stringify3;
6292     }
6293   });
6294
6295   // node_modules/aes-js/index.js
6296   var require_aes_js = __commonJS({
6297     "node_modules/aes-js/index.js"(exports2, module2) {
6298       (function(root3) {
6299         "use strict";
6300         function checkInt(value) {
6301           return parseInt(value) === value;
6302         }
6303         function checkInts(arrayish) {
6304           if (!checkInt(arrayish.length)) {
6305             return false;
6306           }
6307           for (var i3 = 0; i3 < arrayish.length; i3++) {
6308             if (!checkInt(arrayish[i3]) || arrayish[i3] < 0 || arrayish[i3] > 255) {
6309               return false;
6310             }
6311           }
6312           return true;
6313         }
6314         function coerceArray(arg, copy2) {
6315           if (arg.buffer && arg.name === "Uint8Array") {
6316             if (copy2) {
6317               if (arg.slice) {
6318                 arg = arg.slice();
6319               } else {
6320                 arg = Array.prototype.slice.call(arg);
6321               }
6322             }
6323             return arg;
6324           }
6325           if (Array.isArray(arg)) {
6326             if (!checkInts(arg)) {
6327               throw new Error("Array contains invalid value: " + arg);
6328             }
6329             return new Uint8Array(arg);
6330           }
6331           if (checkInt(arg.length) && checkInts(arg)) {
6332             return new Uint8Array(arg);
6333           }
6334           throw new Error("unsupported array-like object");
6335         }
6336         function createArray(length) {
6337           return new Uint8Array(length);
6338         }
6339         function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) {
6340           if (sourceStart != null || sourceEnd != null) {
6341             if (sourceArray.slice) {
6342               sourceArray = sourceArray.slice(sourceStart, sourceEnd);
6343             } else {
6344               sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd);
6345             }
6346           }
6347           targetArray.set(sourceArray, targetStart);
6348         }
6349         var convertUtf8 = function() {
6350           function toBytes(text2) {
6351             var result = [], i3 = 0;
6352             text2 = encodeURI(text2);
6353             while (i3 < text2.length) {
6354               var c2 = text2.charCodeAt(i3++);
6355               if (c2 === 37) {
6356                 result.push(parseInt(text2.substr(i3, 2), 16));
6357                 i3 += 2;
6358               } else {
6359                 result.push(c2);
6360               }
6361             }
6362             return coerceArray(result);
6363           }
6364           function fromBytes(bytes) {
6365             var result = [], i3 = 0;
6366             while (i3 < bytes.length) {
6367               var c2 = bytes[i3];
6368               if (c2 < 128) {
6369                 result.push(String.fromCharCode(c2));
6370                 i3++;
6371               } else if (c2 > 191 && c2 < 224) {
6372                 result.push(String.fromCharCode((c2 & 31) << 6 | bytes[i3 + 1] & 63));
6373                 i3 += 2;
6374               } else {
6375                 result.push(String.fromCharCode((c2 & 15) << 12 | (bytes[i3 + 1] & 63) << 6 | bytes[i3 + 2] & 63));
6376                 i3 += 3;
6377               }
6378             }
6379             return result.join("");
6380           }
6381           return {
6382             toBytes,
6383             fromBytes
6384           };
6385         }();
6386         var convertHex = function() {
6387           function toBytes(text2) {
6388             var result = [];
6389             for (var i3 = 0; i3 < text2.length; i3 += 2) {
6390               result.push(parseInt(text2.substr(i3, 2), 16));
6391             }
6392             return result;
6393           }
6394           var Hex = "0123456789abcdef";
6395           function fromBytes(bytes) {
6396             var result = [];
6397             for (var i3 = 0; i3 < bytes.length; i3++) {
6398               var v2 = bytes[i3];
6399               result.push(Hex[(v2 & 240) >> 4] + Hex[v2 & 15]);
6400             }
6401             return result.join("");
6402           }
6403           return {
6404             toBytes,
6405             fromBytes
6406           };
6407         }();
6408         var numberOfRounds = { 16: 10, 24: 12, 32: 14 };
6409         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];
6410         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];
6411         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];
6412         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];
6413         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];
6414         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];
6415         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];
6416         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];
6417         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];
6418         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];
6419         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];
6420         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];
6421         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];
6422         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];
6423         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];
6424         function convertToInt32(bytes) {
6425           var result = [];
6426           for (var i3 = 0; i3 < bytes.length; i3 += 4) {
6427             result.push(
6428               bytes[i3] << 24 | bytes[i3 + 1] << 16 | bytes[i3 + 2] << 8 | bytes[i3 + 3]
6429             );
6430           }
6431           return result;
6432         }
6433         var AES = function(key) {
6434           if (!(this instanceof AES)) {
6435             throw Error("AES must be instanitated with `new`");
6436           }
6437           Object.defineProperty(this, "key", {
6438             value: coerceArray(key, true)
6439           });
6440           this._prepare();
6441         };
6442         AES.prototype._prepare = function() {
6443           var rounds = numberOfRounds[this.key.length];
6444           if (rounds == null) {
6445             throw new Error("invalid key size (must be 16, 24 or 32 bytes)");
6446           }
6447           this._Ke = [];
6448           this._Kd = [];
6449           for (var i3 = 0; i3 <= rounds; i3++) {
6450             this._Ke.push([0, 0, 0, 0]);
6451             this._Kd.push([0, 0, 0, 0]);
6452           }
6453           var roundKeyCount = (rounds + 1) * 4;
6454           var KC = this.key.length / 4;
6455           var tk = convertToInt32(this.key);
6456           var index;
6457           for (var i3 = 0; i3 < KC; i3++) {
6458             index = i3 >> 2;
6459             this._Ke[index][i3 % 4] = tk[i3];
6460             this._Kd[rounds - index][i3 % 4] = tk[i3];
6461           }
6462           var rconpointer = 0;
6463           var t2 = KC, tt2;
6464           while (t2 < roundKeyCount) {
6465             tt2 = tk[KC - 1];
6466             tk[0] ^= S2[tt2 >> 16 & 255] << 24 ^ S2[tt2 >> 8 & 255] << 16 ^ S2[tt2 & 255] << 8 ^ S2[tt2 >> 24 & 255] ^ rcon[rconpointer] << 24;
6467             rconpointer += 1;
6468             if (KC != 8) {
6469               for (var i3 = 1; i3 < KC; i3++) {
6470                 tk[i3] ^= tk[i3 - 1];
6471               }
6472             } else {
6473               for (var i3 = 1; i3 < KC / 2; i3++) {
6474                 tk[i3] ^= tk[i3 - 1];
6475               }
6476               tt2 = tk[KC / 2 - 1];
6477               tk[KC / 2] ^= S2[tt2 & 255] ^ S2[tt2 >> 8 & 255] << 8 ^ S2[tt2 >> 16 & 255] << 16 ^ S2[tt2 >> 24 & 255] << 24;
6478               for (var i3 = KC / 2 + 1; i3 < KC; i3++) {
6479                 tk[i3] ^= tk[i3 - 1];
6480               }
6481             }
6482             var i3 = 0, r2, c2;
6483             while (i3 < KC && t2 < roundKeyCount) {
6484               r2 = t2 >> 2;
6485               c2 = t2 % 4;
6486               this._Ke[r2][c2] = tk[i3];
6487               this._Kd[rounds - r2][c2] = tk[i3++];
6488               t2++;
6489             }
6490           }
6491           for (var r2 = 1; r2 < rounds; r2++) {
6492             for (var c2 = 0; c2 < 4; c2++) {
6493               tt2 = this._Kd[r2][c2];
6494               this._Kd[r2][c2] = U1[tt2 >> 24 & 255] ^ U2[tt2 >> 16 & 255] ^ U3[tt2 >> 8 & 255] ^ U4[tt2 & 255];
6495             }
6496           }
6497         };
6498         AES.prototype.encrypt = function(plaintext) {
6499           if (plaintext.length != 16) {
6500             throw new Error("invalid plaintext size (must be 16 bytes)");
6501           }
6502           var rounds = this._Ke.length - 1;
6503           var a2 = [0, 0, 0, 0];
6504           var t2 = convertToInt32(plaintext);
6505           for (var i3 = 0; i3 < 4; i3++) {
6506             t2[i3] ^= this._Ke[0][i3];
6507           }
6508           for (var r2 = 1; r2 < rounds; r2++) {
6509             for (var i3 = 0; i3 < 4; i3++) {
6510               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];
6511             }
6512             t2 = a2.slice();
6513           }
6514           var result = createArray(16), tt2;
6515           for (var i3 = 0; i3 < 4; i3++) {
6516             tt2 = this._Ke[rounds][i3];
6517             result[4 * i3] = (S2[t2[i3] >> 24 & 255] ^ tt2 >> 24) & 255;
6518             result[4 * i3 + 1] = (S2[t2[(i3 + 1) % 4] >> 16 & 255] ^ tt2 >> 16) & 255;
6519             result[4 * i3 + 2] = (S2[t2[(i3 + 2) % 4] >> 8 & 255] ^ tt2 >> 8) & 255;
6520             result[4 * i3 + 3] = (S2[t2[(i3 + 3) % 4] & 255] ^ tt2) & 255;
6521           }
6522           return result;
6523         };
6524         AES.prototype.decrypt = function(ciphertext) {
6525           if (ciphertext.length != 16) {
6526             throw new Error("invalid ciphertext size (must be 16 bytes)");
6527           }
6528           var rounds = this._Kd.length - 1;
6529           var a2 = [0, 0, 0, 0];
6530           var t2 = convertToInt32(ciphertext);
6531           for (var i3 = 0; i3 < 4; i3++) {
6532             t2[i3] ^= this._Kd[0][i3];
6533           }
6534           for (var r2 = 1; r2 < rounds; r2++) {
6535             for (var i3 = 0; i3 < 4; i3++) {
6536               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];
6537             }
6538             t2 = a2.slice();
6539           }
6540           var result = createArray(16), tt2;
6541           for (var i3 = 0; i3 < 4; i3++) {
6542             tt2 = this._Kd[rounds][i3];
6543             result[4 * i3] = (Si[t2[i3] >> 24 & 255] ^ tt2 >> 24) & 255;
6544             result[4 * i3 + 1] = (Si[t2[(i3 + 3) % 4] >> 16 & 255] ^ tt2 >> 16) & 255;
6545             result[4 * i3 + 2] = (Si[t2[(i3 + 2) % 4] >> 8 & 255] ^ tt2 >> 8) & 255;
6546             result[4 * i3 + 3] = (Si[t2[(i3 + 1) % 4] & 255] ^ tt2) & 255;
6547           }
6548           return result;
6549         };
6550         var ModeOfOperationECB = function(key) {
6551           if (!(this instanceof ModeOfOperationECB)) {
6552             throw Error("AES must be instanitated with `new`");
6553           }
6554           this.description = "Electronic Code Block";
6555           this.name = "ecb";
6556           this._aes = new AES(key);
6557         };
6558         ModeOfOperationECB.prototype.encrypt = function(plaintext) {
6559           plaintext = coerceArray(plaintext);
6560           if (plaintext.length % 16 !== 0) {
6561             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
6562           }
6563           var ciphertext = createArray(plaintext.length);
6564           var block2 = createArray(16);
6565           for (var i3 = 0; i3 < plaintext.length; i3 += 16) {
6566             copyArray(plaintext, block2, 0, i3, i3 + 16);
6567             block2 = this._aes.encrypt(block2);
6568             copyArray(block2, ciphertext, i3);
6569           }
6570           return ciphertext;
6571         };
6572         ModeOfOperationECB.prototype.decrypt = function(ciphertext) {
6573           ciphertext = coerceArray(ciphertext);
6574           if (ciphertext.length % 16 !== 0) {
6575             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
6576           }
6577           var plaintext = createArray(ciphertext.length);
6578           var block2 = createArray(16);
6579           for (var i3 = 0; i3 < ciphertext.length; i3 += 16) {
6580             copyArray(ciphertext, block2, 0, i3, i3 + 16);
6581             block2 = this._aes.decrypt(block2);
6582             copyArray(block2, plaintext, i3);
6583           }
6584           return plaintext;
6585         };
6586         var ModeOfOperationCBC = function(key, iv) {
6587           if (!(this instanceof ModeOfOperationCBC)) {
6588             throw Error("AES must be instanitated with `new`");
6589           }
6590           this.description = "Cipher Block Chaining";
6591           this.name = "cbc";
6592           if (!iv) {
6593             iv = createArray(16);
6594           } else if (iv.length != 16) {
6595             throw new Error("invalid initialation vector size (must be 16 bytes)");
6596           }
6597           this._lastCipherblock = coerceArray(iv, true);
6598           this._aes = new AES(key);
6599         };
6600         ModeOfOperationCBC.prototype.encrypt = function(plaintext) {
6601           plaintext = coerceArray(plaintext);
6602           if (plaintext.length % 16 !== 0) {
6603             throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
6604           }
6605           var ciphertext = createArray(plaintext.length);
6606           var block2 = createArray(16);
6607           for (var i3 = 0; i3 < plaintext.length; i3 += 16) {
6608             copyArray(plaintext, block2, 0, i3, i3 + 16);
6609             for (var j3 = 0; j3 < 16; j3++) {
6610               block2[j3] ^= this._lastCipherblock[j3];
6611             }
6612             this._lastCipherblock = this._aes.encrypt(block2);
6613             copyArray(this._lastCipherblock, ciphertext, i3);
6614           }
6615           return ciphertext;
6616         };
6617         ModeOfOperationCBC.prototype.decrypt = function(ciphertext) {
6618           ciphertext = coerceArray(ciphertext);
6619           if (ciphertext.length % 16 !== 0) {
6620             throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
6621           }
6622           var plaintext = createArray(ciphertext.length);
6623           var block2 = createArray(16);
6624           for (var i3 = 0; i3 < ciphertext.length; i3 += 16) {
6625             copyArray(ciphertext, block2, 0, i3, i3 + 16);
6626             block2 = this._aes.decrypt(block2);
6627             for (var j3 = 0; j3 < 16; j3++) {
6628               plaintext[i3 + j3] = block2[j3] ^ this._lastCipherblock[j3];
6629             }
6630             copyArray(ciphertext, this._lastCipherblock, 0, i3, i3 + 16);
6631           }
6632           return plaintext;
6633         };
6634         var ModeOfOperationCFB = function(key, iv, segmentSize) {
6635           if (!(this instanceof ModeOfOperationCFB)) {
6636             throw Error("AES must be instanitated with `new`");
6637           }
6638           this.description = "Cipher Feedback";
6639           this.name = "cfb";
6640           if (!iv) {
6641             iv = createArray(16);
6642           } else if (iv.length != 16) {
6643             throw new Error("invalid initialation vector size (must be 16 size)");
6644           }
6645           if (!segmentSize) {
6646             segmentSize = 1;
6647           }
6648           this.segmentSize = segmentSize;
6649           this._shiftRegister = coerceArray(iv, true);
6650           this._aes = new AES(key);
6651         };
6652         ModeOfOperationCFB.prototype.encrypt = function(plaintext) {
6653           if (plaintext.length % this.segmentSize != 0) {
6654             throw new Error("invalid plaintext size (must be segmentSize bytes)");
6655           }
6656           var encrypted = coerceArray(plaintext, true);
6657           var xorSegment;
6658           for (var i3 = 0; i3 < encrypted.length; i3 += this.segmentSize) {
6659             xorSegment = this._aes.encrypt(this._shiftRegister);
6660             for (var j3 = 0; j3 < this.segmentSize; j3++) {
6661               encrypted[i3 + j3] ^= xorSegment[j3];
6662             }
6663             copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
6664             copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i3, i3 + this.segmentSize);
6665           }
6666           return encrypted;
6667         };
6668         ModeOfOperationCFB.prototype.decrypt = function(ciphertext) {
6669           if (ciphertext.length % this.segmentSize != 0) {
6670             throw new Error("invalid ciphertext size (must be segmentSize bytes)");
6671           }
6672           var plaintext = coerceArray(ciphertext, true);
6673           var xorSegment;
6674           for (var i3 = 0; i3 < plaintext.length; i3 += this.segmentSize) {
6675             xorSegment = this._aes.encrypt(this._shiftRegister);
6676             for (var j3 = 0; j3 < this.segmentSize; j3++) {
6677               plaintext[i3 + j3] ^= xorSegment[j3];
6678             }
6679             copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
6680             copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i3, i3 + this.segmentSize);
6681           }
6682           return plaintext;
6683         };
6684         var ModeOfOperationOFB = function(key, iv) {
6685           if (!(this instanceof ModeOfOperationOFB)) {
6686             throw Error("AES must be instanitated with `new`");
6687           }
6688           this.description = "Output Feedback";
6689           this.name = "ofb";
6690           if (!iv) {
6691             iv = createArray(16);
6692           } else if (iv.length != 16) {
6693             throw new Error("invalid initialation vector size (must be 16 bytes)");
6694           }
6695           this._lastPrecipher = coerceArray(iv, true);
6696           this._lastPrecipherIndex = 16;
6697           this._aes = new AES(key);
6698         };
6699         ModeOfOperationOFB.prototype.encrypt = function(plaintext) {
6700           var encrypted = coerceArray(plaintext, true);
6701           for (var i3 = 0; i3 < encrypted.length; i3++) {
6702             if (this._lastPrecipherIndex === 16) {
6703               this._lastPrecipher = this._aes.encrypt(this._lastPrecipher);
6704               this._lastPrecipherIndex = 0;
6705             }
6706             encrypted[i3] ^= this._lastPrecipher[this._lastPrecipherIndex++];
6707           }
6708           return encrypted;
6709         };
6710         ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt;
6711         var Counter = function(initialValue) {
6712           if (!(this instanceof Counter)) {
6713             throw Error("Counter must be instanitated with `new`");
6714           }
6715           if (initialValue !== 0 && !initialValue) {
6716             initialValue = 1;
6717           }
6718           if (typeof initialValue === "number") {
6719             this._counter = createArray(16);
6720             this.setValue(initialValue);
6721           } else {
6722             this.setBytes(initialValue);
6723           }
6724         };
6725         Counter.prototype.setValue = function(value) {
6726           if (typeof value !== "number" || parseInt(value) != value) {
6727             throw new Error("invalid counter value (must be an integer)");
6728           }
6729           if (value > Number.MAX_SAFE_INTEGER) {
6730             throw new Error("integer value out of safe range");
6731           }
6732           for (var index = 15; index >= 0; --index) {
6733             this._counter[index] = value % 256;
6734             value = parseInt(value / 256);
6735           }
6736         };
6737         Counter.prototype.setBytes = function(bytes) {
6738           bytes = coerceArray(bytes, true);
6739           if (bytes.length != 16) {
6740             throw new Error("invalid counter bytes size (must be 16 bytes)");
6741           }
6742           this._counter = bytes;
6743         };
6744         Counter.prototype.increment = function() {
6745           for (var i3 = 15; i3 >= 0; i3--) {
6746             if (this._counter[i3] === 255) {
6747               this._counter[i3] = 0;
6748             } else {
6749               this._counter[i3]++;
6750               break;
6751             }
6752           }
6753         };
6754         var ModeOfOperationCTR = function(key, counter) {
6755           if (!(this instanceof ModeOfOperationCTR)) {
6756             throw Error("AES must be instanitated with `new`");
6757           }
6758           this.description = "Counter";
6759           this.name = "ctr";
6760           if (!(counter instanceof Counter)) {
6761             counter = new Counter(counter);
6762           }
6763           this._counter = counter;
6764           this._remainingCounter = null;
6765           this._remainingCounterIndex = 16;
6766           this._aes = new AES(key);
6767         };
6768         ModeOfOperationCTR.prototype.encrypt = function(plaintext) {
6769           var encrypted = coerceArray(plaintext, true);
6770           for (var i3 = 0; i3 < encrypted.length; i3++) {
6771             if (this._remainingCounterIndex === 16) {
6772               this._remainingCounter = this._aes.encrypt(this._counter._counter);
6773               this._remainingCounterIndex = 0;
6774               this._counter.increment();
6775             }
6776             encrypted[i3] ^= this._remainingCounter[this._remainingCounterIndex++];
6777           }
6778           return encrypted;
6779         };
6780         ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt;
6781         function pkcs7pad(data) {
6782           data = coerceArray(data, true);
6783           var padder = 16 - data.length % 16;
6784           var result = createArray(data.length + padder);
6785           copyArray(data, result);
6786           for (var i3 = data.length; i3 < result.length; i3++) {
6787             result[i3] = padder;
6788           }
6789           return result;
6790         }
6791         function pkcs7strip(data) {
6792           data = coerceArray(data, true);
6793           if (data.length < 16) {
6794             throw new Error("PKCS#7 invalid length");
6795           }
6796           var padder = data[data.length - 1];
6797           if (padder > 16) {
6798             throw new Error("PKCS#7 padding byte out of range");
6799           }
6800           var length = data.length - padder;
6801           for (var i3 = 0; i3 < padder; i3++) {
6802             if (data[length + i3] !== padder) {
6803               throw new Error("PKCS#7 invalid padding byte");
6804             }
6805           }
6806           var result = createArray(length);
6807           copyArray(data, result, 0, 0, length);
6808           return result;
6809         }
6810         var aesjs2 = {
6811           AES,
6812           Counter,
6813           ModeOfOperation: {
6814             ecb: ModeOfOperationECB,
6815             cbc: ModeOfOperationCBC,
6816             cfb: ModeOfOperationCFB,
6817             ofb: ModeOfOperationOFB,
6818             ctr: ModeOfOperationCTR
6819           },
6820           utils: {
6821             hex: convertHex,
6822             utf8: convertUtf8
6823           },
6824           padding: {
6825             pkcs7: {
6826               pad: pkcs7pad,
6827               strip: pkcs7strip
6828             }
6829           },
6830           _arrayTest: {
6831             coerceArray,
6832             createArray,
6833             copyArray
6834           }
6835         };
6836         if (typeof exports2 !== "undefined") {
6837           module2.exports = aesjs2;
6838         } else if (typeof define === "function" && define.amd) {
6839           define([], function() {
6840             return aesjs2;
6841           });
6842         } else {
6843           if (root3.aesjs) {
6844             aesjs2._aesjs = root3.aesjs;
6845           }
6846           root3.aesjs = aesjs2;
6847         }
6848       })(exports2);
6849     }
6850   });
6851
6852   // node_modules/lodash/lodash.js
6853   var require_lodash = __commonJS({
6854     "node_modules/lodash/lodash.js"(exports2, module2) {
6855       (function() {
6856         var undefined2;
6857         var VERSION = "4.17.21";
6858         var LARGE_ARRAY_SIZE2 = 200;
6859         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`";
6860         var HASH_UNDEFINED4 = "__lodash_hash_undefined__";
6861         var MAX_MEMOIZE_SIZE = 500;
6862         var PLACEHOLDER = "__lodash_placeholder__";
6863         var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
6864         var COMPARE_PARTIAL_FLAG5 = 1, COMPARE_UNORDERED_FLAG3 = 2;
6865         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;
6866         var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
6867         var HOT_COUNT = 800, HOT_SPAN = 16;
6868         var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
6869         var INFINITY2 = 1 / 0, MAX_SAFE_INTEGER3 = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN2 = 0 / 0;
6870         var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
6871         var wrapFlags = [
6872           ["ary", WRAP_ARY_FLAG],
6873           ["bind", WRAP_BIND_FLAG],
6874           ["bindKey", WRAP_BIND_KEY_FLAG],
6875           ["curry", WRAP_CURRY_FLAG],
6876           ["curryRight", WRAP_CURRY_RIGHT_FLAG],
6877           ["flip", WRAP_FLIP_FLAG],
6878           ["partial", WRAP_PARTIAL_FLAG],
6879           ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
6880           ["rearg", WRAP_REARG_FLAG]
6881         ];
6882         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]";
6883         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]";
6884         var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
6885         var reEscapedHtml2 = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml2 = /[&<>"']/g, reHasEscapedHtml2 = RegExp(reEscapedHtml2.source), reHasUnescapedHtml2 = RegExp(reUnescapedHtml2.source);
6886         var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
6887         var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
6888         var reRegExpChar2 = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar2.source);
6889         var reTrimStart2 = /^\s+/;
6890         var reWhitespace2 = /\s/;
6891         var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
6892         var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
6893         var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
6894         var reEscapeChar = /\\(\\)?/g;
6895         var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
6896         var reFlags = /\w*$/;
6897         var reIsBadHex2 = /^[-+]0x[0-9a-f]+$/i;
6898         var reIsBinary2 = /^0b[01]+$/i;
6899         var reIsHostCtor2 = /^\[object .+?Constructor\]$/;
6900         var reIsOctal2 = /^0o[0-7]+$/i;
6901         var reIsUint2 = /^(?:0|[1-9]\d*)$/;
6902         var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
6903         var reNoMatch = /($^)/;
6904         var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
6905         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;
6906         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";
6907         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("|") + ")";
6908         var reApos = RegExp(rsApos, "g");
6909         var reComboMark = RegExp(rsCombo, "g");
6910         var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
6911         var reUnicodeWord = RegExp([
6912           rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
6913           rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
6914           rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
6915           rsUpper + "+" + rsOptContrUpper,
6916           rsOrdUpper,
6917           rsOrdLower,
6918           rsDigits,
6919           rsEmoji
6920         ].join("|"), "g");
6921         var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
6922         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 ]/;
6923         var contextProps = [
6924           "Array",
6925           "Buffer",
6926           "DataView",
6927           "Date",
6928           "Error",
6929           "Float32Array",
6930           "Float64Array",
6931           "Function",
6932           "Int8Array",
6933           "Int16Array",
6934           "Int32Array",
6935           "Map",
6936           "Math",
6937           "Object",
6938           "Promise",
6939           "RegExp",
6940           "Set",
6941           "String",
6942           "Symbol",
6943           "TypeError",
6944           "Uint8Array",
6945           "Uint8ClampedArray",
6946           "Uint16Array",
6947           "Uint32Array",
6948           "WeakMap",
6949           "_",
6950           "clearTimeout",
6951           "isFinite",
6952           "parseInt",
6953           "setTimeout"
6954         ];
6955         var templateCounter = -1;
6956         var typedArrayTags2 = {};
6957         typedArrayTags2[float32Tag2] = typedArrayTags2[float64Tag2] = typedArrayTags2[int8Tag2] = typedArrayTags2[int16Tag2] = typedArrayTags2[int32Tag2] = typedArrayTags2[uint8Tag2] = typedArrayTags2[uint8ClampedTag2] = typedArrayTags2[uint16Tag2] = typedArrayTags2[uint32Tag2] = true;
6958         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;
6959         var cloneableTags = {};
6960         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;
6961         cloneableTags[errorTag3] = cloneableTags[funcTag3] = cloneableTags[weakMapTag3] = false;
6962         var deburredLetters = {
6963           // Latin-1 Supplement block.
6964           "\xC0": "A",
6965           "\xC1": "A",
6966           "\xC2": "A",
6967           "\xC3": "A",
6968           "\xC4": "A",
6969           "\xC5": "A",
6970           "\xE0": "a",
6971           "\xE1": "a",
6972           "\xE2": "a",
6973           "\xE3": "a",
6974           "\xE4": "a",
6975           "\xE5": "a",
6976           "\xC7": "C",
6977           "\xE7": "c",
6978           "\xD0": "D",
6979           "\xF0": "d",
6980           "\xC8": "E",
6981           "\xC9": "E",
6982           "\xCA": "E",
6983           "\xCB": "E",
6984           "\xE8": "e",
6985           "\xE9": "e",
6986           "\xEA": "e",
6987           "\xEB": "e",
6988           "\xCC": "I",
6989           "\xCD": "I",
6990           "\xCE": "I",
6991           "\xCF": "I",
6992           "\xEC": "i",
6993           "\xED": "i",
6994           "\xEE": "i",
6995           "\xEF": "i",
6996           "\xD1": "N",
6997           "\xF1": "n",
6998           "\xD2": "O",
6999           "\xD3": "O",
7000           "\xD4": "O",
7001           "\xD5": "O",
7002           "\xD6": "O",
7003           "\xD8": "O",
7004           "\xF2": "o",
7005           "\xF3": "o",
7006           "\xF4": "o",
7007           "\xF5": "o",
7008           "\xF6": "o",
7009           "\xF8": "o",
7010           "\xD9": "U",
7011           "\xDA": "U",
7012           "\xDB": "U",
7013           "\xDC": "U",
7014           "\xF9": "u",
7015           "\xFA": "u",
7016           "\xFB": "u",
7017           "\xFC": "u",
7018           "\xDD": "Y",
7019           "\xFD": "y",
7020           "\xFF": "y",
7021           "\xC6": "Ae",
7022           "\xE6": "ae",
7023           "\xDE": "Th",
7024           "\xFE": "th",
7025           "\xDF": "ss",
7026           // Latin Extended-A block.
7027           "\u0100": "A",
7028           "\u0102": "A",
7029           "\u0104": "A",
7030           "\u0101": "a",
7031           "\u0103": "a",
7032           "\u0105": "a",
7033           "\u0106": "C",
7034           "\u0108": "C",
7035           "\u010A": "C",
7036           "\u010C": "C",
7037           "\u0107": "c",
7038           "\u0109": "c",
7039           "\u010B": "c",
7040           "\u010D": "c",
7041           "\u010E": "D",
7042           "\u0110": "D",
7043           "\u010F": "d",
7044           "\u0111": "d",
7045           "\u0112": "E",
7046           "\u0114": "E",
7047           "\u0116": "E",
7048           "\u0118": "E",
7049           "\u011A": "E",
7050           "\u0113": "e",
7051           "\u0115": "e",
7052           "\u0117": "e",
7053           "\u0119": "e",
7054           "\u011B": "e",
7055           "\u011C": "G",
7056           "\u011E": "G",
7057           "\u0120": "G",
7058           "\u0122": "G",
7059           "\u011D": "g",
7060           "\u011F": "g",
7061           "\u0121": "g",
7062           "\u0123": "g",
7063           "\u0124": "H",
7064           "\u0126": "H",
7065           "\u0125": "h",
7066           "\u0127": "h",
7067           "\u0128": "I",
7068           "\u012A": "I",
7069           "\u012C": "I",
7070           "\u012E": "I",
7071           "\u0130": "I",
7072           "\u0129": "i",
7073           "\u012B": "i",
7074           "\u012D": "i",
7075           "\u012F": "i",
7076           "\u0131": "i",
7077           "\u0134": "J",
7078           "\u0135": "j",
7079           "\u0136": "K",
7080           "\u0137": "k",
7081           "\u0138": "k",
7082           "\u0139": "L",
7083           "\u013B": "L",
7084           "\u013D": "L",
7085           "\u013F": "L",
7086           "\u0141": "L",
7087           "\u013A": "l",
7088           "\u013C": "l",
7089           "\u013E": "l",
7090           "\u0140": "l",
7091           "\u0142": "l",
7092           "\u0143": "N",
7093           "\u0145": "N",
7094           "\u0147": "N",
7095           "\u014A": "N",
7096           "\u0144": "n",
7097           "\u0146": "n",
7098           "\u0148": "n",
7099           "\u014B": "n",
7100           "\u014C": "O",
7101           "\u014E": "O",
7102           "\u0150": "O",
7103           "\u014D": "o",
7104           "\u014F": "o",
7105           "\u0151": "o",
7106           "\u0154": "R",
7107           "\u0156": "R",
7108           "\u0158": "R",
7109           "\u0155": "r",
7110           "\u0157": "r",
7111           "\u0159": "r",
7112           "\u015A": "S",
7113           "\u015C": "S",
7114           "\u015E": "S",
7115           "\u0160": "S",
7116           "\u015B": "s",
7117           "\u015D": "s",
7118           "\u015F": "s",
7119           "\u0161": "s",
7120           "\u0162": "T",
7121           "\u0164": "T",
7122           "\u0166": "T",
7123           "\u0163": "t",
7124           "\u0165": "t",
7125           "\u0167": "t",
7126           "\u0168": "U",
7127           "\u016A": "U",
7128           "\u016C": "U",
7129           "\u016E": "U",
7130           "\u0170": "U",
7131           "\u0172": "U",
7132           "\u0169": "u",
7133           "\u016B": "u",
7134           "\u016D": "u",
7135           "\u016F": "u",
7136           "\u0171": "u",
7137           "\u0173": "u",
7138           "\u0174": "W",
7139           "\u0175": "w",
7140           "\u0176": "Y",
7141           "\u0177": "y",
7142           "\u0178": "Y",
7143           "\u0179": "Z",
7144           "\u017B": "Z",
7145           "\u017D": "Z",
7146           "\u017A": "z",
7147           "\u017C": "z",
7148           "\u017E": "z",
7149           "\u0132": "IJ",
7150           "\u0133": "ij",
7151           "\u0152": "Oe",
7152           "\u0153": "oe",
7153           "\u0149": "'n",
7154           "\u017F": "s"
7155         };
7156         var htmlEscapes2 = {
7157           "&": "&amp;",
7158           "<": "&lt;",
7159           ">": "&gt;",
7160           '"': "&quot;",
7161           "'": "&#39;"
7162         };
7163         var htmlUnescapes2 = {
7164           "&amp;": "&",
7165           "&lt;": "<",
7166           "&gt;": ">",
7167           "&quot;": '"',
7168           "&#39;": "'"
7169         };
7170         var stringEscapes = {
7171           "\\": "\\",
7172           "'": "'",
7173           "\n": "n",
7174           "\r": "r",
7175           "\u2028": "u2028",
7176           "\u2029": "u2029"
7177         };
7178         var freeParseFloat = parseFloat, freeParseInt2 = parseInt;
7179         var freeGlobal2 = typeof global == "object" && global && global.Object === Object && global;
7180         var freeSelf2 = typeof self == "object" && self && self.Object === Object && self;
7181         var root3 = freeGlobal2 || freeSelf2 || Function("return this")();
7182         var freeExports3 = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
7183         var freeModule3 = freeExports3 && typeof module2 == "object" && module2 && !module2.nodeType && module2;
7184         var moduleExports3 = freeModule3 && freeModule3.exports === freeExports3;
7185         var freeProcess2 = moduleExports3 && freeGlobal2.process;
7186         var nodeUtil2 = function() {
7187           try {
7188             var types = freeModule3 && freeModule3.require && freeModule3.require("util").types;
7189             if (types) {
7190               return types;
7191             }
7192             return freeProcess2 && freeProcess2.binding && freeProcess2.binding("util");
7193           } catch (e3) {
7194           }
7195         }();
7196         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;
7197         function apply(func, thisArg, args) {
7198           switch (args.length) {
7199             case 0:
7200               return func.call(thisArg);
7201             case 1:
7202               return func.call(thisArg, args[0]);
7203             case 2:
7204               return func.call(thisArg, args[0], args[1]);
7205             case 3:
7206               return func.call(thisArg, args[0], args[1], args[2]);
7207           }
7208           return func.apply(thisArg, args);
7209         }
7210         function arrayAggregator(array2, setter, iteratee, accumulator) {
7211           var index = -1, length = array2 == null ? 0 : array2.length;
7212           while (++index < length) {
7213             var value = array2[index];
7214             setter(accumulator, value, iteratee(value), array2);
7215           }
7216           return accumulator;
7217         }
7218         function arrayEach(array2, iteratee) {
7219           var index = -1, length = array2 == null ? 0 : array2.length;
7220           while (++index < length) {
7221             if (iteratee(array2[index], index, array2) === false) {
7222               break;
7223             }
7224           }
7225           return array2;
7226         }
7227         function arrayEachRight(array2, iteratee) {
7228           var length = array2 == null ? 0 : array2.length;
7229           while (length--) {
7230             if (iteratee(array2[length], length, array2) === false) {
7231               break;
7232             }
7233           }
7234           return array2;
7235         }
7236         function arrayEvery(array2, predicate) {
7237           var index = -1, length = array2 == null ? 0 : array2.length;
7238           while (++index < length) {
7239             if (!predicate(array2[index], index, array2)) {
7240               return false;
7241             }
7242           }
7243           return true;
7244         }
7245         function arrayFilter2(array2, predicate) {
7246           var index = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
7247           while (++index < length) {
7248             var value = array2[index];
7249             if (predicate(value, index, array2)) {
7250               result[resIndex++] = value;
7251             }
7252           }
7253           return result;
7254         }
7255         function arrayIncludes(array2, value) {
7256           var length = array2 == null ? 0 : array2.length;
7257           return !!length && baseIndexOf(array2, value, 0) > -1;
7258         }
7259         function arrayIncludesWith(array2, value, comparator) {
7260           var index = -1, length = array2 == null ? 0 : array2.length;
7261           while (++index < length) {
7262             if (comparator(value, array2[index])) {
7263               return true;
7264             }
7265           }
7266           return false;
7267         }
7268         function arrayMap2(array2, iteratee) {
7269           var index = -1, length = array2 == null ? 0 : array2.length, result = Array(length);
7270           while (++index < length) {
7271             result[index] = iteratee(array2[index], index, array2);
7272           }
7273           return result;
7274         }
7275         function arrayPush2(array2, values) {
7276           var index = -1, length = values.length, offset = array2.length;
7277           while (++index < length) {
7278             array2[offset + index] = values[index];
7279           }
7280           return array2;
7281         }
7282         function arrayReduce(array2, iteratee, accumulator, initAccum) {
7283           var index = -1, length = array2 == null ? 0 : array2.length;
7284           if (initAccum && length) {
7285             accumulator = array2[++index];
7286           }
7287           while (++index < length) {
7288             accumulator = iteratee(accumulator, array2[index], index, array2);
7289           }
7290           return accumulator;
7291         }
7292         function arrayReduceRight(array2, iteratee, accumulator, initAccum) {
7293           var length = array2 == null ? 0 : array2.length;
7294           if (initAccum && length) {
7295             accumulator = array2[--length];
7296           }
7297           while (length--) {
7298             accumulator = iteratee(accumulator, array2[length], length, array2);
7299           }
7300           return accumulator;
7301         }
7302         function arraySome2(array2, predicate) {
7303           var index = -1, length = array2 == null ? 0 : array2.length;
7304           while (++index < length) {
7305             if (predicate(array2[index], index, array2)) {
7306               return true;
7307             }
7308           }
7309           return false;
7310         }
7311         var asciiSize = baseProperty("length");
7312         function asciiToArray(string) {
7313           return string.split("");
7314         }
7315         function asciiWords(string) {
7316           return string.match(reAsciiWord) || [];
7317         }
7318         function baseFindKey(collection, predicate, eachFunc) {
7319           var result;
7320           eachFunc(collection, function(value, key, collection2) {
7321             if (predicate(value, key, collection2)) {
7322               result = key;
7323               return false;
7324             }
7325           });
7326           return result;
7327         }
7328         function baseFindIndex(array2, predicate, fromIndex, fromRight) {
7329           var length = array2.length, index = fromIndex + (fromRight ? 1 : -1);
7330           while (fromRight ? index-- : ++index < length) {
7331             if (predicate(array2[index], index, array2)) {
7332               return index;
7333             }
7334           }
7335           return -1;
7336         }
7337         function baseIndexOf(array2, value, fromIndex) {
7338           return value === value ? strictIndexOf(array2, value, fromIndex) : baseFindIndex(array2, baseIsNaN, fromIndex);
7339         }
7340         function baseIndexOfWith(array2, value, fromIndex, comparator) {
7341           var index = fromIndex - 1, length = array2.length;
7342           while (++index < length) {
7343             if (comparator(array2[index], value)) {
7344               return index;
7345             }
7346           }
7347           return -1;
7348         }
7349         function baseIsNaN(value) {
7350           return value !== value;
7351         }
7352         function baseMean(array2, iteratee) {
7353           var length = array2 == null ? 0 : array2.length;
7354           return length ? baseSum(array2, iteratee) / length : NAN2;
7355         }
7356         function baseProperty(key) {
7357           return function(object) {
7358             return object == null ? undefined2 : object[key];
7359           };
7360         }
7361         function basePropertyOf2(object) {
7362           return function(key) {
7363             return object == null ? undefined2 : object[key];
7364           };
7365         }
7366         function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
7367           eachFunc(collection, function(value, index, collection2) {
7368             accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
7369           });
7370           return accumulator;
7371         }
7372         function baseSortBy(array2, comparer) {
7373           var length = array2.length;
7374           array2.sort(comparer);
7375           while (length--) {
7376             array2[length] = array2[length].value;
7377           }
7378           return array2;
7379         }
7380         function baseSum(array2, iteratee) {
7381           var result, index = -1, length = array2.length;
7382           while (++index < length) {
7383             var current = iteratee(array2[index]);
7384             if (current !== undefined2) {
7385               result = result === undefined2 ? current : result + current;
7386             }
7387           }
7388           return result;
7389         }
7390         function baseTimes2(n3, iteratee) {
7391           var index = -1, result = Array(n3);
7392           while (++index < n3) {
7393             result[index] = iteratee(index);
7394           }
7395           return result;
7396         }
7397         function baseToPairs(object, props) {
7398           return arrayMap2(props, function(key) {
7399             return [key, object[key]];
7400           });
7401         }
7402         function baseTrim2(string) {
7403           return string ? string.slice(0, trimmedEndIndex2(string) + 1).replace(reTrimStart2, "") : string;
7404         }
7405         function baseUnary2(func) {
7406           return function(value) {
7407             return func(value);
7408           };
7409         }
7410         function baseValues(object, props) {
7411           return arrayMap2(props, function(key) {
7412             return object[key];
7413           });
7414         }
7415         function cacheHas2(cache, key) {
7416           return cache.has(key);
7417         }
7418         function charsStartIndex(strSymbols, chrSymbols) {
7419           var index = -1, length = strSymbols.length;
7420           while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
7421           }
7422           return index;
7423         }
7424         function charsEndIndex(strSymbols, chrSymbols) {
7425           var index = strSymbols.length;
7426           while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
7427           }
7428           return index;
7429         }
7430         function countHolders(array2, placeholder) {
7431           var length = array2.length, result = 0;
7432           while (length--) {
7433             if (array2[length] === placeholder) {
7434               ++result;
7435             }
7436           }
7437           return result;
7438         }
7439         var deburrLetter = basePropertyOf2(deburredLetters);
7440         var escapeHtmlChar2 = basePropertyOf2(htmlEscapes2);
7441         function escapeStringChar(chr) {
7442           return "\\" + stringEscapes[chr];
7443         }
7444         function getValue2(object, key) {
7445           return object == null ? undefined2 : object[key];
7446         }
7447         function hasUnicode(string) {
7448           return reHasUnicode.test(string);
7449         }
7450         function hasUnicodeWord(string) {
7451           return reHasUnicodeWord.test(string);
7452         }
7453         function iteratorToArray(iterator) {
7454           var data, result = [];
7455           while (!(data = iterator.next()).done) {
7456             result.push(data.value);
7457           }
7458           return result;
7459         }
7460         function mapToArray2(map2) {
7461           var index = -1, result = Array(map2.size);
7462           map2.forEach(function(value, key) {
7463             result[++index] = [key, value];
7464           });
7465           return result;
7466         }
7467         function overArg2(func, transform2) {
7468           return function(arg) {
7469             return func(transform2(arg));
7470           };
7471         }
7472         function replaceHolders(array2, placeholder) {
7473           var index = -1, length = array2.length, resIndex = 0, result = [];
7474           while (++index < length) {
7475             var value = array2[index];
7476             if (value === placeholder || value === PLACEHOLDER) {
7477               array2[index] = PLACEHOLDER;
7478               result[resIndex++] = index;
7479             }
7480           }
7481           return result;
7482         }
7483         function setToArray2(set3) {
7484           var index = -1, result = Array(set3.size);
7485           set3.forEach(function(value) {
7486             result[++index] = value;
7487           });
7488           return result;
7489         }
7490         function setToPairs(set3) {
7491           var index = -1, result = Array(set3.size);
7492           set3.forEach(function(value) {
7493             result[++index] = [value, value];
7494           });
7495           return result;
7496         }
7497         function strictIndexOf(array2, value, fromIndex) {
7498           var index = fromIndex - 1, length = array2.length;
7499           while (++index < length) {
7500             if (array2[index] === value) {
7501               return index;
7502             }
7503           }
7504           return -1;
7505         }
7506         function strictLastIndexOf(array2, value, fromIndex) {
7507           var index = fromIndex + 1;
7508           while (index--) {
7509             if (array2[index] === value) {
7510               return index;
7511             }
7512           }
7513           return index;
7514         }
7515         function stringSize(string) {
7516           return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
7517         }
7518         function stringToArray(string) {
7519           return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
7520         }
7521         function trimmedEndIndex2(string) {
7522           var index = string.length;
7523           while (index-- && reWhitespace2.test(string.charAt(index))) {
7524           }
7525           return index;
7526         }
7527         var unescapeHtmlChar2 = basePropertyOf2(htmlUnescapes2);
7528         function unicodeSize(string) {
7529           var result = reUnicode.lastIndex = 0;
7530           while (reUnicode.test(string)) {
7531             ++result;
7532           }
7533           return result;
7534         }
7535         function unicodeToArray(string) {
7536           return string.match(reUnicode) || [];
7537         }
7538         function unicodeWords(string) {
7539           return string.match(reUnicodeWord) || [];
7540         }
7541         var runInContext = function runInContext2(context) {
7542           context = context == null ? root3 : _2.defaults(root3.Object(), context, _2.pick(root3, contextProps));
7543           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;
7544           var arrayProto2 = Array2.prototype, funcProto3 = Function2.prototype, objectProto13 = Object2.prototype;
7545           var coreJsData2 = context["__core-js_shared__"];
7546           var funcToString3 = funcProto3.toString;
7547           var hasOwnProperty10 = objectProto13.hasOwnProperty;
7548           var idCounter = 0;
7549           var maskSrcKey2 = function() {
7550             var uid = /[^.]+$/.exec(coreJsData2 && coreJsData2.keys && coreJsData2.keys.IE_PROTO || "");
7551             return uid ? "Symbol(src)_1." + uid : "";
7552           }();
7553           var nativeObjectToString3 = objectProto13.toString;
7554           var objectCtorString = funcToString3.call(Object2);
7555           var oldDash = root3._;
7556           var reIsNative2 = RegExp2(
7557             "^" + funcToString3.call(hasOwnProperty10).replace(reRegExpChar2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
7558           );
7559           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;
7560           var defineProperty = function() {
7561             try {
7562               var func = getNative2(Object2, "defineProperty");
7563               func({}, "", {});
7564               return func;
7565             } catch (e3) {
7566             }
7567           }();
7568           var ctxClearTimeout = context.clearTimeout !== root3.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root3.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root3.setTimeout && context.setTimeout;
7569           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;
7570           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");
7571           var metaMap = WeakMap2 && new WeakMap2();
7572           var realNames = {};
7573           var dataViewCtorString2 = toSource2(DataView3), mapCtorString2 = toSource2(Map3), promiseCtorString2 = toSource2(Promise3), setCtorString2 = toSource2(Set3), weakMapCtorString2 = toSource2(WeakMap2);
7574           var symbolProto3 = Symbol3 ? Symbol3.prototype : undefined2, symbolValueOf2 = symbolProto3 ? symbolProto3.valueOf : undefined2, symbolToString2 = symbolProto3 ? symbolProto3.toString : undefined2;
7575           function lodash(value) {
7576             if (isObjectLike2(value) && !isArray2(value) && !(value instanceof LazyWrapper)) {
7577               if (value instanceof LodashWrapper) {
7578                 return value;
7579               }
7580               if (hasOwnProperty10.call(value, "__wrapped__")) {
7581                 return wrapperClone(value);
7582               }
7583             }
7584             return new LodashWrapper(value);
7585           }
7586           var baseCreate = function() {
7587             function object() {
7588             }
7589             return function(proto) {
7590               if (!isObject3(proto)) {
7591                 return {};
7592               }
7593               if (objectCreate) {
7594                 return objectCreate(proto);
7595               }
7596               object.prototype = proto;
7597               var result2 = new object();
7598               object.prototype = undefined2;
7599               return result2;
7600             };
7601           }();
7602           function baseLodash() {
7603           }
7604           function LodashWrapper(value, chainAll) {
7605             this.__wrapped__ = value;
7606             this.__actions__ = [];
7607             this.__chain__ = !!chainAll;
7608             this.__index__ = 0;
7609             this.__values__ = undefined2;
7610           }
7611           lodash.templateSettings = {
7612             /**
7613              * Used to detect `data` property values to be HTML-escaped.
7614              *
7615              * @memberOf _.templateSettings
7616              * @type {RegExp}
7617              */
7618             "escape": reEscape,
7619             /**
7620              * Used to detect code to be evaluated.
7621              *
7622              * @memberOf _.templateSettings
7623              * @type {RegExp}
7624              */
7625             "evaluate": reEvaluate,
7626             /**
7627              * Used to detect `data` property values to inject.
7628              *
7629              * @memberOf _.templateSettings
7630              * @type {RegExp}
7631              */
7632             "interpolate": reInterpolate,
7633             /**
7634              * Used to reference the data object in the template text.
7635              *
7636              * @memberOf _.templateSettings
7637              * @type {string}
7638              */
7639             "variable": "",
7640             /**
7641              * Used to import variables into the compiled template.
7642              *
7643              * @memberOf _.templateSettings
7644              * @type {Object}
7645              */
7646             "imports": {
7647               /**
7648                * A reference to the `lodash` function.
7649                *
7650                * @memberOf _.templateSettings.imports
7651                * @type {Function}
7652                */
7653               "_": lodash
7654             }
7655           };
7656           lodash.prototype = baseLodash.prototype;
7657           lodash.prototype.constructor = lodash;
7658           LodashWrapper.prototype = baseCreate(baseLodash.prototype);
7659           LodashWrapper.prototype.constructor = LodashWrapper;
7660           function LazyWrapper(value) {
7661             this.__wrapped__ = value;
7662             this.__actions__ = [];
7663             this.__dir__ = 1;
7664             this.__filtered__ = false;
7665             this.__iteratees__ = [];
7666             this.__takeCount__ = MAX_ARRAY_LENGTH;
7667             this.__views__ = [];
7668           }
7669           function lazyClone() {
7670             var result2 = new LazyWrapper(this.__wrapped__);
7671             result2.__actions__ = copyArray(this.__actions__);
7672             result2.__dir__ = this.__dir__;
7673             result2.__filtered__ = this.__filtered__;
7674             result2.__iteratees__ = copyArray(this.__iteratees__);
7675             result2.__takeCount__ = this.__takeCount__;
7676             result2.__views__ = copyArray(this.__views__);
7677             return result2;
7678           }
7679           function lazyReverse() {
7680             if (this.__filtered__) {
7681               var result2 = new LazyWrapper(this);
7682               result2.__dir__ = -1;
7683               result2.__filtered__ = true;
7684             } else {
7685               result2 = this.clone();
7686               result2.__dir__ *= -1;
7687             }
7688             return result2;
7689           }
7690           function lazyValue() {
7691             var array2 = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray2(array2), isRight = dir < 0, arrLength = isArr ? array2.length : 0, view = getView(0, arrLength, this.__views__), start2 = view.start, end = view.end, length = end - start2, index = isRight ? end : start2 - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin2(length, this.__takeCount__);
7692             if (!isArr || !isRight && arrLength == length && takeCount == length) {
7693               return baseWrapperValue(array2, this.__actions__);
7694             }
7695             var result2 = [];
7696             outer:
7697               while (length-- && resIndex < takeCount) {
7698                 index += dir;
7699                 var iterIndex = -1, value = array2[index];
7700                 while (++iterIndex < iterLength) {
7701                   var data = iteratees[iterIndex], iteratee2 = data.iteratee, type2 = data.type, computed = iteratee2(value);
7702                   if (type2 == LAZY_MAP_FLAG) {
7703                     value = computed;
7704                   } else if (!computed) {
7705                     if (type2 == LAZY_FILTER_FLAG) {
7706                       continue outer;
7707                     } else {
7708                       break outer;
7709                     }
7710                   }
7711                 }
7712                 result2[resIndex++] = value;
7713               }
7714             return result2;
7715           }
7716           LazyWrapper.prototype = baseCreate(baseLodash.prototype);
7717           LazyWrapper.prototype.constructor = LazyWrapper;
7718           function Hash2(entries) {
7719             var index = -1, length = entries == null ? 0 : entries.length;
7720             this.clear();
7721             while (++index < length) {
7722               var entry = entries[index];
7723               this.set(entry[0], entry[1]);
7724             }
7725           }
7726           function hashClear2() {
7727             this.__data__ = nativeCreate2 ? nativeCreate2(null) : {};
7728             this.size = 0;
7729           }
7730           function hashDelete2(key) {
7731             var result2 = this.has(key) && delete this.__data__[key];
7732             this.size -= result2 ? 1 : 0;
7733             return result2;
7734           }
7735           function hashGet2(key) {
7736             var data = this.__data__;
7737             if (nativeCreate2) {
7738               var result2 = data[key];
7739               return result2 === HASH_UNDEFINED4 ? undefined2 : result2;
7740             }
7741             return hasOwnProperty10.call(data, key) ? data[key] : undefined2;
7742           }
7743           function hashHas2(key) {
7744             var data = this.__data__;
7745             return nativeCreate2 ? data[key] !== undefined2 : hasOwnProperty10.call(data, key);
7746           }
7747           function hashSet2(key, value) {
7748             var data = this.__data__;
7749             this.size += this.has(key) ? 0 : 1;
7750             data[key] = nativeCreate2 && value === undefined2 ? HASH_UNDEFINED4 : value;
7751             return this;
7752           }
7753           Hash2.prototype.clear = hashClear2;
7754           Hash2.prototype["delete"] = hashDelete2;
7755           Hash2.prototype.get = hashGet2;
7756           Hash2.prototype.has = hashHas2;
7757           Hash2.prototype.set = hashSet2;
7758           function ListCache2(entries) {
7759             var index = -1, length = entries == null ? 0 : entries.length;
7760             this.clear();
7761             while (++index < length) {
7762               var entry = entries[index];
7763               this.set(entry[0], entry[1]);
7764             }
7765           }
7766           function listCacheClear2() {
7767             this.__data__ = [];
7768             this.size = 0;
7769           }
7770           function listCacheDelete2(key) {
7771             var data = this.__data__, index = assocIndexOf2(data, key);
7772             if (index < 0) {
7773               return false;
7774             }
7775             var lastIndex = data.length - 1;
7776             if (index == lastIndex) {
7777               data.pop();
7778             } else {
7779               splice2.call(data, index, 1);
7780             }
7781             --this.size;
7782             return true;
7783           }
7784           function listCacheGet2(key) {
7785             var data = this.__data__, index = assocIndexOf2(data, key);
7786             return index < 0 ? undefined2 : data[index][1];
7787           }
7788           function listCacheHas2(key) {
7789             return assocIndexOf2(this.__data__, key) > -1;
7790           }
7791           function listCacheSet2(key, value) {
7792             var data = this.__data__, index = assocIndexOf2(data, key);
7793             if (index < 0) {
7794               ++this.size;
7795               data.push([key, value]);
7796             } else {
7797               data[index][1] = value;
7798             }
7799             return this;
7800           }
7801           ListCache2.prototype.clear = listCacheClear2;
7802           ListCache2.prototype["delete"] = listCacheDelete2;
7803           ListCache2.prototype.get = listCacheGet2;
7804           ListCache2.prototype.has = listCacheHas2;
7805           ListCache2.prototype.set = listCacheSet2;
7806           function MapCache2(entries) {
7807             var index = -1, length = entries == null ? 0 : entries.length;
7808             this.clear();
7809             while (++index < length) {
7810               var entry = entries[index];
7811               this.set(entry[0], entry[1]);
7812             }
7813           }
7814           function mapCacheClear2() {
7815             this.size = 0;
7816             this.__data__ = {
7817               "hash": new Hash2(),
7818               "map": new (Map3 || ListCache2)(),
7819               "string": new Hash2()
7820             };
7821           }
7822           function mapCacheDelete2(key) {
7823             var result2 = getMapData2(this, key)["delete"](key);
7824             this.size -= result2 ? 1 : 0;
7825             return result2;
7826           }
7827           function mapCacheGet2(key) {
7828             return getMapData2(this, key).get(key);
7829           }
7830           function mapCacheHas2(key) {
7831             return getMapData2(this, key).has(key);
7832           }
7833           function mapCacheSet2(key, value) {
7834             var data = getMapData2(this, key), size2 = data.size;
7835             data.set(key, value);
7836             this.size += data.size == size2 ? 0 : 1;
7837             return this;
7838           }
7839           MapCache2.prototype.clear = mapCacheClear2;
7840           MapCache2.prototype["delete"] = mapCacheDelete2;
7841           MapCache2.prototype.get = mapCacheGet2;
7842           MapCache2.prototype.has = mapCacheHas2;
7843           MapCache2.prototype.set = mapCacheSet2;
7844           function SetCache2(values2) {
7845             var index = -1, length = values2 == null ? 0 : values2.length;
7846             this.__data__ = new MapCache2();
7847             while (++index < length) {
7848               this.add(values2[index]);
7849             }
7850           }
7851           function setCacheAdd2(value) {
7852             this.__data__.set(value, HASH_UNDEFINED4);
7853             return this;
7854           }
7855           function setCacheHas2(value) {
7856             return this.__data__.has(value);
7857           }
7858           SetCache2.prototype.add = SetCache2.prototype.push = setCacheAdd2;
7859           SetCache2.prototype.has = setCacheHas2;
7860           function Stack2(entries) {
7861             var data = this.__data__ = new ListCache2(entries);
7862             this.size = data.size;
7863           }
7864           function stackClear2() {
7865             this.__data__ = new ListCache2();
7866             this.size = 0;
7867           }
7868           function stackDelete2(key) {
7869             var data = this.__data__, result2 = data["delete"](key);
7870             this.size = data.size;
7871             return result2;
7872           }
7873           function stackGet2(key) {
7874             return this.__data__.get(key);
7875           }
7876           function stackHas2(key) {
7877             return this.__data__.has(key);
7878           }
7879           function stackSet2(key, value) {
7880             var data = this.__data__;
7881             if (data instanceof ListCache2) {
7882               var pairs2 = data.__data__;
7883               if (!Map3 || pairs2.length < LARGE_ARRAY_SIZE2 - 1) {
7884                 pairs2.push([key, value]);
7885                 this.size = ++data.size;
7886                 return this;
7887               }
7888               data = this.__data__ = new MapCache2(pairs2);
7889             }
7890             data.set(key, value);
7891             this.size = data.size;
7892             return this;
7893           }
7894           Stack2.prototype.clear = stackClear2;
7895           Stack2.prototype["delete"] = stackDelete2;
7896           Stack2.prototype.get = stackGet2;
7897           Stack2.prototype.has = stackHas2;
7898           Stack2.prototype.set = stackSet2;
7899           function arrayLikeKeys2(value, inherited) {
7900             var isArr = isArray2(value), isArg = !isArr && isArguments2(value), isBuff = !isArr && !isArg && isBuffer2(value), isType = !isArr && !isArg && !isBuff && isTypedArray2(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes2(value.length, String2) : [], length = result2.length;
7901             for (var key in value) {
7902               if ((inherited || hasOwnProperty10.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
7903               (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
7904               isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
7905               isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
7906               isIndex2(key, length)))) {
7907                 result2.push(key);
7908               }
7909             }
7910             return result2;
7911           }
7912           function arraySample(array2) {
7913             var length = array2.length;
7914             return length ? array2[baseRandom(0, length - 1)] : undefined2;
7915           }
7916           function arraySampleSize(array2, n3) {
7917             return shuffleSelf(copyArray(array2), baseClamp(n3, 0, array2.length));
7918           }
7919           function arrayShuffle(array2) {
7920             return shuffleSelf(copyArray(array2));
7921           }
7922           function assignMergeValue(object, key, value) {
7923             if (value !== undefined2 && !eq2(object[key], value) || value === undefined2 && !(key in object)) {
7924               baseAssignValue(object, key, value);
7925             }
7926           }
7927           function assignValue(object, key, value) {
7928             var objValue = object[key];
7929             if (!(hasOwnProperty10.call(object, key) && eq2(objValue, value)) || value === undefined2 && !(key in object)) {
7930               baseAssignValue(object, key, value);
7931             }
7932           }
7933           function assocIndexOf2(array2, key) {
7934             var length = array2.length;
7935             while (length--) {
7936               if (eq2(array2[length][0], key)) {
7937                 return length;
7938               }
7939             }
7940             return -1;
7941           }
7942           function baseAggregator(collection, setter, iteratee2, accumulator) {
7943             baseEach(collection, function(value, key, collection2) {
7944               setter(accumulator, value, iteratee2(value), collection2);
7945             });
7946             return accumulator;
7947           }
7948           function baseAssign(object, source) {
7949             return object && copyObject(source, keys2(source), object);
7950           }
7951           function baseAssignIn(object, source) {
7952             return object && copyObject(source, keysIn(source), object);
7953           }
7954           function baseAssignValue(object, key, value) {
7955             if (key == "__proto__" && defineProperty) {
7956               defineProperty(object, key, {
7957                 "configurable": true,
7958                 "enumerable": true,
7959                 "value": value,
7960                 "writable": true
7961               });
7962             } else {
7963               object[key] = value;
7964             }
7965           }
7966           function baseAt(object, paths) {
7967             var index = -1, length = paths.length, result2 = Array2(length), skip = object == null;
7968             while (++index < length) {
7969               result2[index] = skip ? undefined2 : get4(object, paths[index]);
7970             }
7971             return result2;
7972           }
7973           function baseClamp(number3, lower2, upper) {
7974             if (number3 === number3) {
7975               if (upper !== undefined2) {
7976                 number3 = number3 <= upper ? number3 : upper;
7977               }
7978               if (lower2 !== undefined2) {
7979                 number3 = number3 >= lower2 ? number3 : lower2;
7980               }
7981             }
7982             return number3;
7983           }
7984           function baseClone(value, bitmask, customizer, key, object, stack) {
7985             var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
7986             if (customizer) {
7987               result2 = object ? customizer(value, key, object, stack) : customizer(value);
7988             }
7989             if (result2 !== undefined2) {
7990               return result2;
7991             }
7992             if (!isObject3(value)) {
7993               return value;
7994             }
7995             var isArr = isArray2(value);
7996             if (isArr) {
7997               result2 = initCloneArray(value);
7998               if (!isDeep) {
7999                 return copyArray(value, result2);
8000               }
8001             } else {
8002               var tag = getTag2(value), isFunc = tag == funcTag3 || tag == genTag2;
8003               if (isBuffer2(value)) {
8004                 return cloneBuffer(value, isDeep);
8005               }
8006               if (tag == objectTag4 || tag == argsTag4 || isFunc && !object) {
8007                 result2 = isFlat || isFunc ? {} : initCloneObject(value);
8008                 if (!isDeep) {
8009                   return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value));
8010                 }
8011               } else {
8012                 if (!cloneableTags[tag]) {
8013                   return object ? value : {};
8014                 }
8015                 result2 = initCloneByTag(value, tag, isDeep);
8016               }
8017             }
8018             stack || (stack = new Stack2());
8019             var stacked = stack.get(value);
8020             if (stacked) {
8021               return stacked;
8022             }
8023             stack.set(value, result2);
8024             if (isSet(value)) {
8025               value.forEach(function(subValue) {
8026                 result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
8027               });
8028             } else if (isMap(value)) {
8029               value.forEach(function(subValue, key2) {
8030                 result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
8031               });
8032             }
8033             var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys2 : isFlat ? keysIn : keys2;
8034             var props = isArr ? undefined2 : keysFunc(value);
8035             arrayEach(props || value, function(subValue, key2) {
8036               if (props) {
8037                 key2 = subValue;
8038                 subValue = value[key2];
8039               }
8040               assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
8041             });
8042             return result2;
8043           }
8044           function baseConforms(source) {
8045             var props = keys2(source);
8046             return function(object) {
8047               return baseConformsTo(object, source, props);
8048             };
8049           }
8050           function baseConformsTo(object, source, props) {
8051             var length = props.length;
8052             if (object == null) {
8053               return !length;
8054             }
8055             object = Object2(object);
8056             while (length--) {
8057               var key = props[length], predicate = source[key], value = object[key];
8058               if (value === undefined2 && !(key in object) || !predicate(value)) {
8059                 return false;
8060               }
8061             }
8062             return true;
8063           }
8064           function baseDelay(func, wait, args) {
8065             if (typeof func != "function") {
8066               throw new TypeError2(FUNC_ERROR_TEXT3);
8067             }
8068             return setTimeout2(function() {
8069               func.apply(undefined2, args);
8070             }, wait);
8071           }
8072           function baseDifference(array2, values2, iteratee2, comparator) {
8073             var index = -1, includes2 = arrayIncludes, isCommon = true, length = array2.length, result2 = [], valuesLength = values2.length;
8074             if (!length) {
8075               return result2;
8076             }
8077             if (iteratee2) {
8078               values2 = arrayMap2(values2, baseUnary2(iteratee2));
8079             }
8080             if (comparator) {
8081               includes2 = arrayIncludesWith;
8082               isCommon = false;
8083             } else if (values2.length >= LARGE_ARRAY_SIZE2) {
8084               includes2 = cacheHas2;
8085               isCommon = false;
8086               values2 = new SetCache2(values2);
8087             }
8088             outer:
8089               while (++index < length) {
8090                 var value = array2[index], computed = iteratee2 == null ? value : iteratee2(value);
8091                 value = comparator || value !== 0 ? value : 0;
8092                 if (isCommon && computed === computed) {
8093                   var valuesIndex = valuesLength;
8094                   while (valuesIndex--) {
8095                     if (values2[valuesIndex] === computed) {
8096                       continue outer;
8097                     }
8098                   }
8099                   result2.push(value);
8100                 } else if (!includes2(values2, computed, comparator)) {
8101                   result2.push(value);
8102                 }
8103               }
8104             return result2;
8105           }
8106           var baseEach = createBaseEach(baseForOwn);
8107           var baseEachRight = createBaseEach(baseForOwnRight, true);
8108           function baseEvery(collection, predicate) {
8109             var result2 = true;
8110             baseEach(collection, function(value, index, collection2) {
8111               result2 = !!predicate(value, index, collection2);
8112               return result2;
8113             });
8114             return result2;
8115           }
8116           function baseExtremum(array2, iteratee2, comparator) {
8117             var index = -1, length = array2.length;
8118             while (++index < length) {
8119               var value = array2[index], current = iteratee2(value);
8120               if (current != null && (computed === undefined2 ? current === current && !isSymbol2(current) : comparator(current, computed))) {
8121                 var computed = current, result2 = value;
8122               }
8123             }
8124             return result2;
8125           }
8126           function baseFill(array2, value, start2, end) {
8127             var length = array2.length;
8128             start2 = toInteger(start2);
8129             if (start2 < 0) {
8130               start2 = -start2 > length ? 0 : length + start2;
8131             }
8132             end = end === undefined2 || end > length ? length : toInteger(end);
8133             if (end < 0) {
8134               end += length;
8135             }
8136             end = start2 > end ? 0 : toLength(end);
8137             while (start2 < end) {
8138               array2[start2++] = value;
8139             }
8140             return array2;
8141           }
8142           function baseFilter(collection, predicate) {
8143             var result2 = [];
8144             baseEach(collection, function(value, index, collection2) {
8145               if (predicate(value, index, collection2)) {
8146                 result2.push(value);
8147               }
8148             });
8149             return result2;
8150           }
8151           function baseFlatten(array2, depth, predicate, isStrict, result2) {
8152             var index = -1, length = array2.length;
8153             predicate || (predicate = isFlattenable);
8154             result2 || (result2 = []);
8155             while (++index < length) {
8156               var value = array2[index];
8157               if (depth > 0 && predicate(value)) {
8158                 if (depth > 1) {
8159                   baseFlatten(value, depth - 1, predicate, isStrict, result2);
8160                 } else {
8161                   arrayPush2(result2, value);
8162                 }
8163               } else if (!isStrict) {
8164                 result2[result2.length] = value;
8165               }
8166             }
8167             return result2;
8168           }
8169           var baseFor = createBaseFor();
8170           var baseForRight = createBaseFor(true);
8171           function baseForOwn(object, iteratee2) {
8172             return object && baseFor(object, iteratee2, keys2);
8173           }
8174           function baseForOwnRight(object, iteratee2) {
8175             return object && baseForRight(object, iteratee2, keys2);
8176           }
8177           function baseFunctions(object, props) {
8178             return arrayFilter2(props, function(key) {
8179               return isFunction2(object[key]);
8180             });
8181           }
8182           function baseGet(object, path) {
8183             path = castPath(path, object);
8184             var index = 0, length = path.length;
8185             while (object != null && index < length) {
8186               object = object[toKey(path[index++])];
8187             }
8188             return index && index == length ? object : undefined2;
8189           }
8190           function baseGetAllKeys2(object, keysFunc, symbolsFunc) {
8191             var result2 = keysFunc(object);
8192             return isArray2(object) ? result2 : arrayPush2(result2, symbolsFunc(object));
8193           }
8194           function baseGetTag2(value) {
8195             if (value == null) {
8196               return value === undefined2 ? undefinedTag2 : nullTag2;
8197             }
8198             return symToStringTag3 && symToStringTag3 in Object2(value) ? getRawTag2(value) : objectToString2(value);
8199           }
8200           function baseGt(value, other) {
8201             return value > other;
8202           }
8203           function baseHas(object, key) {
8204             return object != null && hasOwnProperty10.call(object, key);
8205           }
8206           function baseHasIn(object, key) {
8207             return object != null && key in Object2(object);
8208           }
8209           function baseInRange(number3, start2, end) {
8210             return number3 >= nativeMin2(start2, end) && number3 < nativeMax2(start2, end);
8211           }
8212           function baseIntersection(arrays, iteratee2, comparator) {
8213             var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = [];
8214             while (othIndex--) {
8215               var array2 = arrays[othIndex];
8216               if (othIndex && iteratee2) {
8217                 array2 = arrayMap2(array2, baseUnary2(iteratee2));
8218               }
8219               maxLength = nativeMin2(array2.length, maxLength);
8220               caches[othIndex] = !comparator && (iteratee2 || length >= 120 && array2.length >= 120) ? new SetCache2(othIndex && array2) : undefined2;
8221             }
8222             array2 = arrays[0];
8223             var index = -1, seen = caches[0];
8224             outer:
8225               while (++index < length && result2.length < maxLength) {
8226                 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
8227                 value = comparator || value !== 0 ? value : 0;
8228                 if (!(seen ? cacheHas2(seen, computed) : includes2(result2, computed, comparator))) {
8229                   othIndex = othLength;
8230                   while (--othIndex) {
8231                     var cache = caches[othIndex];
8232                     if (!(cache ? cacheHas2(cache, computed) : includes2(arrays[othIndex], computed, comparator))) {
8233                       continue outer;
8234                     }
8235                   }
8236                   if (seen) {
8237                     seen.push(computed);
8238                   }
8239                   result2.push(value);
8240                 }
8241               }
8242             return result2;
8243           }
8244           function baseInverter(object, setter, iteratee2, accumulator) {
8245             baseForOwn(object, function(value, key, object2) {
8246               setter(accumulator, iteratee2(value), key, object2);
8247             });
8248             return accumulator;
8249           }
8250           function baseInvoke(object, path, args) {
8251             path = castPath(path, object);
8252             object = parent(object, path);
8253             var func = object == null ? object : object[toKey(last(path))];
8254             return func == null ? undefined2 : apply(func, object, args);
8255           }
8256           function baseIsArguments2(value) {
8257             return isObjectLike2(value) && baseGetTag2(value) == argsTag4;
8258           }
8259           function baseIsArrayBuffer(value) {
8260             return isObjectLike2(value) && baseGetTag2(value) == arrayBufferTag3;
8261           }
8262           function baseIsDate(value) {
8263             return isObjectLike2(value) && baseGetTag2(value) == dateTag3;
8264           }
8265           function baseIsEqual2(value, other, bitmask, customizer, stack) {
8266             if (value === other) {
8267               return true;
8268             }
8269             if (value == null || other == null || !isObjectLike2(value) && !isObjectLike2(other)) {
8270               return value !== value && other !== other;
8271             }
8272             return baseIsEqualDeep2(value, other, bitmask, customizer, baseIsEqual2, stack);
8273           }
8274           function baseIsEqualDeep2(object, other, bitmask, customizer, equalFunc, stack) {
8275             var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag3 : getTag2(object), othTag = othIsArr ? arrayTag3 : getTag2(other);
8276             objTag = objTag == argsTag4 ? objectTag4 : objTag;
8277             othTag = othTag == argsTag4 ? objectTag4 : othTag;
8278             var objIsObj = objTag == objectTag4, othIsObj = othTag == objectTag4, isSameTag = objTag == othTag;
8279             if (isSameTag && isBuffer2(object)) {
8280               if (!isBuffer2(other)) {
8281                 return false;
8282               }
8283               objIsArr = true;
8284               objIsObj = false;
8285             }
8286             if (isSameTag && !objIsObj) {
8287               stack || (stack = new Stack2());
8288               return objIsArr || isTypedArray2(object) ? equalArrays2(object, other, bitmask, customizer, equalFunc, stack) : equalByTag2(object, other, objTag, bitmask, customizer, equalFunc, stack);
8289             }
8290             if (!(bitmask & COMPARE_PARTIAL_FLAG5)) {
8291               var objIsWrapped = objIsObj && hasOwnProperty10.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty10.call(other, "__wrapped__");
8292               if (objIsWrapped || othIsWrapped) {
8293                 var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
8294                 stack || (stack = new Stack2());
8295                 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
8296               }
8297             }
8298             if (!isSameTag) {
8299               return false;
8300             }
8301             stack || (stack = new Stack2());
8302             return equalObjects2(object, other, bitmask, customizer, equalFunc, stack);
8303           }
8304           function baseIsMap(value) {
8305             return isObjectLike2(value) && getTag2(value) == mapTag4;
8306           }
8307           function baseIsMatch(object, source, matchData, customizer) {
8308             var index = matchData.length, length = index, noCustomizer = !customizer;
8309             if (object == null) {
8310               return !length;
8311             }
8312             object = Object2(object);
8313             while (index--) {
8314               var data = matchData[index];
8315               if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
8316                 return false;
8317               }
8318             }
8319             while (++index < length) {
8320               data = matchData[index];
8321               var key = data[0], objValue = object[key], srcValue = data[1];
8322               if (noCustomizer && data[2]) {
8323                 if (objValue === undefined2 && !(key in object)) {
8324                   return false;
8325                 }
8326               } else {
8327                 var stack = new Stack2();
8328                 if (customizer) {
8329                   var result2 = customizer(objValue, srcValue, key, object, source, stack);
8330                 }
8331                 if (!(result2 === undefined2 ? baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3, customizer, stack) : result2)) {
8332                   return false;
8333                 }
8334               }
8335             }
8336             return true;
8337           }
8338           function baseIsNative2(value) {
8339             if (!isObject3(value) || isMasked2(value)) {
8340               return false;
8341             }
8342             var pattern = isFunction2(value) ? reIsNative2 : reIsHostCtor2;
8343             return pattern.test(toSource2(value));
8344           }
8345           function baseIsRegExp(value) {
8346             return isObjectLike2(value) && baseGetTag2(value) == regexpTag3;
8347           }
8348           function baseIsSet(value) {
8349             return isObjectLike2(value) && getTag2(value) == setTag4;
8350           }
8351           function baseIsTypedArray2(value) {
8352             return isObjectLike2(value) && isLength2(value.length) && !!typedArrayTags2[baseGetTag2(value)];
8353           }
8354           function baseIteratee(value) {
8355             if (typeof value == "function") {
8356               return value;
8357             }
8358             if (value == null) {
8359               return identity4;
8360             }
8361             if (typeof value == "object") {
8362               return isArray2(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
8363             }
8364             return property(value);
8365           }
8366           function baseKeys2(object) {
8367             if (!isPrototype2(object)) {
8368               return nativeKeys2(object);
8369             }
8370             var result2 = [];
8371             for (var key in Object2(object)) {
8372               if (hasOwnProperty10.call(object, key) && key != "constructor") {
8373                 result2.push(key);
8374               }
8375             }
8376             return result2;
8377           }
8378           function baseKeysIn(object) {
8379             if (!isObject3(object)) {
8380               return nativeKeysIn(object);
8381             }
8382             var isProto = isPrototype2(object), result2 = [];
8383             for (var key in object) {
8384               if (!(key == "constructor" && (isProto || !hasOwnProperty10.call(object, key)))) {
8385                 result2.push(key);
8386               }
8387             }
8388             return result2;
8389           }
8390           function baseLt(value, other) {
8391             return value < other;
8392           }
8393           function baseMap(collection, iteratee2) {
8394             var index = -1, result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
8395             baseEach(collection, function(value, key, collection2) {
8396               result2[++index] = iteratee2(value, key, collection2);
8397             });
8398             return result2;
8399           }
8400           function baseMatches(source) {
8401             var matchData = getMatchData(source);
8402             if (matchData.length == 1 && matchData[0][2]) {
8403               return matchesStrictComparable(matchData[0][0], matchData[0][1]);
8404             }
8405             return function(object) {
8406               return object === source || baseIsMatch(object, source, matchData);
8407             };
8408           }
8409           function baseMatchesProperty(path, srcValue) {
8410             if (isKey(path) && isStrictComparable(srcValue)) {
8411               return matchesStrictComparable(toKey(path), srcValue);
8412             }
8413             return function(object) {
8414               var objValue = get4(object, path);
8415               return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3);
8416             };
8417           }
8418           function baseMerge(object, source, srcIndex, customizer, stack) {
8419             if (object === source) {
8420               return;
8421             }
8422             baseFor(source, function(srcValue, key) {
8423               stack || (stack = new Stack2());
8424               if (isObject3(srcValue)) {
8425                 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
8426               } else {
8427                 var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2;
8428                 if (newValue === undefined2) {
8429                   newValue = srcValue;
8430                 }
8431                 assignMergeValue(object, key, newValue);
8432               }
8433             }, keysIn);
8434           }
8435           function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
8436             var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
8437             if (stacked) {
8438               assignMergeValue(object, key, stacked);
8439               return;
8440             }
8441             var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2;
8442             var isCommon = newValue === undefined2;
8443             if (isCommon) {
8444               var isArr = isArray2(srcValue), isBuff = !isArr && isBuffer2(srcValue), isTyped = !isArr && !isBuff && isTypedArray2(srcValue);
8445               newValue = srcValue;
8446               if (isArr || isBuff || isTyped) {
8447                 if (isArray2(objValue)) {
8448                   newValue = objValue;
8449                 } else if (isArrayLikeObject(objValue)) {
8450                   newValue = copyArray(objValue);
8451                 } else if (isBuff) {
8452                   isCommon = false;
8453                   newValue = cloneBuffer(srcValue, true);
8454                 } else if (isTyped) {
8455                   isCommon = false;
8456                   newValue = cloneTypedArray(srcValue, true);
8457                 } else {
8458                   newValue = [];
8459                 }
8460               } else if (isPlainObject(srcValue) || isArguments2(srcValue)) {
8461                 newValue = objValue;
8462                 if (isArguments2(objValue)) {
8463                   newValue = toPlainObject(objValue);
8464                 } else if (!isObject3(objValue) || isFunction2(objValue)) {
8465                   newValue = initCloneObject(srcValue);
8466                 }
8467               } else {
8468                 isCommon = false;
8469               }
8470             }
8471             if (isCommon) {
8472               stack.set(srcValue, newValue);
8473               mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
8474               stack["delete"](srcValue);
8475             }
8476             assignMergeValue(object, key, newValue);
8477           }
8478           function baseNth(array2, n3) {
8479             var length = array2.length;
8480             if (!length) {
8481               return;
8482             }
8483             n3 += n3 < 0 ? length : 0;
8484             return isIndex2(n3, length) ? array2[n3] : undefined2;
8485           }
8486           function baseOrderBy(collection, iteratees, orders) {
8487             if (iteratees.length) {
8488               iteratees = arrayMap2(iteratees, function(iteratee2) {
8489                 if (isArray2(iteratee2)) {
8490                   return function(value) {
8491                     return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
8492                   };
8493                 }
8494                 return iteratee2;
8495               });
8496             } else {
8497               iteratees = [identity4];
8498             }
8499             var index = -1;
8500             iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
8501             var result2 = baseMap(collection, function(value, key, collection2) {
8502               var criteria = arrayMap2(iteratees, function(iteratee2) {
8503                 return iteratee2(value);
8504               });
8505               return { "criteria": criteria, "index": ++index, "value": value };
8506             });
8507             return baseSortBy(result2, function(object, other) {
8508               return compareMultiple(object, other, orders);
8509             });
8510           }
8511           function basePick(object, paths) {
8512             return basePickBy(object, paths, function(value, path) {
8513               return hasIn(object, path);
8514             });
8515           }
8516           function basePickBy(object, paths, predicate) {
8517             var index = -1, length = paths.length, result2 = {};
8518             while (++index < length) {
8519               var path = paths[index], value = baseGet(object, path);
8520               if (predicate(value, path)) {
8521                 baseSet(result2, castPath(path, object), value);
8522               }
8523             }
8524             return result2;
8525           }
8526           function basePropertyDeep(path) {
8527             return function(object) {
8528               return baseGet(object, path);
8529             };
8530           }
8531           function basePullAll(array2, values2, iteratee2, comparator) {
8532             var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values2.length, seen = array2;
8533             if (array2 === values2) {
8534               values2 = copyArray(values2);
8535             }
8536             if (iteratee2) {
8537               seen = arrayMap2(array2, baseUnary2(iteratee2));
8538             }
8539             while (++index < length) {
8540               var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value;
8541               while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) {
8542                 if (seen !== array2) {
8543                   splice2.call(seen, fromIndex, 1);
8544                 }
8545                 splice2.call(array2, fromIndex, 1);
8546               }
8547             }
8548             return array2;
8549           }
8550           function basePullAt(array2, indexes) {
8551             var length = array2 ? indexes.length : 0, lastIndex = length - 1;
8552             while (length--) {
8553               var index = indexes[length];
8554               if (length == lastIndex || index !== previous) {
8555                 var previous = index;
8556                 if (isIndex2(index)) {
8557                   splice2.call(array2, index, 1);
8558                 } else {
8559                   baseUnset(array2, index);
8560                 }
8561               }
8562             }
8563             return array2;
8564           }
8565           function baseRandom(lower2, upper) {
8566             return lower2 + nativeFloor(nativeRandom() * (upper - lower2 + 1));
8567           }
8568           function baseRange(start2, end, step, fromRight) {
8569             var index = -1, length = nativeMax2(nativeCeil((end - start2) / (step || 1)), 0), result2 = Array2(length);
8570             while (length--) {
8571               result2[fromRight ? length : ++index] = start2;
8572               start2 += step;
8573             }
8574             return result2;
8575           }
8576           function baseRepeat(string, n3) {
8577             var result2 = "";
8578             if (!string || n3 < 1 || n3 > MAX_SAFE_INTEGER3) {
8579               return result2;
8580             }
8581             do {
8582               if (n3 % 2) {
8583                 result2 += string;
8584               }
8585               n3 = nativeFloor(n3 / 2);
8586               if (n3) {
8587                 string += string;
8588               }
8589             } while (n3);
8590             return result2;
8591           }
8592           function baseRest(func, start2) {
8593             return setToString(overRest(func, start2, identity4), func + "");
8594           }
8595           function baseSample(collection) {
8596             return arraySample(values(collection));
8597           }
8598           function baseSampleSize(collection, n3) {
8599             var array2 = values(collection);
8600             return shuffleSelf(array2, baseClamp(n3, 0, array2.length));
8601           }
8602           function baseSet(object, path, value, customizer) {
8603             if (!isObject3(object)) {
8604               return object;
8605             }
8606             path = castPath(path, object);
8607             var index = -1, length = path.length, lastIndex = length - 1, nested = object;
8608             while (nested != null && ++index < length) {
8609               var key = toKey(path[index]), newValue = value;
8610               if (key === "__proto__" || key === "constructor" || key === "prototype") {
8611                 return object;
8612               }
8613               if (index != lastIndex) {
8614                 var objValue = nested[key];
8615                 newValue = customizer ? customizer(objValue, key, nested) : undefined2;
8616                 if (newValue === undefined2) {
8617                   newValue = isObject3(objValue) ? objValue : isIndex2(path[index + 1]) ? [] : {};
8618                 }
8619               }
8620               assignValue(nested, key, newValue);
8621               nested = nested[key];
8622             }
8623             return object;
8624           }
8625           var baseSetData = !metaMap ? identity4 : function(func, data) {
8626             metaMap.set(func, data);
8627             return func;
8628           };
8629           var baseSetToString = !defineProperty ? identity4 : function(func, string) {
8630             return defineProperty(func, "toString", {
8631               "configurable": true,
8632               "enumerable": false,
8633               "value": constant(string),
8634               "writable": true
8635             });
8636           };
8637           function baseShuffle(collection) {
8638             return shuffleSelf(values(collection));
8639           }
8640           function baseSlice(array2, start2, end) {
8641             var index = -1, length = array2.length;
8642             if (start2 < 0) {
8643               start2 = -start2 > length ? 0 : length + start2;
8644             }
8645             end = end > length ? length : end;
8646             if (end < 0) {
8647               end += length;
8648             }
8649             length = start2 > end ? 0 : end - start2 >>> 0;
8650             start2 >>>= 0;
8651             var result2 = Array2(length);
8652             while (++index < length) {
8653               result2[index] = array2[index + start2];
8654             }
8655             return result2;
8656           }
8657           function baseSome(collection, predicate) {
8658             var result2;
8659             baseEach(collection, function(value, index, collection2) {
8660               result2 = predicate(value, index, collection2);
8661               return !result2;
8662             });
8663             return !!result2;
8664           }
8665           function baseSortedIndex(array2, value, retHighest) {
8666             var low = 0, high = array2 == null ? low : array2.length;
8667             if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
8668               while (low < high) {
8669                 var mid = low + high >>> 1, computed = array2[mid];
8670                 if (computed !== null && !isSymbol2(computed) && (retHighest ? computed <= value : computed < value)) {
8671                   low = mid + 1;
8672                 } else {
8673                   high = mid;
8674                 }
8675               }
8676               return high;
8677             }
8678             return baseSortedIndexBy(array2, value, identity4, retHighest);
8679           }
8680           function baseSortedIndexBy(array2, value, iteratee2, retHighest) {
8681             var low = 0, high = array2 == null ? 0 : array2.length;
8682             if (high === 0) {
8683               return 0;
8684             }
8685             value = iteratee2(value);
8686             var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol2(value), valIsUndefined = value === undefined2;
8687             while (low < high) {
8688               var mid = nativeFloor((low + high) / 2), computed = iteratee2(array2[mid]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol2(computed);
8689               if (valIsNaN) {
8690                 var setLow = retHighest || othIsReflexive;
8691               } else if (valIsUndefined) {
8692                 setLow = othIsReflexive && (retHighest || othIsDefined);
8693               } else if (valIsNull) {
8694                 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
8695               } else if (valIsSymbol) {
8696                 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
8697               } else if (othIsNull || othIsSymbol) {
8698                 setLow = false;
8699               } else {
8700                 setLow = retHighest ? computed <= value : computed < value;
8701               }
8702               if (setLow) {
8703                 low = mid + 1;
8704               } else {
8705                 high = mid;
8706               }
8707             }
8708             return nativeMin2(high, MAX_ARRAY_INDEX);
8709           }
8710           function baseSortedUniq(array2, iteratee2) {
8711             var index = -1, length = array2.length, resIndex = 0, result2 = [];
8712             while (++index < length) {
8713               var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
8714               if (!index || !eq2(computed, seen)) {
8715                 var seen = computed;
8716                 result2[resIndex++] = value === 0 ? 0 : value;
8717               }
8718             }
8719             return result2;
8720           }
8721           function baseToNumber(value) {
8722             if (typeof value == "number") {
8723               return value;
8724             }
8725             if (isSymbol2(value)) {
8726               return NAN2;
8727             }
8728             return +value;
8729           }
8730           function baseToString2(value) {
8731             if (typeof value == "string") {
8732               return value;
8733             }
8734             if (isArray2(value)) {
8735               return arrayMap2(value, baseToString2) + "";
8736             }
8737             if (isSymbol2(value)) {
8738               return symbolToString2 ? symbolToString2.call(value) : "";
8739             }
8740             var result2 = value + "";
8741             return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
8742           }
8743           function baseUniq(array2, iteratee2, comparator) {
8744             var index = -1, includes2 = arrayIncludes, length = array2.length, isCommon = true, result2 = [], seen = result2;
8745             if (comparator) {
8746               isCommon = false;
8747               includes2 = arrayIncludesWith;
8748             } else if (length >= LARGE_ARRAY_SIZE2) {
8749               var set4 = iteratee2 ? null : createSet(array2);
8750               if (set4) {
8751                 return setToArray2(set4);
8752               }
8753               isCommon = false;
8754               includes2 = cacheHas2;
8755               seen = new SetCache2();
8756             } else {
8757               seen = iteratee2 ? [] : result2;
8758             }
8759             outer:
8760               while (++index < length) {
8761                 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
8762                 value = comparator || value !== 0 ? value : 0;
8763                 if (isCommon && computed === computed) {
8764                   var seenIndex = seen.length;
8765                   while (seenIndex--) {
8766                     if (seen[seenIndex] === computed) {
8767                       continue outer;
8768                     }
8769                   }
8770                   if (iteratee2) {
8771                     seen.push(computed);
8772                   }
8773                   result2.push(value);
8774                 } else if (!includes2(seen, computed, comparator)) {
8775                   if (seen !== result2) {
8776                     seen.push(computed);
8777                   }
8778                   result2.push(value);
8779                 }
8780               }
8781             return result2;
8782           }
8783           function baseUnset(object, path) {
8784             path = castPath(path, object);
8785             object = parent(object, path);
8786             return object == null || delete object[toKey(last(path))];
8787           }
8788           function baseUpdate(object, path, updater, customizer) {
8789             return baseSet(object, path, updater(baseGet(object, path)), customizer);
8790           }
8791           function baseWhile(array2, predicate, isDrop, fromRight) {
8792             var length = array2.length, index = fromRight ? length : -1;
8793             while ((fromRight ? index-- : ++index < length) && predicate(array2[index], index, array2)) {
8794             }
8795             return isDrop ? baseSlice(array2, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array2, fromRight ? index + 1 : 0, fromRight ? length : index);
8796           }
8797           function baseWrapperValue(value, actions) {
8798             var result2 = value;
8799             if (result2 instanceof LazyWrapper) {
8800               result2 = result2.value();
8801             }
8802             return arrayReduce(actions, function(result3, action) {
8803               return action.func.apply(action.thisArg, arrayPush2([result3], action.args));
8804             }, result2);
8805           }
8806           function baseXor(arrays, iteratee2, comparator) {
8807             var length = arrays.length;
8808             if (length < 2) {
8809               return length ? baseUniq(arrays[0]) : [];
8810             }
8811             var index = -1, result2 = Array2(length);
8812             while (++index < length) {
8813               var array2 = arrays[index], othIndex = -1;
8814               while (++othIndex < length) {
8815                 if (othIndex != index) {
8816                   result2[index] = baseDifference(result2[index] || array2, arrays[othIndex], iteratee2, comparator);
8817                 }
8818               }
8819             }
8820             return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
8821           }
8822           function baseZipObject(props, values2, assignFunc) {
8823             var index = -1, length = props.length, valsLength = values2.length, result2 = {};
8824             while (++index < length) {
8825               var value = index < valsLength ? values2[index] : undefined2;
8826               assignFunc(result2, props[index], value);
8827             }
8828             return result2;
8829           }
8830           function castArrayLikeObject(value) {
8831             return isArrayLikeObject(value) ? value : [];
8832           }
8833           function castFunction(value) {
8834             return typeof value == "function" ? value : identity4;
8835           }
8836           function castPath(value, object) {
8837             if (isArray2(value)) {
8838               return value;
8839             }
8840             return isKey(value, object) ? [value] : stringToPath(toString2(value));
8841           }
8842           var castRest = baseRest;
8843           function castSlice(array2, start2, end) {
8844             var length = array2.length;
8845             end = end === undefined2 ? length : end;
8846             return !start2 && end >= length ? array2 : baseSlice(array2, start2, end);
8847           }
8848           var clearTimeout2 = ctxClearTimeout || function(id2) {
8849             return root3.clearTimeout(id2);
8850           };
8851           function cloneBuffer(buffer, isDeep) {
8852             if (isDeep) {
8853               return buffer.slice();
8854             }
8855             var length = buffer.length, result2 = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
8856             buffer.copy(result2);
8857             return result2;
8858           }
8859           function cloneArrayBuffer(arrayBuffer) {
8860             var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
8861             new Uint8Array3(result2).set(new Uint8Array3(arrayBuffer));
8862             return result2;
8863           }
8864           function cloneDataView(dataView, isDeep) {
8865             var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
8866             return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
8867           }
8868           function cloneRegExp(regexp) {
8869             var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp));
8870             result2.lastIndex = regexp.lastIndex;
8871             return result2;
8872           }
8873           function cloneSymbol(symbol) {
8874             return symbolValueOf2 ? Object2(symbolValueOf2.call(symbol)) : {};
8875           }
8876           function cloneTypedArray(typedArray, isDeep) {
8877             var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
8878             return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
8879           }
8880           function compareAscending(value, other) {
8881             if (value !== other) {
8882               var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol2(value);
8883               var othIsDefined = other !== undefined2, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol2(other);
8884               if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
8885                 return 1;
8886               }
8887               if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
8888                 return -1;
8889               }
8890             }
8891             return 0;
8892           }
8893           function compareMultiple(object, other, orders) {
8894             var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
8895             while (++index < length) {
8896               var result2 = compareAscending(objCriteria[index], othCriteria[index]);
8897               if (result2) {
8898                 if (index >= ordersLength) {
8899                   return result2;
8900                 }
8901                 var order = orders[index];
8902                 return result2 * (order == "desc" ? -1 : 1);
8903               }
8904             }
8905             return object.index - other.index;
8906           }
8907           function composeArgs(args, partials, holders, isCurried) {
8908             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;
8909             while (++leftIndex < leftLength) {
8910               result2[leftIndex] = partials[leftIndex];
8911             }
8912             while (++argsIndex < holdersLength) {
8913               if (isUncurried || argsIndex < argsLength) {
8914                 result2[holders[argsIndex]] = args[argsIndex];
8915               }
8916             }
8917             while (rangeLength--) {
8918               result2[leftIndex++] = args[argsIndex++];
8919             }
8920             return result2;
8921           }
8922           function composeArgsRight(args, partials, holders, isCurried) {
8923             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;
8924             while (++argsIndex < rangeLength) {
8925               result2[argsIndex] = args[argsIndex];
8926             }
8927             var offset = argsIndex;
8928             while (++rightIndex < rightLength) {
8929               result2[offset + rightIndex] = partials[rightIndex];
8930             }
8931             while (++holdersIndex < holdersLength) {
8932               if (isUncurried || argsIndex < argsLength) {
8933                 result2[offset + holders[holdersIndex]] = args[argsIndex++];
8934               }
8935             }
8936             return result2;
8937           }
8938           function copyArray(source, array2) {
8939             var index = -1, length = source.length;
8940             array2 || (array2 = Array2(length));
8941             while (++index < length) {
8942               array2[index] = source[index];
8943             }
8944             return array2;
8945           }
8946           function copyObject(source, props, object, customizer) {
8947             var isNew = !object;
8948             object || (object = {});
8949             var index = -1, length = props.length;
8950             while (++index < length) {
8951               var key = props[index];
8952               var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2;
8953               if (newValue === undefined2) {
8954                 newValue = source[key];
8955               }
8956               if (isNew) {
8957                 baseAssignValue(object, key, newValue);
8958               } else {
8959                 assignValue(object, key, newValue);
8960               }
8961             }
8962             return object;
8963           }
8964           function copySymbols(source, object) {
8965             return copyObject(source, getSymbols2(source), object);
8966           }
8967           function copySymbolsIn(source, object) {
8968             return copyObject(source, getSymbolsIn(source), object);
8969           }
8970           function createAggregator(setter, initializer) {
8971             return function(collection, iteratee2) {
8972               var func = isArray2(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
8973               return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
8974             };
8975           }
8976           function createAssigner(assigner) {
8977             return baseRest(function(object, sources) {
8978               var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined2, guard = length > 2 ? sources[2] : undefined2;
8979               customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : undefined2;
8980               if (guard && isIterateeCall(sources[0], sources[1], guard)) {
8981                 customizer = length < 3 ? undefined2 : customizer;
8982                 length = 1;
8983               }
8984               object = Object2(object);
8985               while (++index < length) {
8986                 var source = sources[index];
8987                 if (source) {
8988                   assigner(object, source, index, customizer);
8989                 }
8990               }
8991               return object;
8992             });
8993           }
8994           function createBaseEach(eachFunc, fromRight) {
8995             return function(collection, iteratee2) {
8996               if (collection == null) {
8997                 return collection;
8998               }
8999               if (!isArrayLike2(collection)) {
9000                 return eachFunc(collection, iteratee2);
9001               }
9002               var length = collection.length, index = fromRight ? length : -1, iterable = Object2(collection);
9003               while (fromRight ? index-- : ++index < length) {
9004                 if (iteratee2(iterable[index], index, iterable) === false) {
9005                   break;
9006                 }
9007               }
9008               return collection;
9009             };
9010           }
9011           function createBaseFor(fromRight) {
9012             return function(object, iteratee2, keysFunc) {
9013               var index = -1, iterable = Object2(object), props = keysFunc(object), length = props.length;
9014               while (length--) {
9015                 var key = props[fromRight ? length : ++index];
9016                 if (iteratee2(iterable[key], key, iterable) === false) {
9017                   break;
9018                 }
9019               }
9020               return object;
9021             };
9022           }
9023           function createBind(func, bitmask, thisArg) {
9024             var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
9025             function wrapper() {
9026               var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
9027               return fn.apply(isBind ? thisArg : this, arguments);
9028             }
9029             return wrapper;
9030           }
9031           function createCaseFirst(methodName) {
9032             return function(string) {
9033               string = toString2(string);
9034               var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2;
9035               var chr = strSymbols ? strSymbols[0] : string.charAt(0);
9036               var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
9037               return chr[methodName]() + trailing;
9038             };
9039           }
9040           function createCompounder(callback) {
9041             return function(string) {
9042               return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
9043             };
9044           }
9045           function createCtor(Ctor) {
9046             return function() {
9047               var args = arguments;
9048               switch (args.length) {
9049                 case 0:
9050                   return new Ctor();
9051                 case 1:
9052                   return new Ctor(args[0]);
9053                 case 2:
9054                   return new Ctor(args[0], args[1]);
9055                 case 3:
9056                   return new Ctor(args[0], args[1], args[2]);
9057                 case 4:
9058                   return new Ctor(args[0], args[1], args[2], args[3]);
9059                 case 5:
9060                   return new Ctor(args[0], args[1], args[2], args[3], args[4]);
9061                 case 6:
9062                   return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
9063                 case 7:
9064                   return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
9065               }
9066               var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
9067               return isObject3(result2) ? result2 : thisBinding;
9068             };
9069           }
9070           function createCurry(func, bitmask, arity) {
9071             var Ctor = createCtor(func);
9072             function wrapper() {
9073               var length = arguments.length, args = Array2(length), index = length, placeholder = getHolder(wrapper);
9074               while (index--) {
9075                 args[index] = arguments[index];
9076               }
9077               var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
9078               length -= holders.length;
9079               if (length < arity) {
9080                 return createRecurry(
9081                   func,
9082                   bitmask,
9083                   createHybrid,
9084                   wrapper.placeholder,
9085                   undefined2,
9086                   args,
9087                   holders,
9088                   undefined2,
9089                   undefined2,
9090                   arity - length
9091                 );
9092               }
9093               var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
9094               return apply(fn, this, args);
9095             }
9096             return wrapper;
9097           }
9098           function createFind(findIndexFunc) {
9099             return function(collection, predicate, fromIndex) {
9100               var iterable = Object2(collection);
9101               if (!isArrayLike2(collection)) {
9102                 var iteratee2 = getIteratee(predicate, 3);
9103                 collection = keys2(collection);
9104                 predicate = function(key) {
9105                   return iteratee2(iterable[key], key, iterable);
9106                 };
9107               }
9108               var index = findIndexFunc(collection, predicate, fromIndex);
9109               return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2;
9110             };
9111           }
9112           function createFlow(fromRight) {
9113             return flatRest(function(funcs) {
9114               var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
9115               if (fromRight) {
9116                 funcs.reverse();
9117               }
9118               while (index--) {
9119                 var func = funcs[index];
9120                 if (typeof func != "function") {
9121                   throw new TypeError2(FUNC_ERROR_TEXT3);
9122                 }
9123                 if (prereq && !wrapper && getFuncName(func) == "wrapper") {
9124                   var wrapper = new LodashWrapper([], true);
9125                 }
9126               }
9127               index = wrapper ? index : length;
9128               while (++index < length) {
9129                 func = funcs[index];
9130                 var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined2;
9131                 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) {
9132                   wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
9133                 } else {
9134                   wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
9135                 }
9136               }
9137               return function() {
9138                 var args = arguments, value = args[0];
9139                 if (wrapper && args.length == 1 && isArray2(value)) {
9140                   return wrapper.plant(value).value();
9141                 }
9142                 var index2 = 0, result2 = length ? funcs[index2].apply(this, args) : value;
9143                 while (++index2 < length) {
9144                   result2 = funcs[index2].call(this, result2);
9145                 }
9146                 return result2;
9147               };
9148             });
9149           }
9150           function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
9151             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);
9152             function wrapper() {
9153               var length = arguments.length, args = Array2(length), index = length;
9154               while (index--) {
9155                 args[index] = arguments[index];
9156               }
9157               if (isCurried) {
9158                 var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
9159               }
9160               if (partials) {
9161                 args = composeArgs(args, partials, holders, isCurried);
9162               }
9163               if (partialsRight) {
9164                 args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
9165               }
9166               length -= holdersCount;
9167               if (isCurried && length < arity) {
9168                 var newHolders = replaceHolders(args, placeholder);
9169                 return createRecurry(
9170                   func,
9171                   bitmask,
9172                   createHybrid,
9173                   wrapper.placeholder,
9174                   thisArg,
9175                   args,
9176                   newHolders,
9177                   argPos,
9178                   ary2,
9179                   arity - length
9180                 );
9181               }
9182               var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
9183               length = args.length;
9184               if (argPos) {
9185                 args = reorder(args, argPos);
9186               } else if (isFlip && length > 1) {
9187                 args.reverse();
9188               }
9189               if (isAry && ary2 < length) {
9190                 args.length = ary2;
9191               }
9192               if (this && this !== root3 && this instanceof wrapper) {
9193                 fn = Ctor || createCtor(fn);
9194               }
9195               return fn.apply(thisBinding, args);
9196             }
9197             return wrapper;
9198           }
9199           function createInverter(setter, toIteratee) {
9200             return function(object, iteratee2) {
9201               return baseInverter(object, setter, toIteratee(iteratee2), {});
9202             };
9203           }
9204           function createMathOperation(operator, defaultValue) {
9205             return function(value, other) {
9206               var result2;
9207               if (value === undefined2 && other === undefined2) {
9208                 return defaultValue;
9209               }
9210               if (value !== undefined2) {
9211                 result2 = value;
9212               }
9213               if (other !== undefined2) {
9214                 if (result2 === undefined2) {
9215                   return other;
9216                 }
9217                 if (typeof value == "string" || typeof other == "string") {
9218                   value = baseToString2(value);
9219                   other = baseToString2(other);
9220                 } else {
9221                   value = baseToNumber(value);
9222                   other = baseToNumber(other);
9223                 }
9224                 result2 = operator(value, other);
9225               }
9226               return result2;
9227             };
9228           }
9229           function createOver(arrayFunc) {
9230             return flatRest(function(iteratees) {
9231               iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
9232               return baseRest(function(args) {
9233                 var thisArg = this;
9234                 return arrayFunc(iteratees, function(iteratee2) {
9235                   return apply(iteratee2, thisArg, args);
9236                 });
9237               });
9238             });
9239           }
9240           function createPadding(length, chars) {
9241             chars = chars === undefined2 ? " " : baseToString2(chars);
9242             var charsLength = chars.length;
9243             if (charsLength < 2) {
9244               return charsLength ? baseRepeat(chars, length) : chars;
9245             }
9246             var result2 = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
9247             return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length).join("") : result2.slice(0, length);
9248           }
9249           function createPartial(func, bitmask, thisArg, partials) {
9250             var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
9251             function wrapper() {
9252               var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
9253               while (++leftIndex < leftLength) {
9254                 args[leftIndex] = partials[leftIndex];
9255               }
9256               while (argsLength--) {
9257                 args[leftIndex++] = arguments[++argsIndex];
9258               }
9259               return apply(fn, isBind ? thisArg : this, args);
9260             }
9261             return wrapper;
9262           }
9263           function createRange(fromRight) {
9264             return function(start2, end, step) {
9265               if (step && typeof step != "number" && isIterateeCall(start2, end, step)) {
9266                 end = step = undefined2;
9267               }
9268               start2 = toFinite(start2);
9269               if (end === undefined2) {
9270                 end = start2;
9271                 start2 = 0;
9272               } else {
9273                 end = toFinite(end);
9274               }
9275               step = step === undefined2 ? start2 < end ? 1 : -1 : toFinite(step);
9276               return baseRange(start2, end, step, fromRight);
9277             };
9278           }
9279           function createRelationalOperation(operator) {
9280             return function(value, other) {
9281               if (!(typeof value == "string" && typeof other == "string")) {
9282                 value = toNumber3(value);
9283                 other = toNumber3(other);
9284               }
9285               return operator(value, other);
9286             };
9287           }
9288           function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
9289             var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials;
9290             bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
9291             bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
9292             if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
9293               bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
9294             }
9295             var newData = [
9296               func,
9297               bitmask,
9298               thisArg,
9299               newPartials,
9300               newHolders,
9301               newPartialsRight,
9302               newHoldersRight,
9303               argPos,
9304               ary2,
9305               arity
9306             ];
9307             var result2 = wrapFunc.apply(undefined2, newData);
9308             if (isLaziable(func)) {
9309               setData(result2, newData);
9310             }
9311             result2.placeholder = placeholder;
9312             return setWrapToString(result2, func, bitmask);
9313           }
9314           function createRound(methodName) {
9315             var func = Math2[methodName];
9316             return function(number3, precision2) {
9317               number3 = toNumber3(number3);
9318               precision2 = precision2 == null ? 0 : nativeMin2(toInteger(precision2), 292);
9319               if (precision2 && nativeIsFinite(number3)) {
9320                 var pair3 = (toString2(number3) + "e").split("e"), value = func(pair3[0] + "e" + (+pair3[1] + precision2));
9321                 pair3 = (toString2(value) + "e").split("e");
9322                 return +(pair3[0] + "e" + (+pair3[1] - precision2));
9323               }
9324               return func(number3);
9325             };
9326           }
9327           var createSet = !(Set3 && 1 / setToArray2(new Set3([, -0]))[1] == INFINITY2) ? noop3 : function(values2) {
9328             return new Set3(values2);
9329           };
9330           function createToPairs(keysFunc) {
9331             return function(object) {
9332               var tag = getTag2(object);
9333               if (tag == mapTag4) {
9334                 return mapToArray2(object);
9335               }
9336               if (tag == setTag4) {
9337                 return setToPairs(object);
9338               }
9339               return baseToPairs(object, keysFunc(object));
9340             };
9341           }
9342           function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
9343             var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
9344             if (!isBindKey && typeof func != "function") {
9345               throw new TypeError2(FUNC_ERROR_TEXT3);
9346             }
9347             var length = partials ? partials.length : 0;
9348             if (!length) {
9349               bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
9350               partials = holders = undefined2;
9351             }
9352             ary2 = ary2 === undefined2 ? ary2 : nativeMax2(toInteger(ary2), 0);
9353             arity = arity === undefined2 ? arity : toInteger(arity);
9354             length -= holders ? holders.length : 0;
9355             if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
9356               var partialsRight = partials, holdersRight = holders;
9357               partials = holders = undefined2;
9358             }
9359             var data = isBindKey ? undefined2 : getData(func);
9360             var newData = [
9361               func,
9362               bitmask,
9363               thisArg,
9364               partials,
9365               holders,
9366               partialsRight,
9367               holdersRight,
9368               argPos,
9369               ary2,
9370               arity
9371             ];
9372             if (data) {
9373               mergeData(newData, data);
9374             }
9375             func = newData[0];
9376             bitmask = newData[1];
9377             thisArg = newData[2];
9378             partials = newData[3];
9379             holders = newData[4];
9380             arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax2(newData[9] - length, 0);
9381             if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
9382               bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
9383             }
9384             if (!bitmask || bitmask == WRAP_BIND_FLAG) {
9385               var result2 = createBind(func, bitmask, thisArg);
9386             } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
9387               result2 = createCurry(func, bitmask, arity);
9388             } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
9389               result2 = createPartial(func, bitmask, thisArg, partials);
9390             } else {
9391               result2 = createHybrid.apply(undefined2, newData);
9392             }
9393             var setter = data ? baseSetData : setData;
9394             return setWrapToString(setter(result2, newData), func, bitmask);
9395           }
9396           function customDefaultsAssignIn(objValue, srcValue, key, object) {
9397             if (objValue === undefined2 || eq2(objValue, objectProto13[key]) && !hasOwnProperty10.call(object, key)) {
9398               return srcValue;
9399             }
9400             return objValue;
9401           }
9402           function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
9403             if (isObject3(objValue) && isObject3(srcValue)) {
9404               stack.set(srcValue, objValue);
9405               baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack);
9406               stack["delete"](srcValue);
9407             }
9408             return objValue;
9409           }
9410           function customOmitClone(value) {
9411             return isPlainObject(value) ? undefined2 : value;
9412           }
9413           function equalArrays2(array2, other, bitmask, customizer, equalFunc, stack) {
9414             var isPartial = bitmask & COMPARE_PARTIAL_FLAG5, arrLength = array2.length, othLength = other.length;
9415             if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
9416               return false;
9417             }
9418             var arrStacked = stack.get(array2);
9419             var othStacked = stack.get(other);
9420             if (arrStacked && othStacked) {
9421               return arrStacked == other && othStacked == array2;
9422             }
9423             var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG3 ? new SetCache2() : undefined2;
9424             stack.set(array2, other);
9425             stack.set(other, array2);
9426             while (++index < arrLength) {
9427               var arrValue = array2[index], othValue = other[index];
9428               if (customizer) {
9429                 var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack);
9430               }
9431               if (compared !== undefined2) {
9432                 if (compared) {
9433                   continue;
9434                 }
9435                 result2 = false;
9436                 break;
9437               }
9438               if (seen) {
9439                 if (!arraySome2(other, function(othValue2, othIndex) {
9440                   if (!cacheHas2(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
9441                     return seen.push(othIndex);
9442                   }
9443                 })) {
9444                   result2 = false;
9445                   break;
9446                 }
9447               } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
9448                 result2 = false;
9449                 break;
9450               }
9451             }
9452             stack["delete"](array2);
9453             stack["delete"](other);
9454             return result2;
9455           }
9456           function equalByTag2(object, other, tag, bitmask, customizer, equalFunc, stack) {
9457             switch (tag) {
9458               case dataViewTag4:
9459                 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
9460                   return false;
9461                 }
9462                 object = object.buffer;
9463                 other = other.buffer;
9464               case arrayBufferTag3:
9465                 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array3(object), new Uint8Array3(other))) {
9466                   return false;
9467                 }
9468                 return true;
9469               case boolTag3:
9470               case dateTag3:
9471               case numberTag4:
9472                 return eq2(+object, +other);
9473               case errorTag3:
9474                 return object.name == other.name && object.message == other.message;
9475               case regexpTag3:
9476               case stringTag3:
9477                 return object == other + "";
9478               case mapTag4:
9479                 var convert = mapToArray2;
9480               case setTag4:
9481                 var isPartial = bitmask & COMPARE_PARTIAL_FLAG5;
9482                 convert || (convert = setToArray2);
9483                 if (object.size != other.size && !isPartial) {
9484                   return false;
9485                 }
9486                 var stacked = stack.get(object);
9487                 if (stacked) {
9488                   return stacked == other;
9489                 }
9490                 bitmask |= COMPARE_UNORDERED_FLAG3;
9491                 stack.set(object, other);
9492                 var result2 = equalArrays2(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
9493                 stack["delete"](object);
9494                 return result2;
9495               case symbolTag3:
9496                 if (symbolValueOf2) {
9497                   return symbolValueOf2.call(object) == symbolValueOf2.call(other);
9498                 }
9499             }
9500             return false;
9501           }
9502           function equalObjects2(object, other, bitmask, customizer, equalFunc, stack) {
9503             var isPartial = bitmask & COMPARE_PARTIAL_FLAG5, objProps = getAllKeys2(object), objLength = objProps.length, othProps = getAllKeys2(other), othLength = othProps.length;
9504             if (objLength != othLength && !isPartial) {
9505               return false;
9506             }
9507             var index = objLength;
9508             while (index--) {
9509               var key = objProps[index];
9510               if (!(isPartial ? key in other : hasOwnProperty10.call(other, key))) {
9511                 return false;
9512               }
9513             }
9514             var objStacked = stack.get(object);
9515             var othStacked = stack.get(other);
9516             if (objStacked && othStacked) {
9517               return objStacked == other && othStacked == object;
9518             }
9519             var result2 = true;
9520             stack.set(object, other);
9521             stack.set(other, object);
9522             var skipCtor = isPartial;
9523             while (++index < objLength) {
9524               key = objProps[index];
9525               var objValue = object[key], othValue = other[key];
9526               if (customizer) {
9527                 var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
9528               }
9529               if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
9530                 result2 = false;
9531                 break;
9532               }
9533               skipCtor || (skipCtor = key == "constructor");
9534             }
9535             if (result2 && !skipCtor) {
9536               var objCtor = object.constructor, othCtor = other.constructor;
9537               if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
9538                 result2 = false;
9539               }
9540             }
9541             stack["delete"](object);
9542             stack["delete"](other);
9543             return result2;
9544           }
9545           function flatRest(func) {
9546             return setToString(overRest(func, undefined2, flatten2), func + "");
9547           }
9548           function getAllKeys2(object) {
9549             return baseGetAllKeys2(object, keys2, getSymbols2);
9550           }
9551           function getAllKeysIn(object) {
9552             return baseGetAllKeys2(object, keysIn, getSymbolsIn);
9553           }
9554           var getData = !metaMap ? noop3 : function(func) {
9555             return metaMap.get(func);
9556           };
9557           function getFuncName(func) {
9558             var result2 = func.name + "", array2 = realNames[result2], length = hasOwnProperty10.call(realNames, result2) ? array2.length : 0;
9559             while (length--) {
9560               var data = array2[length], otherFunc = data.func;
9561               if (otherFunc == null || otherFunc == func) {
9562                 return data.name;
9563               }
9564             }
9565             return result2;
9566           }
9567           function getHolder(func) {
9568             var object = hasOwnProperty10.call(lodash, "placeholder") ? lodash : func;
9569             return object.placeholder;
9570           }
9571           function getIteratee() {
9572             var result2 = lodash.iteratee || iteratee;
9573             result2 = result2 === iteratee ? baseIteratee : result2;
9574             return arguments.length ? result2(arguments[0], arguments[1]) : result2;
9575           }
9576           function getMapData2(map3, key) {
9577             var data = map3.__data__;
9578             return isKeyable2(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
9579           }
9580           function getMatchData(object) {
9581             var result2 = keys2(object), length = result2.length;
9582             while (length--) {
9583               var key = result2[length], value = object[key];
9584               result2[length] = [key, value, isStrictComparable(value)];
9585             }
9586             return result2;
9587           }
9588           function getNative2(object, key) {
9589             var value = getValue2(object, key);
9590             return baseIsNative2(value) ? value : undefined2;
9591           }
9592           function getRawTag2(value) {
9593             var isOwn = hasOwnProperty10.call(value, symToStringTag3), tag = value[symToStringTag3];
9594             try {
9595               value[symToStringTag3] = undefined2;
9596               var unmasked = true;
9597             } catch (e3) {
9598             }
9599             var result2 = nativeObjectToString3.call(value);
9600             if (unmasked) {
9601               if (isOwn) {
9602                 value[symToStringTag3] = tag;
9603               } else {
9604                 delete value[symToStringTag3];
9605               }
9606             }
9607             return result2;
9608           }
9609           var getSymbols2 = !nativeGetSymbols2 ? stubArray2 : function(object) {
9610             if (object == null) {
9611               return [];
9612             }
9613             object = Object2(object);
9614             return arrayFilter2(nativeGetSymbols2(object), function(symbol) {
9615               return propertyIsEnumerable3.call(object, symbol);
9616             });
9617           };
9618           var getSymbolsIn = !nativeGetSymbols2 ? stubArray2 : function(object) {
9619             var result2 = [];
9620             while (object) {
9621               arrayPush2(result2, getSymbols2(object));
9622               object = getPrototype(object);
9623             }
9624             return result2;
9625           };
9626           var getTag2 = baseGetTag2;
9627           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) {
9628             getTag2 = function(value) {
9629               var result2 = baseGetTag2(value), Ctor = result2 == objectTag4 ? value.constructor : undefined2, ctorString = Ctor ? toSource2(Ctor) : "";
9630               if (ctorString) {
9631                 switch (ctorString) {
9632                   case dataViewCtorString2:
9633                     return dataViewTag4;
9634                   case mapCtorString2:
9635                     return mapTag4;
9636                   case promiseCtorString2:
9637                     return promiseTag2;
9638                   case setCtorString2:
9639                     return setTag4;
9640                   case weakMapCtorString2:
9641                     return weakMapTag3;
9642                 }
9643               }
9644               return result2;
9645             };
9646           }
9647           function getView(start2, end, transforms) {
9648             var index = -1, length = transforms.length;
9649             while (++index < length) {
9650               var data = transforms[index], size2 = data.size;
9651               switch (data.type) {
9652                 case "drop":
9653                   start2 += size2;
9654                   break;
9655                 case "dropRight":
9656                   end -= size2;
9657                   break;
9658                 case "take":
9659                   end = nativeMin2(end, start2 + size2);
9660                   break;
9661                 case "takeRight":
9662                   start2 = nativeMax2(start2, end - size2);
9663                   break;
9664               }
9665             }
9666             return { "start": start2, "end": end };
9667           }
9668           function getWrapDetails(source) {
9669             var match = source.match(reWrapDetails);
9670             return match ? match[1].split(reSplitDetails) : [];
9671           }
9672           function hasPath(object, path, hasFunc) {
9673             path = castPath(path, object);
9674             var index = -1, length = path.length, result2 = false;
9675             while (++index < length) {
9676               var key = toKey(path[index]);
9677               if (!(result2 = object != null && hasFunc(object, key))) {
9678                 break;
9679               }
9680               object = object[key];
9681             }
9682             if (result2 || ++index != length) {
9683               return result2;
9684             }
9685             length = object == null ? 0 : object.length;
9686             return !!length && isLength2(length) && isIndex2(key, length) && (isArray2(object) || isArguments2(object));
9687           }
9688           function initCloneArray(array2) {
9689             var length = array2.length, result2 = new array2.constructor(length);
9690             if (length && typeof array2[0] == "string" && hasOwnProperty10.call(array2, "index")) {
9691               result2.index = array2.index;
9692               result2.input = array2.input;
9693             }
9694             return result2;
9695           }
9696           function initCloneObject(object) {
9697             return typeof object.constructor == "function" && !isPrototype2(object) ? baseCreate(getPrototype(object)) : {};
9698           }
9699           function initCloneByTag(object, tag, isDeep) {
9700             var Ctor = object.constructor;
9701             switch (tag) {
9702               case arrayBufferTag3:
9703                 return cloneArrayBuffer(object);
9704               case boolTag3:
9705               case dateTag3:
9706                 return new Ctor(+object);
9707               case dataViewTag4:
9708                 return cloneDataView(object, isDeep);
9709               case float32Tag2:
9710               case float64Tag2:
9711               case int8Tag2:
9712               case int16Tag2:
9713               case int32Tag2:
9714               case uint8Tag2:
9715               case uint8ClampedTag2:
9716               case uint16Tag2:
9717               case uint32Tag2:
9718                 return cloneTypedArray(object, isDeep);
9719               case mapTag4:
9720                 return new Ctor();
9721               case numberTag4:
9722               case stringTag3:
9723                 return new Ctor(object);
9724               case regexpTag3:
9725                 return cloneRegExp(object);
9726               case setTag4:
9727                 return new Ctor();
9728               case symbolTag3:
9729                 return cloneSymbol(object);
9730             }
9731           }
9732           function insertWrapDetails(source, details) {
9733             var length = details.length;
9734             if (!length) {
9735               return source;
9736             }
9737             var lastIndex = length - 1;
9738             details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
9739             details = details.join(length > 2 ? ", " : " ");
9740             return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
9741           }
9742           function isFlattenable(value) {
9743             return isArray2(value) || isArguments2(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
9744           }
9745           function isIndex2(value, length) {
9746             var type2 = typeof value;
9747             length = length == null ? MAX_SAFE_INTEGER3 : length;
9748             return !!length && (type2 == "number" || type2 != "symbol" && reIsUint2.test(value)) && (value > -1 && value % 1 == 0 && value < length);
9749           }
9750           function isIterateeCall(value, index, object) {
9751             if (!isObject3(object)) {
9752               return false;
9753             }
9754             var type2 = typeof index;
9755             if (type2 == "number" ? isArrayLike2(object) && isIndex2(index, object.length) : type2 == "string" && index in object) {
9756               return eq2(object[index], value);
9757             }
9758             return false;
9759           }
9760           function isKey(value, object) {
9761             if (isArray2(value)) {
9762               return false;
9763             }
9764             var type2 = typeof value;
9765             if (type2 == "number" || type2 == "symbol" || type2 == "boolean" || value == null || isSymbol2(value)) {
9766               return true;
9767             }
9768             return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object);
9769           }
9770           function isKeyable2(value) {
9771             var type2 = typeof value;
9772             return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
9773           }
9774           function isLaziable(func) {
9775             var funcName = getFuncName(func), other = lodash[funcName];
9776             if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
9777               return false;
9778             }
9779             if (func === other) {
9780               return true;
9781             }
9782             var data = getData(other);
9783             return !!data && func === data[0];
9784           }
9785           function isMasked2(func) {
9786             return !!maskSrcKey2 && maskSrcKey2 in func;
9787           }
9788           var isMaskable = coreJsData2 ? isFunction2 : stubFalse2;
9789           function isPrototype2(value) {
9790             var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto13;
9791             return value === proto;
9792           }
9793           function isStrictComparable(value) {
9794             return value === value && !isObject3(value);
9795           }
9796           function matchesStrictComparable(key, srcValue) {
9797             return function(object) {
9798               if (object == null) {
9799                 return false;
9800               }
9801               return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object));
9802             };
9803           }
9804           function memoizeCapped(func) {
9805             var result2 = memoize(func, function(key) {
9806               if (cache.size === MAX_MEMOIZE_SIZE) {
9807                 cache.clear();
9808               }
9809               return key;
9810             });
9811             var cache = result2.cache;
9812             return result2;
9813           }
9814           function mergeData(data, source) {
9815             var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
9816             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;
9817             if (!(isCommon || isCombo)) {
9818               return data;
9819             }
9820             if (srcBitmask & WRAP_BIND_FLAG) {
9821               data[2] = source[2];
9822               newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
9823             }
9824             var value = source[3];
9825             if (value) {
9826               var partials = data[3];
9827               data[3] = partials ? composeArgs(partials, value, source[4]) : value;
9828               data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
9829             }
9830             value = source[5];
9831             if (value) {
9832               partials = data[5];
9833               data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
9834               data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
9835             }
9836             value = source[7];
9837             if (value) {
9838               data[7] = value;
9839             }
9840             if (srcBitmask & WRAP_ARY_FLAG) {
9841               data[8] = data[8] == null ? source[8] : nativeMin2(data[8], source[8]);
9842             }
9843             if (data[9] == null) {
9844               data[9] = source[9];
9845             }
9846             data[0] = source[0];
9847             data[1] = newBitmask;
9848             return data;
9849           }
9850           function nativeKeysIn(object) {
9851             var result2 = [];
9852             if (object != null) {
9853               for (var key in Object2(object)) {
9854                 result2.push(key);
9855               }
9856             }
9857             return result2;
9858           }
9859           function objectToString2(value) {
9860             return nativeObjectToString3.call(value);
9861           }
9862           function overRest(func, start2, transform3) {
9863             start2 = nativeMax2(start2 === undefined2 ? func.length - 1 : start2, 0);
9864             return function() {
9865               var args = arguments, index = -1, length = nativeMax2(args.length - start2, 0), array2 = Array2(length);
9866               while (++index < length) {
9867                 array2[index] = args[start2 + index];
9868               }
9869               index = -1;
9870               var otherArgs = Array2(start2 + 1);
9871               while (++index < start2) {
9872                 otherArgs[index] = args[index];
9873               }
9874               otherArgs[start2] = transform3(array2);
9875               return apply(func, this, otherArgs);
9876             };
9877           }
9878           function parent(object, path) {
9879             return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
9880           }
9881           function reorder(array2, indexes) {
9882             var arrLength = array2.length, length = nativeMin2(indexes.length, arrLength), oldArray = copyArray(array2);
9883             while (length--) {
9884               var index = indexes[length];
9885               array2[length] = isIndex2(index, arrLength) ? oldArray[index] : undefined2;
9886             }
9887             return array2;
9888           }
9889           function safeGet(object, key) {
9890             if (key === "constructor" && typeof object[key] === "function") {
9891               return;
9892             }
9893             if (key == "__proto__") {
9894               return;
9895             }
9896             return object[key];
9897           }
9898           var setData = shortOut(baseSetData);
9899           var setTimeout2 = ctxSetTimeout || function(func, wait) {
9900             return root3.setTimeout(func, wait);
9901           };
9902           var setToString = shortOut(baseSetToString);
9903           function setWrapToString(wrapper, reference, bitmask) {
9904             var source = reference + "";
9905             return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
9906           }
9907           function shortOut(func) {
9908             var count = 0, lastCalled = 0;
9909             return function() {
9910               var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
9911               lastCalled = stamp;
9912               if (remaining > 0) {
9913                 if (++count >= HOT_COUNT) {
9914                   return arguments[0];
9915                 }
9916               } else {
9917                 count = 0;
9918               }
9919               return func.apply(undefined2, arguments);
9920             };
9921           }
9922           function shuffleSelf(array2, size2) {
9923             var index = -1, length = array2.length, lastIndex = length - 1;
9924             size2 = size2 === undefined2 ? length : size2;
9925             while (++index < size2) {
9926               var rand = baseRandom(index, lastIndex), value = array2[rand];
9927               array2[rand] = array2[index];
9928               array2[index] = value;
9929             }
9930             array2.length = size2;
9931             return array2;
9932           }
9933           var stringToPath = memoizeCapped(function(string) {
9934             var result2 = [];
9935             if (string.charCodeAt(0) === 46) {
9936               result2.push("");
9937             }
9938             string.replace(rePropName, function(match, number3, quote2, subString) {
9939               result2.push(quote2 ? subString.replace(reEscapeChar, "$1") : number3 || match);
9940             });
9941             return result2;
9942           });
9943           function toKey(value) {
9944             if (typeof value == "string" || isSymbol2(value)) {
9945               return value;
9946             }
9947             var result2 = value + "";
9948             return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
9949           }
9950           function toSource2(func) {
9951             if (func != null) {
9952               try {
9953                 return funcToString3.call(func);
9954               } catch (e3) {
9955               }
9956               try {
9957                 return func + "";
9958               } catch (e3) {
9959               }
9960             }
9961             return "";
9962           }
9963           function updateWrapDetails(details, bitmask) {
9964             arrayEach(wrapFlags, function(pair3) {
9965               var value = "_." + pair3[0];
9966               if (bitmask & pair3[1] && !arrayIncludes(details, value)) {
9967                 details.push(value);
9968               }
9969             });
9970             return details.sort();
9971           }
9972           function wrapperClone(wrapper) {
9973             if (wrapper instanceof LazyWrapper) {
9974               return wrapper.clone();
9975             }
9976             var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
9977             result2.__actions__ = copyArray(wrapper.__actions__);
9978             result2.__index__ = wrapper.__index__;
9979             result2.__values__ = wrapper.__values__;
9980             return result2;
9981           }
9982           function chunk(array2, size2, guard) {
9983             if (guard ? isIterateeCall(array2, size2, guard) : size2 === undefined2) {
9984               size2 = 1;
9985             } else {
9986               size2 = nativeMax2(toInteger(size2), 0);
9987             }
9988             var length = array2 == null ? 0 : array2.length;
9989             if (!length || size2 < 1) {
9990               return [];
9991             }
9992             var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length / size2));
9993             while (index < length) {
9994               result2[resIndex++] = baseSlice(array2, index, index += size2);
9995             }
9996             return result2;
9997           }
9998           function compact(array2) {
9999             var index = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result2 = [];
10000             while (++index < length) {
10001               var value = array2[index];
10002               if (value) {
10003                 result2[resIndex++] = value;
10004               }
10005             }
10006             return result2;
10007           }
10008           function concat() {
10009             var length = arguments.length;
10010             if (!length) {
10011               return [];
10012             }
10013             var args = Array2(length - 1), array2 = arguments[0], index = length;
10014             while (index--) {
10015               args[index - 1] = arguments[index];
10016             }
10017             return arrayPush2(isArray2(array2) ? copyArray(array2) : [array2], baseFlatten(args, 1));
10018           }
10019           var difference = baseRest(function(array2, values2) {
10020             return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true)) : [];
10021           });
10022           var differenceBy = baseRest(function(array2, values2) {
10023             var iteratee2 = last(values2);
10024             if (isArrayLikeObject(iteratee2)) {
10025               iteratee2 = undefined2;
10026             }
10027             return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : [];
10028           });
10029           var differenceWith = baseRest(function(array2, values2) {
10030             var comparator = last(values2);
10031             if (isArrayLikeObject(comparator)) {
10032               comparator = undefined2;
10033             }
10034             return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true), undefined2, comparator) : [];
10035           });
10036           function drop(array2, n3, guard) {
10037             var length = array2 == null ? 0 : array2.length;
10038             if (!length) {
10039               return [];
10040             }
10041             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
10042             return baseSlice(array2, n3 < 0 ? 0 : n3, length);
10043           }
10044           function dropRight(array2, n3, guard) {
10045             var length = array2 == null ? 0 : array2.length;
10046             if (!length) {
10047               return [];
10048             }
10049             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
10050             n3 = length - n3;
10051             return baseSlice(array2, 0, n3 < 0 ? 0 : n3);
10052           }
10053           function dropRightWhile(array2, predicate) {
10054             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true, true) : [];
10055           }
10056           function dropWhile(array2, predicate) {
10057             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true) : [];
10058           }
10059           function fill(array2, value, start2, end) {
10060             var length = array2 == null ? 0 : array2.length;
10061             if (!length) {
10062               return [];
10063             }
10064             if (start2 && typeof start2 != "number" && isIterateeCall(array2, value, start2)) {
10065               start2 = 0;
10066               end = length;
10067             }
10068             return baseFill(array2, value, start2, end);
10069           }
10070           function findIndex(array2, predicate, fromIndex) {
10071             var length = array2 == null ? 0 : array2.length;
10072             if (!length) {
10073               return -1;
10074             }
10075             var index = fromIndex == null ? 0 : toInteger(fromIndex);
10076             if (index < 0) {
10077               index = nativeMax2(length + index, 0);
10078             }
10079             return baseFindIndex(array2, getIteratee(predicate, 3), index);
10080           }
10081           function findLastIndex(array2, predicate, fromIndex) {
10082             var length = array2 == null ? 0 : array2.length;
10083             if (!length) {
10084               return -1;
10085             }
10086             var index = length - 1;
10087             if (fromIndex !== undefined2) {
10088               index = toInteger(fromIndex);
10089               index = fromIndex < 0 ? nativeMax2(length + index, 0) : nativeMin2(index, length - 1);
10090             }
10091             return baseFindIndex(array2, getIteratee(predicate, 3), index, true);
10092           }
10093           function flatten2(array2) {
10094             var length = array2 == null ? 0 : array2.length;
10095             return length ? baseFlatten(array2, 1) : [];
10096           }
10097           function flattenDeep(array2) {
10098             var length = array2 == null ? 0 : array2.length;
10099             return length ? baseFlatten(array2, INFINITY2) : [];
10100           }
10101           function flattenDepth(array2, depth) {
10102             var length = array2 == null ? 0 : array2.length;
10103             if (!length) {
10104               return [];
10105             }
10106             depth = depth === undefined2 ? 1 : toInteger(depth);
10107             return baseFlatten(array2, depth);
10108           }
10109           function fromPairs(pairs2) {
10110             var index = -1, length = pairs2 == null ? 0 : pairs2.length, result2 = {};
10111             while (++index < length) {
10112               var pair3 = pairs2[index];
10113               result2[pair3[0]] = pair3[1];
10114             }
10115             return result2;
10116           }
10117           function head(array2) {
10118             return array2 && array2.length ? array2[0] : undefined2;
10119           }
10120           function indexOf(array2, value, fromIndex) {
10121             var length = array2 == null ? 0 : array2.length;
10122             if (!length) {
10123               return -1;
10124             }
10125             var index = fromIndex == null ? 0 : toInteger(fromIndex);
10126             if (index < 0) {
10127               index = nativeMax2(length + index, 0);
10128             }
10129             return baseIndexOf(array2, value, index);
10130           }
10131           function initial(array2) {
10132             var length = array2 == null ? 0 : array2.length;
10133             return length ? baseSlice(array2, 0, -1) : [];
10134           }
10135           var intersection = baseRest(function(arrays) {
10136             var mapped = arrayMap2(arrays, castArrayLikeObject);
10137             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
10138           });
10139           var intersectionBy = baseRest(function(arrays) {
10140             var iteratee2 = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
10141             if (iteratee2 === last(mapped)) {
10142               iteratee2 = undefined2;
10143             } else {
10144               mapped.pop();
10145             }
10146             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
10147           });
10148           var intersectionWith = baseRest(function(arrays) {
10149             var comparator = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
10150             comparator = typeof comparator == "function" ? comparator : undefined2;
10151             if (comparator) {
10152               mapped.pop();
10153             }
10154             return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
10155           });
10156           function join(array2, separator) {
10157             return array2 == null ? "" : nativeJoin.call(array2, separator);
10158           }
10159           function last(array2) {
10160             var length = array2 == null ? 0 : array2.length;
10161             return length ? array2[length - 1] : undefined2;
10162           }
10163           function lastIndexOf(array2, value, fromIndex) {
10164             var length = array2 == null ? 0 : array2.length;
10165             if (!length) {
10166               return -1;
10167             }
10168             var index = length;
10169             if (fromIndex !== undefined2) {
10170               index = toInteger(fromIndex);
10171               index = index < 0 ? nativeMax2(length + index, 0) : nativeMin2(index, length - 1);
10172             }
10173             return value === value ? strictLastIndexOf(array2, value, index) : baseFindIndex(array2, baseIsNaN, index, true);
10174           }
10175           function nth(array2, n3) {
10176             return array2 && array2.length ? baseNth(array2, toInteger(n3)) : undefined2;
10177           }
10178           var pull = baseRest(pullAll);
10179           function pullAll(array2, values2) {
10180             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
10181           }
10182           function pullAllBy(array2, values2, iteratee2) {
10183             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, getIteratee(iteratee2, 2)) : array2;
10184           }
10185           function pullAllWith(array2, values2, comparator) {
10186             return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, undefined2, comparator) : array2;
10187           }
10188           var pullAt = flatRest(function(array2, indexes) {
10189             var length = array2 == null ? 0 : array2.length, result2 = baseAt(array2, indexes);
10190             basePullAt(array2, arrayMap2(indexes, function(index) {
10191               return isIndex2(index, length) ? +index : index;
10192             }).sort(compareAscending));
10193             return result2;
10194           });
10195           function remove2(array2, predicate) {
10196             var result2 = [];
10197             if (!(array2 && array2.length)) {
10198               return result2;
10199             }
10200             var index = -1, indexes = [], length = array2.length;
10201             predicate = getIteratee(predicate, 3);
10202             while (++index < length) {
10203               var value = array2[index];
10204               if (predicate(value, index, array2)) {
10205                 result2.push(value);
10206                 indexes.push(index);
10207               }
10208             }
10209             basePullAt(array2, indexes);
10210             return result2;
10211           }
10212           function reverse(array2) {
10213             return array2 == null ? array2 : nativeReverse.call(array2);
10214           }
10215           function slice(array2, start2, end) {
10216             var length = array2 == null ? 0 : array2.length;
10217             if (!length) {
10218               return [];
10219             }
10220             if (end && typeof end != "number" && isIterateeCall(array2, start2, end)) {
10221               start2 = 0;
10222               end = length;
10223             } else {
10224               start2 = start2 == null ? 0 : toInteger(start2);
10225               end = end === undefined2 ? length : toInteger(end);
10226             }
10227             return baseSlice(array2, start2, end);
10228           }
10229           function sortedIndex(array2, value) {
10230             return baseSortedIndex(array2, value);
10231           }
10232           function sortedIndexBy(array2, value, iteratee2) {
10233             return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2));
10234           }
10235           function sortedIndexOf(array2, value) {
10236             var length = array2 == null ? 0 : array2.length;
10237             if (length) {
10238               var index = baseSortedIndex(array2, value);
10239               if (index < length && eq2(array2[index], value)) {
10240                 return index;
10241               }
10242             }
10243             return -1;
10244           }
10245           function sortedLastIndex(array2, value) {
10246             return baseSortedIndex(array2, value, true);
10247           }
10248           function sortedLastIndexBy(array2, value, iteratee2) {
10249             return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2), true);
10250           }
10251           function sortedLastIndexOf(array2, value) {
10252             var length = array2 == null ? 0 : array2.length;
10253             if (length) {
10254               var index = baseSortedIndex(array2, value, true) - 1;
10255               if (eq2(array2[index], value)) {
10256                 return index;
10257               }
10258             }
10259             return -1;
10260           }
10261           function sortedUniq(array2) {
10262             return array2 && array2.length ? baseSortedUniq(array2) : [];
10263           }
10264           function sortedUniqBy(array2, iteratee2) {
10265             return array2 && array2.length ? baseSortedUniq(array2, getIteratee(iteratee2, 2)) : [];
10266           }
10267           function tail(array2) {
10268             var length = array2 == null ? 0 : array2.length;
10269             return length ? baseSlice(array2, 1, length) : [];
10270           }
10271           function take(array2, n3, guard) {
10272             if (!(array2 && array2.length)) {
10273               return [];
10274             }
10275             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
10276             return baseSlice(array2, 0, n3 < 0 ? 0 : n3);
10277           }
10278           function takeRight(array2, n3, guard) {
10279             var length = array2 == null ? 0 : array2.length;
10280             if (!length) {
10281               return [];
10282             }
10283             n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
10284             n3 = length - n3;
10285             return baseSlice(array2, n3 < 0 ? 0 : n3, length);
10286           }
10287           function takeRightWhile(array2, predicate) {
10288             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), false, true) : [];
10289           }
10290           function takeWhile(array2, predicate) {
10291             return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3)) : [];
10292           }
10293           var union = baseRest(function(arrays) {
10294             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
10295           });
10296           var unionBy = baseRest(function(arrays) {
10297             var iteratee2 = last(arrays);
10298             if (isArrayLikeObject(iteratee2)) {
10299               iteratee2 = undefined2;
10300             }
10301             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2));
10302           });
10303           var unionWith = baseRest(function(arrays) {
10304             var comparator = last(arrays);
10305             comparator = typeof comparator == "function" ? comparator : undefined2;
10306             return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator);
10307           });
10308           function uniq(array2) {
10309             return array2 && array2.length ? baseUniq(array2) : [];
10310           }
10311           function uniqBy(array2, iteratee2) {
10312             return array2 && array2.length ? baseUniq(array2, getIteratee(iteratee2, 2)) : [];
10313           }
10314           function uniqWith(array2, comparator) {
10315             comparator = typeof comparator == "function" ? comparator : undefined2;
10316             return array2 && array2.length ? baseUniq(array2, undefined2, comparator) : [];
10317           }
10318           function unzip(array2) {
10319             if (!(array2 && array2.length)) {
10320               return [];
10321             }
10322             var length = 0;
10323             array2 = arrayFilter2(array2, function(group) {
10324               if (isArrayLikeObject(group)) {
10325                 length = nativeMax2(group.length, length);
10326                 return true;
10327               }
10328             });
10329             return baseTimes2(length, function(index) {
10330               return arrayMap2(array2, baseProperty(index));
10331             });
10332           }
10333           function unzipWith(array2, iteratee2) {
10334             if (!(array2 && array2.length)) {
10335               return [];
10336             }
10337             var result2 = unzip(array2);
10338             if (iteratee2 == null) {
10339               return result2;
10340             }
10341             return arrayMap2(result2, function(group) {
10342               return apply(iteratee2, undefined2, group);
10343             });
10344           }
10345           var without = baseRest(function(array2, values2) {
10346             return isArrayLikeObject(array2) ? baseDifference(array2, values2) : [];
10347           });
10348           var xor = baseRest(function(arrays) {
10349             return baseXor(arrayFilter2(arrays, isArrayLikeObject));
10350           });
10351           var xorBy = baseRest(function(arrays) {
10352             var iteratee2 = last(arrays);
10353             if (isArrayLikeObject(iteratee2)) {
10354               iteratee2 = undefined2;
10355             }
10356             return baseXor(arrayFilter2(arrays, isArrayLikeObject), getIteratee(iteratee2, 2));
10357           });
10358           var xorWith = baseRest(function(arrays) {
10359             var comparator = last(arrays);
10360             comparator = typeof comparator == "function" ? comparator : undefined2;
10361             return baseXor(arrayFilter2(arrays, isArrayLikeObject), undefined2, comparator);
10362           });
10363           var zip = baseRest(unzip);
10364           function zipObject(props, values2) {
10365             return baseZipObject(props || [], values2 || [], assignValue);
10366           }
10367           function zipObjectDeep(props, values2) {
10368             return baseZipObject(props || [], values2 || [], baseSet);
10369           }
10370           var zipWith = baseRest(function(arrays) {
10371             var length = arrays.length, iteratee2 = length > 1 ? arrays[length - 1] : undefined2;
10372             iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2;
10373             return unzipWith(arrays, iteratee2);
10374           });
10375           function chain(value) {
10376             var result2 = lodash(value);
10377             result2.__chain__ = true;
10378             return result2;
10379           }
10380           function tap(value, interceptor) {
10381             interceptor(value);
10382             return value;
10383           }
10384           function thru(value, interceptor) {
10385             return interceptor(value);
10386           }
10387           var wrapperAt = flatRest(function(paths) {
10388             var length = paths.length, start2 = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
10389               return baseAt(object, paths);
10390             };
10391             if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex2(start2)) {
10392               return this.thru(interceptor);
10393             }
10394             value = value.slice(start2, +start2 + (length ? 1 : 0));
10395             value.__actions__.push({
10396               "func": thru,
10397               "args": [interceptor],
10398               "thisArg": undefined2
10399             });
10400             return new LodashWrapper(value, this.__chain__).thru(function(array2) {
10401               if (length && !array2.length) {
10402                 array2.push(undefined2);
10403               }
10404               return array2;
10405             });
10406           });
10407           function wrapperChain() {
10408             return chain(this);
10409           }
10410           function wrapperCommit() {
10411             return new LodashWrapper(this.value(), this.__chain__);
10412           }
10413           function wrapperNext() {
10414             if (this.__values__ === undefined2) {
10415               this.__values__ = toArray(this.value());
10416             }
10417             var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++];
10418             return { "done": done, "value": value };
10419           }
10420           function wrapperToIterator() {
10421             return this;
10422           }
10423           function wrapperPlant(value) {
10424             var result2, parent2 = this;
10425             while (parent2 instanceof baseLodash) {
10426               var clone2 = wrapperClone(parent2);
10427               clone2.__index__ = 0;
10428               clone2.__values__ = undefined2;
10429               if (result2) {
10430                 previous.__wrapped__ = clone2;
10431               } else {
10432                 result2 = clone2;
10433               }
10434               var previous = clone2;
10435               parent2 = parent2.__wrapped__;
10436             }
10437             previous.__wrapped__ = value;
10438             return result2;
10439           }
10440           function wrapperReverse() {
10441             var value = this.__wrapped__;
10442             if (value instanceof LazyWrapper) {
10443               var wrapped = value;
10444               if (this.__actions__.length) {
10445                 wrapped = new LazyWrapper(this);
10446               }
10447               wrapped = wrapped.reverse();
10448               wrapped.__actions__.push({
10449                 "func": thru,
10450                 "args": [reverse],
10451                 "thisArg": undefined2
10452               });
10453               return new LodashWrapper(wrapped, this.__chain__);
10454             }
10455             return this.thru(reverse);
10456           }
10457           function wrapperValue() {
10458             return baseWrapperValue(this.__wrapped__, this.__actions__);
10459           }
10460           var countBy = createAggregator(function(result2, value, key) {
10461             if (hasOwnProperty10.call(result2, key)) {
10462               ++result2[key];
10463             } else {
10464               baseAssignValue(result2, key, 1);
10465             }
10466           });
10467           function every(collection, predicate, guard) {
10468             var func = isArray2(collection) ? arrayEvery : baseEvery;
10469             if (guard && isIterateeCall(collection, predicate, guard)) {
10470               predicate = undefined2;
10471             }
10472             return func(collection, getIteratee(predicate, 3));
10473           }
10474           function filter2(collection, predicate) {
10475             var func = isArray2(collection) ? arrayFilter2 : baseFilter;
10476             return func(collection, getIteratee(predicate, 3));
10477           }
10478           var find2 = createFind(findIndex);
10479           var findLast = createFind(findLastIndex);
10480           function flatMap(collection, iteratee2) {
10481             return baseFlatten(map2(collection, iteratee2), 1);
10482           }
10483           function flatMapDeep(collection, iteratee2) {
10484             return baseFlatten(map2(collection, iteratee2), INFINITY2);
10485           }
10486           function flatMapDepth(collection, iteratee2, depth) {
10487             depth = depth === undefined2 ? 1 : toInteger(depth);
10488             return baseFlatten(map2(collection, iteratee2), depth);
10489           }
10490           function forEach(collection, iteratee2) {
10491             var func = isArray2(collection) ? arrayEach : baseEach;
10492             return func(collection, getIteratee(iteratee2, 3));
10493           }
10494           function forEachRight(collection, iteratee2) {
10495             var func = isArray2(collection) ? arrayEachRight : baseEachRight;
10496             return func(collection, getIteratee(iteratee2, 3));
10497           }
10498           var groupBy = createAggregator(function(result2, value, key) {
10499             if (hasOwnProperty10.call(result2, key)) {
10500               result2[key].push(value);
10501             } else {
10502               baseAssignValue(result2, key, [value]);
10503             }
10504           });
10505           function includes(collection, value, fromIndex, guard) {
10506             collection = isArrayLike2(collection) ? collection : values(collection);
10507             fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
10508             var length = collection.length;
10509             if (fromIndex < 0) {
10510               fromIndex = nativeMax2(length + fromIndex, 0);
10511             }
10512             return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
10513           }
10514           var invokeMap = baseRest(function(collection, path, args) {
10515             var index = -1, isFunc = typeof path == "function", result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
10516             baseEach(collection, function(value) {
10517               result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
10518             });
10519             return result2;
10520           });
10521           var keyBy = createAggregator(function(result2, value, key) {
10522             baseAssignValue(result2, key, value);
10523           });
10524           function map2(collection, iteratee2) {
10525             var func = isArray2(collection) ? arrayMap2 : baseMap;
10526             return func(collection, getIteratee(iteratee2, 3));
10527           }
10528           function orderBy(collection, iteratees, orders, guard) {
10529             if (collection == null) {
10530               return [];
10531             }
10532             if (!isArray2(iteratees)) {
10533               iteratees = iteratees == null ? [] : [iteratees];
10534             }
10535             orders = guard ? undefined2 : orders;
10536             if (!isArray2(orders)) {
10537               orders = orders == null ? [] : [orders];
10538             }
10539             return baseOrderBy(collection, iteratees, orders);
10540           }
10541           var partition = createAggregator(function(result2, value, key) {
10542             result2[key ? 0 : 1].push(value);
10543           }, function() {
10544             return [[], []];
10545           });
10546           function reduce(collection, iteratee2, accumulator) {
10547             var func = isArray2(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
10548             return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach);
10549           }
10550           function reduceRight(collection, iteratee2, accumulator) {
10551             var func = isArray2(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
10552             return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
10553           }
10554           function reject(collection, predicate) {
10555             var func = isArray2(collection) ? arrayFilter2 : baseFilter;
10556             return func(collection, negate(getIteratee(predicate, 3)));
10557           }
10558           function sample(collection) {
10559             var func = isArray2(collection) ? arraySample : baseSample;
10560             return func(collection);
10561           }
10562           function sampleSize(collection, n3, guard) {
10563             if (guard ? isIterateeCall(collection, n3, guard) : n3 === undefined2) {
10564               n3 = 1;
10565             } else {
10566               n3 = toInteger(n3);
10567             }
10568             var func = isArray2(collection) ? arraySampleSize : baseSampleSize;
10569             return func(collection, n3);
10570           }
10571           function shuffle(collection) {
10572             var func = isArray2(collection) ? arrayShuffle : baseShuffle;
10573             return func(collection);
10574           }
10575           function size(collection) {
10576             if (collection == null) {
10577               return 0;
10578             }
10579             if (isArrayLike2(collection)) {
10580               return isString(collection) ? stringSize(collection) : collection.length;
10581             }
10582             var tag = getTag2(collection);
10583             if (tag == mapTag4 || tag == setTag4) {
10584               return collection.size;
10585             }
10586             return baseKeys2(collection).length;
10587           }
10588           function some(collection, predicate, guard) {
10589             var func = isArray2(collection) ? arraySome2 : baseSome;
10590             if (guard && isIterateeCall(collection, predicate, guard)) {
10591               predicate = undefined2;
10592             }
10593             return func(collection, getIteratee(predicate, 3));
10594           }
10595           var sortBy = baseRest(function(collection, iteratees) {
10596             if (collection == null) {
10597               return [];
10598             }
10599             var length = iteratees.length;
10600             if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
10601               iteratees = [];
10602             } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
10603               iteratees = [iteratees[0]];
10604             }
10605             return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
10606           });
10607           var now3 = ctxNow || function() {
10608             return root3.Date.now();
10609           };
10610           function after(n3, func) {
10611             if (typeof func != "function") {
10612               throw new TypeError2(FUNC_ERROR_TEXT3);
10613             }
10614             n3 = toInteger(n3);
10615             return function() {
10616               if (--n3 < 1) {
10617                 return func.apply(this, arguments);
10618               }
10619             };
10620           }
10621           function ary(func, n3, guard) {
10622             n3 = guard ? undefined2 : n3;
10623             n3 = func && n3 == null ? func.length : n3;
10624             return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n3);
10625           }
10626           function before(n3, func) {
10627             var result2;
10628             if (typeof func != "function") {
10629               throw new TypeError2(FUNC_ERROR_TEXT3);
10630             }
10631             n3 = toInteger(n3);
10632             return function() {
10633               if (--n3 > 0) {
10634                 result2 = func.apply(this, arguments);
10635               }
10636               if (n3 <= 1) {
10637                 func = undefined2;
10638               }
10639               return result2;
10640             };
10641           }
10642           var bind = baseRest(function(func, thisArg, partials) {
10643             var bitmask = WRAP_BIND_FLAG;
10644             if (partials.length) {
10645               var holders = replaceHolders(partials, getHolder(bind));
10646               bitmask |= WRAP_PARTIAL_FLAG;
10647             }
10648             return createWrap(func, bitmask, thisArg, partials, holders);
10649           });
10650           var bindKey2 = baseRest(function(object, key, partials) {
10651             var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
10652             if (partials.length) {
10653               var holders = replaceHolders(partials, getHolder(bindKey2));
10654               bitmask |= WRAP_PARTIAL_FLAG;
10655             }
10656             return createWrap(key, bitmask, object, partials, holders);
10657           });
10658           function curry(func, arity, guard) {
10659             arity = guard ? undefined2 : arity;
10660             var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
10661             result2.placeholder = curry.placeholder;
10662             return result2;
10663           }
10664           function curryRight(func, arity, guard) {
10665             arity = guard ? undefined2 : arity;
10666             var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
10667             result2.placeholder = curryRight.placeholder;
10668             return result2;
10669           }
10670           function debounce2(func, wait, options2) {
10671             var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
10672             if (typeof func != "function") {
10673               throw new TypeError2(FUNC_ERROR_TEXT3);
10674             }
10675             wait = toNumber3(wait) || 0;
10676             if (isObject3(options2)) {
10677               leading = !!options2.leading;
10678               maxing = "maxWait" in options2;
10679               maxWait = maxing ? nativeMax2(toNumber3(options2.maxWait) || 0, wait) : maxWait;
10680               trailing = "trailing" in options2 ? !!options2.trailing : trailing;
10681             }
10682             function invokeFunc(time) {
10683               var args = lastArgs, thisArg = lastThis;
10684               lastArgs = lastThis = undefined2;
10685               lastInvokeTime = time;
10686               result2 = func.apply(thisArg, args);
10687               return result2;
10688             }
10689             function leadingEdge(time) {
10690               lastInvokeTime = time;
10691               timerId = setTimeout2(timerExpired, wait);
10692               return leading ? invokeFunc(time) : result2;
10693             }
10694             function remainingWait(time) {
10695               var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
10696               return maxing ? nativeMin2(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
10697             }
10698             function shouldInvoke(time) {
10699               var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
10700               return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
10701             }
10702             function timerExpired() {
10703               var time = now3();
10704               if (shouldInvoke(time)) {
10705                 return trailingEdge(time);
10706               }
10707               timerId = setTimeout2(timerExpired, remainingWait(time));
10708             }
10709             function trailingEdge(time) {
10710               timerId = undefined2;
10711               if (trailing && lastArgs) {
10712                 return invokeFunc(time);
10713               }
10714               lastArgs = lastThis = undefined2;
10715               return result2;
10716             }
10717             function cancel() {
10718               if (timerId !== undefined2) {
10719                 clearTimeout2(timerId);
10720               }
10721               lastInvokeTime = 0;
10722               lastArgs = lastCallTime = lastThis = timerId = undefined2;
10723             }
10724             function flush() {
10725               return timerId === undefined2 ? result2 : trailingEdge(now3());
10726             }
10727             function debounced() {
10728               var time = now3(), isInvoking = shouldInvoke(time);
10729               lastArgs = arguments;
10730               lastThis = this;
10731               lastCallTime = time;
10732               if (isInvoking) {
10733                 if (timerId === undefined2) {
10734                   return leadingEdge(lastCallTime);
10735                 }
10736                 if (maxing) {
10737                   clearTimeout2(timerId);
10738                   timerId = setTimeout2(timerExpired, wait);
10739                   return invokeFunc(lastCallTime);
10740                 }
10741               }
10742               if (timerId === undefined2) {
10743                 timerId = setTimeout2(timerExpired, wait);
10744               }
10745               return result2;
10746             }
10747             debounced.cancel = cancel;
10748             debounced.flush = flush;
10749             return debounced;
10750           }
10751           var defer = baseRest(function(func, args) {
10752             return baseDelay(func, 1, args);
10753           });
10754           var delay = baseRest(function(func, wait, args) {
10755             return baseDelay(func, toNumber3(wait) || 0, args);
10756           });
10757           function flip(func) {
10758             return createWrap(func, WRAP_FLIP_FLAG);
10759           }
10760           function memoize(func, resolver) {
10761             if (typeof func != "function" || resolver != null && typeof resolver != "function") {
10762               throw new TypeError2(FUNC_ERROR_TEXT3);
10763             }
10764             var memoized = function() {
10765               var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
10766               if (cache.has(key)) {
10767                 return cache.get(key);
10768               }
10769               var result2 = func.apply(this, args);
10770               memoized.cache = cache.set(key, result2) || cache;
10771               return result2;
10772             };
10773             memoized.cache = new (memoize.Cache || MapCache2)();
10774             return memoized;
10775           }
10776           memoize.Cache = MapCache2;
10777           function negate(predicate) {
10778             if (typeof predicate != "function") {
10779               throw new TypeError2(FUNC_ERROR_TEXT3);
10780             }
10781             return function() {
10782               var args = arguments;
10783               switch (args.length) {
10784                 case 0:
10785                   return !predicate.call(this);
10786                 case 1:
10787                   return !predicate.call(this, args[0]);
10788                 case 2:
10789                   return !predicate.call(this, args[0], args[1]);
10790                 case 3:
10791                   return !predicate.call(this, args[0], args[1], args[2]);
10792               }
10793               return !predicate.apply(this, args);
10794             };
10795           }
10796           function once(func) {
10797             return before(2, func);
10798           }
10799           var overArgs = castRest(function(func, transforms) {
10800             transforms = transforms.length == 1 && isArray2(transforms[0]) ? arrayMap2(transforms[0], baseUnary2(getIteratee())) : arrayMap2(baseFlatten(transforms, 1), baseUnary2(getIteratee()));
10801             var funcsLength = transforms.length;
10802             return baseRest(function(args) {
10803               var index = -1, length = nativeMin2(args.length, funcsLength);
10804               while (++index < length) {
10805                 args[index] = transforms[index].call(this, args[index]);
10806               }
10807               return apply(func, this, args);
10808             });
10809           });
10810           var partial = baseRest(function(func, partials) {
10811             var holders = replaceHolders(partials, getHolder(partial));
10812             return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders);
10813           });
10814           var partialRight = baseRest(function(func, partials) {
10815             var holders = replaceHolders(partials, getHolder(partialRight));
10816             return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders);
10817           });
10818           var rearg = flatRest(function(func, indexes) {
10819             return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes);
10820           });
10821           function rest(func, start2) {
10822             if (typeof func != "function") {
10823               throw new TypeError2(FUNC_ERROR_TEXT3);
10824             }
10825             start2 = start2 === undefined2 ? start2 : toInteger(start2);
10826             return baseRest(func, start2);
10827           }
10828           function spread(func, start2) {
10829             if (typeof func != "function") {
10830               throw new TypeError2(FUNC_ERROR_TEXT3);
10831             }
10832             start2 = start2 == null ? 0 : nativeMax2(toInteger(start2), 0);
10833             return baseRest(function(args) {
10834               var array2 = args[start2], otherArgs = castSlice(args, 0, start2);
10835               if (array2) {
10836                 arrayPush2(otherArgs, array2);
10837               }
10838               return apply(func, this, otherArgs);
10839             });
10840           }
10841           function throttle2(func, wait, options2) {
10842             var leading = true, trailing = true;
10843             if (typeof func != "function") {
10844               throw new TypeError2(FUNC_ERROR_TEXT3);
10845             }
10846             if (isObject3(options2)) {
10847               leading = "leading" in options2 ? !!options2.leading : leading;
10848               trailing = "trailing" in options2 ? !!options2.trailing : trailing;
10849             }
10850             return debounce2(func, wait, {
10851               "leading": leading,
10852               "maxWait": wait,
10853               "trailing": trailing
10854             });
10855           }
10856           function unary(func) {
10857             return ary(func, 1);
10858           }
10859           function wrap2(value, wrapper) {
10860             return partial(castFunction(wrapper), value);
10861           }
10862           function castArray() {
10863             if (!arguments.length) {
10864               return [];
10865             }
10866             var value = arguments[0];
10867             return isArray2(value) ? value : [value];
10868           }
10869           function clone(value) {
10870             return baseClone(value, CLONE_SYMBOLS_FLAG);
10871           }
10872           function cloneWith(value, customizer) {
10873             customizer = typeof customizer == "function" ? customizer : undefined2;
10874             return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
10875           }
10876           function cloneDeep(value) {
10877             return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
10878           }
10879           function cloneDeepWith(value, customizer) {
10880             customizer = typeof customizer == "function" ? customizer : undefined2;
10881             return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
10882           }
10883           function conformsTo(object, source) {
10884             return source == null || baseConformsTo(object, source, keys2(source));
10885           }
10886           function eq2(value, other) {
10887             return value === other || value !== value && other !== other;
10888           }
10889           var gt2 = createRelationalOperation(baseGt);
10890           var gte = createRelationalOperation(function(value, other) {
10891             return value >= other;
10892           });
10893           var isArguments2 = baseIsArguments2(function() {
10894             return arguments;
10895           }()) ? baseIsArguments2 : function(value) {
10896             return isObjectLike2(value) && hasOwnProperty10.call(value, "callee") && !propertyIsEnumerable3.call(value, "callee");
10897           };
10898           var isArray2 = Array2.isArray;
10899           var isArrayBuffer = nodeIsArrayBuffer ? baseUnary2(nodeIsArrayBuffer) : baseIsArrayBuffer;
10900           function isArrayLike2(value) {
10901             return value != null && isLength2(value.length) && !isFunction2(value);
10902           }
10903           function isArrayLikeObject(value) {
10904             return isObjectLike2(value) && isArrayLike2(value);
10905           }
10906           function isBoolean(value) {
10907             return value === true || value === false || isObjectLike2(value) && baseGetTag2(value) == boolTag3;
10908           }
10909           var isBuffer2 = nativeIsBuffer2 || stubFalse2;
10910           var isDate = nodeIsDate ? baseUnary2(nodeIsDate) : baseIsDate;
10911           function isElement2(value) {
10912             return isObjectLike2(value) && value.nodeType === 1 && !isPlainObject(value);
10913           }
10914           function isEmpty(value) {
10915             if (value == null) {
10916               return true;
10917             }
10918             if (isArrayLike2(value) && (isArray2(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer2(value) || isTypedArray2(value) || isArguments2(value))) {
10919               return !value.length;
10920             }
10921             var tag = getTag2(value);
10922             if (tag == mapTag4 || tag == setTag4) {
10923               return !value.size;
10924             }
10925             if (isPrototype2(value)) {
10926               return !baseKeys2(value).length;
10927             }
10928             for (var key in value) {
10929               if (hasOwnProperty10.call(value, key)) {
10930                 return false;
10931               }
10932             }
10933             return true;
10934           }
10935           function isEqual4(value, other) {
10936             return baseIsEqual2(value, other);
10937           }
10938           function isEqualWith(value, other, customizer) {
10939             customizer = typeof customizer == "function" ? customizer : undefined2;
10940             var result2 = customizer ? customizer(value, other) : undefined2;
10941             return result2 === undefined2 ? baseIsEqual2(value, other, undefined2, customizer) : !!result2;
10942           }
10943           function isError(value) {
10944             if (!isObjectLike2(value)) {
10945               return false;
10946             }
10947             var tag = baseGetTag2(value);
10948             return tag == errorTag3 || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
10949           }
10950           function isFinite2(value) {
10951             return typeof value == "number" && nativeIsFinite(value);
10952           }
10953           function isFunction2(value) {
10954             if (!isObject3(value)) {
10955               return false;
10956             }
10957             var tag = baseGetTag2(value);
10958             return tag == funcTag3 || tag == genTag2 || tag == asyncTag2 || tag == proxyTag2;
10959           }
10960           function isInteger(value) {
10961             return typeof value == "number" && value == toInteger(value);
10962           }
10963           function isLength2(value) {
10964             return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER3;
10965           }
10966           function isObject3(value) {
10967             var type2 = typeof value;
10968             return value != null && (type2 == "object" || type2 == "function");
10969           }
10970           function isObjectLike2(value) {
10971             return value != null && typeof value == "object";
10972           }
10973           var isMap = nodeIsMap ? baseUnary2(nodeIsMap) : baseIsMap;
10974           function isMatch(object, source) {
10975             return object === source || baseIsMatch(object, source, getMatchData(source));
10976           }
10977           function isMatchWith(object, source, customizer) {
10978             customizer = typeof customizer == "function" ? customizer : undefined2;
10979             return baseIsMatch(object, source, getMatchData(source), customizer);
10980           }
10981           function isNaN2(value) {
10982             return isNumber3(value) && value != +value;
10983           }
10984           function isNative(value) {
10985             if (isMaskable(value)) {
10986               throw new Error2(CORE_ERROR_TEXT);
10987             }
10988             return baseIsNative2(value);
10989           }
10990           function isNull(value) {
10991             return value === null;
10992           }
10993           function isNil(value) {
10994             return value == null;
10995           }
10996           function isNumber3(value) {
10997             return typeof value == "number" || isObjectLike2(value) && baseGetTag2(value) == numberTag4;
10998           }
10999           function isPlainObject(value) {
11000             if (!isObjectLike2(value) || baseGetTag2(value) != objectTag4) {
11001               return false;
11002             }
11003             var proto = getPrototype(value);
11004             if (proto === null) {
11005               return true;
11006             }
11007             var Ctor = hasOwnProperty10.call(proto, "constructor") && proto.constructor;
11008             return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString;
11009           }
11010           var isRegExp = nodeIsRegExp ? baseUnary2(nodeIsRegExp) : baseIsRegExp;
11011           function isSafeInteger(value) {
11012             return isInteger(value) && value >= -MAX_SAFE_INTEGER3 && value <= MAX_SAFE_INTEGER3;
11013           }
11014           var isSet = nodeIsSet ? baseUnary2(nodeIsSet) : baseIsSet;
11015           function isString(value) {
11016             return typeof value == "string" || !isArray2(value) && isObjectLike2(value) && baseGetTag2(value) == stringTag3;
11017           }
11018           function isSymbol2(value) {
11019             return typeof value == "symbol" || isObjectLike2(value) && baseGetTag2(value) == symbolTag3;
11020           }
11021           var isTypedArray2 = nodeIsTypedArray2 ? baseUnary2(nodeIsTypedArray2) : baseIsTypedArray2;
11022           function isUndefined(value) {
11023             return value === undefined2;
11024           }
11025           function isWeakMap(value) {
11026             return isObjectLike2(value) && getTag2(value) == weakMapTag3;
11027           }
11028           function isWeakSet(value) {
11029             return isObjectLike2(value) && baseGetTag2(value) == weakSetTag;
11030           }
11031           var lt2 = createRelationalOperation(baseLt);
11032           var lte = createRelationalOperation(function(value, other) {
11033             return value <= other;
11034           });
11035           function toArray(value) {
11036             if (!value) {
11037               return [];
11038             }
11039             if (isArrayLike2(value)) {
11040               return isString(value) ? stringToArray(value) : copyArray(value);
11041             }
11042             if (symIterator && value[symIterator]) {
11043               return iteratorToArray(value[symIterator]());
11044             }
11045             var tag = getTag2(value), func = tag == mapTag4 ? mapToArray2 : tag == setTag4 ? setToArray2 : values;
11046             return func(value);
11047           }
11048           function toFinite(value) {
11049             if (!value) {
11050               return value === 0 ? value : 0;
11051             }
11052             value = toNumber3(value);
11053             if (value === INFINITY2 || value === -INFINITY2) {
11054               var sign2 = value < 0 ? -1 : 1;
11055               return sign2 * MAX_INTEGER;
11056             }
11057             return value === value ? value : 0;
11058           }
11059           function toInteger(value) {
11060             var result2 = toFinite(value), remainder = result2 % 1;
11061             return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
11062           }
11063           function toLength(value) {
11064             return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
11065           }
11066           function toNumber3(value) {
11067             if (typeof value == "number") {
11068               return value;
11069             }
11070             if (isSymbol2(value)) {
11071               return NAN2;
11072             }
11073             if (isObject3(value)) {
11074               var other = typeof value.valueOf == "function" ? value.valueOf() : value;
11075               value = isObject3(other) ? other + "" : other;
11076             }
11077             if (typeof value != "string") {
11078               return value === 0 ? value : +value;
11079             }
11080             value = baseTrim2(value);
11081             var isBinary = reIsBinary2.test(value);
11082             return isBinary || reIsOctal2.test(value) ? freeParseInt2(value.slice(2), isBinary ? 2 : 8) : reIsBadHex2.test(value) ? NAN2 : +value;
11083           }
11084           function toPlainObject(value) {
11085             return copyObject(value, keysIn(value));
11086           }
11087           function toSafeInteger(value) {
11088             return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER3, MAX_SAFE_INTEGER3) : value === 0 ? value : 0;
11089           }
11090           function toString2(value) {
11091             return value == null ? "" : baseToString2(value);
11092           }
11093           var assign = createAssigner(function(object, source) {
11094             if (isPrototype2(source) || isArrayLike2(source)) {
11095               copyObject(source, keys2(source), object);
11096               return;
11097             }
11098             for (var key in source) {
11099               if (hasOwnProperty10.call(source, key)) {
11100                 assignValue(object, key, source[key]);
11101               }
11102             }
11103           });
11104           var assignIn = createAssigner(function(object, source) {
11105             copyObject(source, keysIn(source), object);
11106           });
11107           var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
11108             copyObject(source, keysIn(source), object, customizer);
11109           });
11110           var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
11111             copyObject(source, keys2(source), object, customizer);
11112           });
11113           var at2 = flatRest(baseAt);
11114           function create2(prototype, properties) {
11115             var result2 = baseCreate(prototype);
11116             return properties == null ? result2 : baseAssign(result2, properties);
11117           }
11118           var defaults = baseRest(function(object, sources) {
11119             object = Object2(object);
11120             var index = -1;
11121             var length = sources.length;
11122             var guard = length > 2 ? sources[2] : undefined2;
11123             if (guard && isIterateeCall(sources[0], sources[1], guard)) {
11124               length = 1;
11125             }
11126             while (++index < length) {
11127               var source = sources[index];
11128               var props = keysIn(source);
11129               var propsIndex = -1;
11130               var propsLength = props.length;
11131               while (++propsIndex < propsLength) {
11132                 var key = props[propsIndex];
11133                 var value = object[key];
11134                 if (value === undefined2 || eq2(value, objectProto13[key]) && !hasOwnProperty10.call(object, key)) {
11135                   object[key] = source[key];
11136                 }
11137               }
11138             }
11139             return object;
11140           });
11141           var defaultsDeep = baseRest(function(args) {
11142             args.push(undefined2, customDefaultsMerge);
11143             return apply(mergeWith, undefined2, args);
11144           });
11145           function findKey(object, predicate) {
11146             return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
11147           }
11148           function findLastKey(object, predicate) {
11149             return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
11150           }
11151           function forIn(object, iteratee2) {
11152             return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn);
11153           }
11154           function forInRight(object, iteratee2) {
11155             return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn);
11156           }
11157           function forOwn(object, iteratee2) {
11158             return object && baseForOwn(object, getIteratee(iteratee2, 3));
11159           }
11160           function forOwnRight(object, iteratee2) {
11161             return object && baseForOwnRight(object, getIteratee(iteratee2, 3));
11162           }
11163           function functions(object) {
11164             return object == null ? [] : baseFunctions(object, keys2(object));
11165           }
11166           function functionsIn(object) {
11167             return object == null ? [] : baseFunctions(object, keysIn(object));
11168           }
11169           function get4(object, path, defaultValue) {
11170             var result2 = object == null ? undefined2 : baseGet(object, path);
11171             return result2 === undefined2 ? defaultValue : result2;
11172           }
11173           function has(object, path) {
11174             return object != null && hasPath(object, path, baseHas);
11175           }
11176           function hasIn(object, path) {
11177             return object != null && hasPath(object, path, baseHasIn);
11178           }
11179           var invert = createInverter(function(result2, value, key) {
11180             if (value != null && typeof value.toString != "function") {
11181               value = nativeObjectToString3.call(value);
11182             }
11183             result2[value] = key;
11184           }, constant(identity4));
11185           var invertBy = createInverter(function(result2, value, key) {
11186             if (value != null && typeof value.toString != "function") {
11187               value = nativeObjectToString3.call(value);
11188             }
11189             if (hasOwnProperty10.call(result2, value)) {
11190               result2[value].push(key);
11191             } else {
11192               result2[value] = [key];
11193             }
11194           }, getIteratee);
11195           var invoke = baseRest(baseInvoke);
11196           function keys2(object) {
11197             return isArrayLike2(object) ? arrayLikeKeys2(object) : baseKeys2(object);
11198           }
11199           function keysIn(object) {
11200             return isArrayLike2(object) ? arrayLikeKeys2(object, true) : baseKeysIn(object);
11201           }
11202           function mapKeys(object, iteratee2) {
11203             var result2 = {};
11204             iteratee2 = getIteratee(iteratee2, 3);
11205             baseForOwn(object, function(value, key, object2) {
11206               baseAssignValue(result2, iteratee2(value, key, object2), value);
11207             });
11208             return result2;
11209           }
11210           function mapValues(object, iteratee2) {
11211             var result2 = {};
11212             iteratee2 = getIteratee(iteratee2, 3);
11213             baseForOwn(object, function(value, key, object2) {
11214               baseAssignValue(result2, key, iteratee2(value, key, object2));
11215             });
11216             return result2;
11217           }
11218           var merge2 = createAssigner(function(object, source, srcIndex) {
11219             baseMerge(object, source, srcIndex);
11220           });
11221           var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
11222             baseMerge(object, source, srcIndex, customizer);
11223           });
11224           var omit = flatRest(function(object, paths) {
11225             var result2 = {};
11226             if (object == null) {
11227               return result2;
11228             }
11229             var isDeep = false;
11230             paths = arrayMap2(paths, function(path) {
11231               path = castPath(path, object);
11232               isDeep || (isDeep = path.length > 1);
11233               return path;
11234             });
11235             copyObject(object, getAllKeysIn(object), result2);
11236             if (isDeep) {
11237               result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
11238             }
11239             var length = paths.length;
11240             while (length--) {
11241               baseUnset(result2, paths[length]);
11242             }
11243             return result2;
11244           });
11245           function omitBy(object, predicate) {
11246             return pickBy(object, negate(getIteratee(predicate)));
11247           }
11248           var pick = flatRest(function(object, paths) {
11249             return object == null ? {} : basePick(object, paths);
11250           });
11251           function pickBy(object, predicate) {
11252             if (object == null) {
11253               return {};
11254             }
11255             var props = arrayMap2(getAllKeysIn(object), function(prop) {
11256               return [prop];
11257             });
11258             predicate = getIteratee(predicate);
11259             return basePickBy(object, props, function(value, path) {
11260               return predicate(value, path[0]);
11261             });
11262           }
11263           function result(object, path, defaultValue) {
11264             path = castPath(path, object);
11265             var index = -1, length = path.length;
11266             if (!length) {
11267               length = 1;
11268               object = undefined2;
11269             }
11270             while (++index < length) {
11271               var value = object == null ? undefined2 : object[toKey(path[index])];
11272               if (value === undefined2) {
11273                 index = length;
11274                 value = defaultValue;
11275               }
11276               object = isFunction2(value) ? value.call(object) : value;
11277             }
11278             return object;
11279           }
11280           function set3(object, path, value) {
11281             return object == null ? object : baseSet(object, path, value);
11282           }
11283           function setWith(object, path, value, customizer) {
11284             customizer = typeof customizer == "function" ? customizer : undefined2;
11285             return object == null ? object : baseSet(object, path, value, customizer);
11286           }
11287           var toPairs = createToPairs(keys2);
11288           var toPairsIn = createToPairs(keysIn);
11289           function transform2(object, iteratee2, accumulator) {
11290             var isArr = isArray2(object), isArrLike = isArr || isBuffer2(object) || isTypedArray2(object);
11291             iteratee2 = getIteratee(iteratee2, 4);
11292             if (accumulator == null) {
11293               var Ctor = object && object.constructor;
11294               if (isArrLike) {
11295                 accumulator = isArr ? new Ctor() : [];
11296               } else if (isObject3(object)) {
11297                 accumulator = isFunction2(Ctor) ? baseCreate(getPrototype(object)) : {};
11298               } else {
11299                 accumulator = {};
11300               }
11301             }
11302             (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
11303               return iteratee2(accumulator, value, index, object2);
11304             });
11305             return accumulator;
11306           }
11307           function unset(object, path) {
11308             return object == null ? true : baseUnset(object, path);
11309           }
11310           function update(object, path, updater) {
11311             return object == null ? object : baseUpdate(object, path, castFunction(updater));
11312           }
11313           function updateWith(object, path, updater, customizer) {
11314             customizer = typeof customizer == "function" ? customizer : undefined2;
11315             return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
11316           }
11317           function values(object) {
11318             return object == null ? [] : baseValues(object, keys2(object));
11319           }
11320           function valuesIn(object) {
11321             return object == null ? [] : baseValues(object, keysIn(object));
11322           }
11323           function clamp3(number3, lower2, upper) {
11324             if (upper === undefined2) {
11325               upper = lower2;
11326               lower2 = undefined2;
11327             }
11328             if (upper !== undefined2) {
11329               upper = toNumber3(upper);
11330               upper = upper === upper ? upper : 0;
11331             }
11332             if (lower2 !== undefined2) {
11333               lower2 = toNumber3(lower2);
11334               lower2 = lower2 === lower2 ? lower2 : 0;
11335             }
11336             return baseClamp(toNumber3(number3), lower2, upper);
11337           }
11338           function inRange(number3, start2, end) {
11339             start2 = toFinite(start2);
11340             if (end === undefined2) {
11341               end = start2;
11342               start2 = 0;
11343             } else {
11344               end = toFinite(end);
11345             }
11346             number3 = toNumber3(number3);
11347             return baseInRange(number3, start2, end);
11348           }
11349           function random(lower2, upper, floating) {
11350             if (floating && typeof floating != "boolean" && isIterateeCall(lower2, upper, floating)) {
11351               upper = floating = undefined2;
11352             }
11353             if (floating === undefined2) {
11354               if (typeof upper == "boolean") {
11355                 floating = upper;
11356                 upper = undefined2;
11357               } else if (typeof lower2 == "boolean") {
11358                 floating = lower2;
11359                 lower2 = undefined2;
11360               }
11361             }
11362             if (lower2 === undefined2 && upper === undefined2) {
11363               lower2 = 0;
11364               upper = 1;
11365             } else {
11366               lower2 = toFinite(lower2);
11367               if (upper === undefined2) {
11368                 upper = lower2;
11369                 lower2 = 0;
11370               } else {
11371                 upper = toFinite(upper);
11372               }
11373             }
11374             if (lower2 > upper) {
11375               var temp = lower2;
11376               lower2 = upper;
11377               upper = temp;
11378             }
11379             if (floating || lower2 % 1 || upper % 1) {
11380               var rand = nativeRandom();
11381               return nativeMin2(lower2 + rand * (upper - lower2 + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
11382             }
11383             return baseRandom(lower2, upper);
11384           }
11385           var camelCase = createCompounder(function(result2, word, index) {
11386             word = word.toLowerCase();
11387             return result2 + (index ? capitalize(word) : word);
11388           });
11389           function capitalize(string) {
11390             return upperFirst(toString2(string).toLowerCase());
11391           }
11392           function deburr(string) {
11393             string = toString2(string);
11394             return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
11395           }
11396           function endsWith(string, target, position) {
11397             string = toString2(string);
11398             target = baseToString2(target);
11399             var length = string.length;
11400             position = position === undefined2 ? length : baseClamp(toInteger(position), 0, length);
11401             var end = position;
11402             position -= target.length;
11403             return position >= 0 && string.slice(position, end) == target;
11404           }
11405           function escape6(string) {
11406             string = toString2(string);
11407             return string && reHasUnescapedHtml2.test(string) ? string.replace(reUnescapedHtml2, escapeHtmlChar2) : string;
11408           }
11409           function escapeRegExp(string) {
11410             string = toString2(string);
11411             return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar2, "\\$&") : string;
11412           }
11413           var kebabCase = createCompounder(function(result2, word, index) {
11414             return result2 + (index ? "-" : "") + word.toLowerCase();
11415           });
11416           var lowerCase = createCompounder(function(result2, word, index) {
11417             return result2 + (index ? " " : "") + word.toLowerCase();
11418           });
11419           var lowerFirst = createCaseFirst("toLowerCase");
11420           function pad2(string, length, chars) {
11421             string = toString2(string);
11422             length = toInteger(length);
11423             var strLength = length ? stringSize(string) : 0;
11424             if (!length || strLength >= length) {
11425               return string;
11426             }
11427             var mid = (length - strLength) / 2;
11428             return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars);
11429           }
11430           function padEnd(string, length, chars) {
11431             string = toString2(string);
11432             length = toInteger(length);
11433             var strLength = length ? stringSize(string) : 0;
11434             return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
11435           }
11436           function padStart(string, length, chars) {
11437             string = toString2(string);
11438             length = toInteger(length);
11439             var strLength = length ? stringSize(string) : 0;
11440             return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
11441           }
11442           function parseInt2(string, radix, guard) {
11443             if (guard || radix == null) {
11444               radix = 0;
11445             } else if (radix) {
11446               radix = +radix;
11447             }
11448             return nativeParseInt(toString2(string).replace(reTrimStart2, ""), radix || 0);
11449           }
11450           function repeat(string, n3, guard) {
11451             if (guard ? isIterateeCall(string, n3, guard) : n3 === undefined2) {
11452               n3 = 1;
11453             } else {
11454               n3 = toInteger(n3);
11455             }
11456             return baseRepeat(toString2(string), n3);
11457           }
11458           function replace() {
11459             var args = arguments, string = toString2(args[0]);
11460             return args.length < 3 ? string : string.replace(args[1], args[2]);
11461           }
11462           var snakeCase = createCompounder(function(result2, word, index) {
11463             return result2 + (index ? "_" : "") + word.toLowerCase();
11464           });
11465           function split(string, separator, limit) {
11466             if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
11467               separator = limit = undefined2;
11468             }
11469             limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0;
11470             if (!limit) {
11471               return [];
11472             }
11473             string = toString2(string);
11474             if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
11475               separator = baseToString2(separator);
11476               if (!separator && hasUnicode(string)) {
11477                 return castSlice(stringToArray(string), 0, limit);
11478               }
11479             }
11480             return string.split(separator, limit);
11481           }
11482           var startCase = createCompounder(function(result2, word, index) {
11483             return result2 + (index ? " " : "") + upperFirst(word);
11484           });
11485           function startsWith(string, target, position) {
11486             string = toString2(string);
11487             position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
11488             target = baseToString2(target);
11489             return string.slice(position, position + target.length) == target;
11490           }
11491           function template(string, options2, guard) {
11492             var settings = lodash.templateSettings;
11493             if (guard && isIterateeCall(string, options2, guard)) {
11494               options2 = undefined2;
11495             }
11496             string = toString2(string);
11497             options2 = assignInWith({}, options2, settings, customDefaultsAssignIn);
11498             var imports = assignInWith({}, options2.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys2(imports), importsValues = baseValues(imports, importsKeys);
11499             var isEscaping, isEvaluating, index = 0, interpolate = options2.interpolate || reNoMatch, source = "__p += '";
11500             var reDelimiters = RegExp2(
11501               (options2.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options2.evaluate || reNoMatch).source + "|$",
11502               "g"
11503             );
11504             var sourceURL = "//# sourceURL=" + (hasOwnProperty10.call(options2, "sourceURL") ? (options2.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
11505             string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
11506               interpolateValue || (interpolateValue = esTemplateValue);
11507               source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
11508               if (escapeValue) {
11509                 isEscaping = true;
11510                 source += "' +\n__e(" + escapeValue + ") +\n'";
11511               }
11512               if (evaluateValue) {
11513                 isEvaluating = true;
11514                 source += "';\n" + evaluateValue + ";\n__p += '";
11515               }
11516               if (interpolateValue) {
11517                 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
11518               }
11519               index = offset + match.length;
11520               return match;
11521             });
11522             source += "';\n";
11523             var variable = hasOwnProperty10.call(options2, "variable") && options2.variable;
11524             if (!variable) {
11525               source = "with (obj) {\n" + source + "\n}\n";
11526             } else if (reForbiddenIdentifierChars.test(variable)) {
11527               throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
11528             }
11529             source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
11530             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}";
11531             var result2 = attempt(function() {
11532               return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues);
11533             });
11534             result2.source = source;
11535             if (isError(result2)) {
11536               throw result2;
11537             }
11538             return result2;
11539           }
11540           function toLower(value) {
11541             return toString2(value).toLowerCase();
11542           }
11543           function toUpper(value) {
11544             return toString2(value).toUpperCase();
11545           }
11546           function trim(string, chars, guard) {
11547             string = toString2(string);
11548             if (string && (guard || chars === undefined2)) {
11549               return baseTrim2(string);
11550             }
11551             if (!string || !(chars = baseToString2(chars))) {
11552               return string;
11553             }
11554             var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start2 = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
11555             return castSlice(strSymbols, start2, end).join("");
11556           }
11557           function trimEnd(string, chars, guard) {
11558             string = toString2(string);
11559             if (string && (guard || chars === undefined2)) {
11560               return string.slice(0, trimmedEndIndex2(string) + 1);
11561             }
11562             if (!string || !(chars = baseToString2(chars))) {
11563               return string;
11564             }
11565             var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
11566             return castSlice(strSymbols, 0, end).join("");
11567           }
11568           function trimStart(string, chars, guard) {
11569             string = toString2(string);
11570             if (string && (guard || chars === undefined2)) {
11571               return string.replace(reTrimStart2, "");
11572             }
11573             if (!string || !(chars = baseToString2(chars))) {
11574               return string;
11575             }
11576             var strSymbols = stringToArray(string), start2 = charsStartIndex(strSymbols, stringToArray(chars));
11577             return castSlice(strSymbols, start2).join("");
11578           }
11579           function truncate(string, options2) {
11580             var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
11581             if (isObject3(options2)) {
11582               var separator = "separator" in options2 ? options2.separator : separator;
11583               length = "length" in options2 ? toInteger(options2.length) : length;
11584               omission = "omission" in options2 ? baseToString2(options2.omission) : omission;
11585             }
11586             string = toString2(string);
11587             var strLength = string.length;
11588             if (hasUnicode(string)) {
11589               var strSymbols = stringToArray(string);
11590               strLength = strSymbols.length;
11591             }
11592             if (length >= strLength) {
11593               return string;
11594             }
11595             var end = length - stringSize(omission);
11596             if (end < 1) {
11597               return omission;
11598             }
11599             var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
11600             if (separator === undefined2) {
11601               return result2 + omission;
11602             }
11603             if (strSymbols) {
11604               end += result2.length - end;
11605             }
11606             if (isRegExp(separator)) {
11607               if (string.slice(end).search(separator)) {
11608                 var match, substring = result2;
11609                 if (!separator.global) {
11610                   separator = RegExp2(separator.source, toString2(reFlags.exec(separator)) + "g");
11611                 }
11612                 separator.lastIndex = 0;
11613                 while (match = separator.exec(substring)) {
11614                   var newEnd = match.index;
11615                 }
11616                 result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd);
11617               }
11618             } else if (string.indexOf(baseToString2(separator), end) != end) {
11619               var index = result2.lastIndexOf(separator);
11620               if (index > -1) {
11621                 result2 = result2.slice(0, index);
11622               }
11623             }
11624             return result2 + omission;
11625           }
11626           function unescape4(string) {
11627             string = toString2(string);
11628             return string && reHasEscapedHtml2.test(string) ? string.replace(reEscapedHtml2, unescapeHtmlChar2) : string;
11629           }
11630           var upperCase = createCompounder(function(result2, word, index) {
11631             return result2 + (index ? " " : "") + word.toUpperCase();
11632           });
11633           var upperFirst = createCaseFirst("toUpperCase");
11634           function words(string, pattern, guard) {
11635             string = toString2(string);
11636             pattern = guard ? undefined2 : pattern;
11637             if (pattern === undefined2) {
11638               return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
11639             }
11640             return string.match(pattern) || [];
11641           }
11642           var attempt = baseRest(function(func, args) {
11643             try {
11644               return apply(func, undefined2, args);
11645             } catch (e3) {
11646               return isError(e3) ? e3 : new Error2(e3);
11647             }
11648           });
11649           var bindAll = flatRest(function(object, methodNames) {
11650             arrayEach(methodNames, function(key) {
11651               key = toKey(key);
11652               baseAssignValue(object, key, bind(object[key], object));
11653             });
11654             return object;
11655           });
11656           function cond(pairs2) {
11657             var length = pairs2 == null ? 0 : pairs2.length, toIteratee = getIteratee();
11658             pairs2 = !length ? [] : arrayMap2(pairs2, function(pair3) {
11659               if (typeof pair3[1] != "function") {
11660                 throw new TypeError2(FUNC_ERROR_TEXT3);
11661               }
11662               return [toIteratee(pair3[0]), pair3[1]];
11663             });
11664             return baseRest(function(args) {
11665               var index = -1;
11666               while (++index < length) {
11667                 var pair3 = pairs2[index];
11668                 if (apply(pair3[0], this, args)) {
11669                   return apply(pair3[1], this, args);
11670                 }
11671               }
11672             });
11673           }
11674           function conforms(source) {
11675             return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
11676           }
11677           function constant(value) {
11678             return function() {
11679               return value;
11680             };
11681           }
11682           function defaultTo(value, defaultValue) {
11683             return value == null || value !== value ? defaultValue : value;
11684           }
11685           var flow = createFlow();
11686           var flowRight = createFlow(true);
11687           function identity4(value) {
11688             return value;
11689           }
11690           function iteratee(func) {
11691             return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG));
11692           }
11693           function matches(source) {
11694             return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
11695           }
11696           function matchesProperty(path, srcValue) {
11697             return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
11698           }
11699           var method = baseRest(function(path, args) {
11700             return function(object) {
11701               return baseInvoke(object, path, args);
11702             };
11703           });
11704           var methodOf = baseRest(function(object, args) {
11705             return function(path) {
11706               return baseInvoke(object, path, args);
11707             };
11708           });
11709           function mixin(object, source, options2) {
11710             var props = keys2(source), methodNames = baseFunctions(source, props);
11711             if (options2 == null && !(isObject3(source) && (methodNames.length || !props.length))) {
11712               options2 = source;
11713               source = object;
11714               object = this;
11715               methodNames = baseFunctions(source, keys2(source));
11716             }
11717             var chain2 = !(isObject3(options2) && "chain" in options2) || !!options2.chain, isFunc = isFunction2(object);
11718             arrayEach(methodNames, function(methodName) {
11719               var func = source[methodName];
11720               object[methodName] = func;
11721               if (isFunc) {
11722                 object.prototype[methodName] = function() {
11723                   var chainAll = this.__chain__;
11724                   if (chain2 || chainAll) {
11725                     var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__);
11726                     actions.push({ "func": func, "args": arguments, "thisArg": object });
11727                     result2.__chain__ = chainAll;
11728                     return result2;
11729                   }
11730                   return func.apply(object, arrayPush2([this.value()], arguments));
11731                 };
11732               }
11733             });
11734             return object;
11735           }
11736           function noConflict() {
11737             if (root3._ === this) {
11738               root3._ = oldDash;
11739             }
11740             return this;
11741           }
11742           function noop3() {
11743           }
11744           function nthArg(n3) {
11745             n3 = toInteger(n3);
11746             return baseRest(function(args) {
11747               return baseNth(args, n3);
11748             });
11749           }
11750           var over = createOver(arrayMap2);
11751           var overEvery = createOver(arrayEvery);
11752           var overSome = createOver(arraySome2);
11753           function property(path) {
11754             return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
11755           }
11756           function propertyOf(object) {
11757             return function(path) {
11758               return object == null ? undefined2 : baseGet(object, path);
11759             };
11760           }
11761           var range3 = createRange();
11762           var rangeRight = createRange(true);
11763           function stubArray2() {
11764             return [];
11765           }
11766           function stubFalse2() {
11767             return false;
11768           }
11769           function stubObject() {
11770             return {};
11771           }
11772           function stubString() {
11773             return "";
11774           }
11775           function stubTrue() {
11776             return true;
11777           }
11778           function times(n3, iteratee2) {
11779             n3 = toInteger(n3);
11780             if (n3 < 1 || n3 > MAX_SAFE_INTEGER3) {
11781               return [];
11782             }
11783             var index = MAX_ARRAY_LENGTH, length = nativeMin2(n3, MAX_ARRAY_LENGTH);
11784             iteratee2 = getIteratee(iteratee2);
11785             n3 -= MAX_ARRAY_LENGTH;
11786             var result2 = baseTimes2(length, iteratee2);
11787             while (++index < n3) {
11788               iteratee2(index);
11789             }
11790             return result2;
11791           }
11792           function toPath(value) {
11793             if (isArray2(value)) {
11794               return arrayMap2(value, toKey);
11795             }
11796             return isSymbol2(value) ? [value] : copyArray(stringToPath(toString2(value)));
11797           }
11798           function uniqueId(prefix) {
11799             var id2 = ++idCounter;
11800             return toString2(prefix) + id2;
11801           }
11802           var add = createMathOperation(function(augend, addend) {
11803             return augend + addend;
11804           }, 0);
11805           var ceil = createRound("ceil");
11806           var divide = createMathOperation(function(dividend, divisor) {
11807             return dividend / divisor;
11808           }, 1);
11809           var floor = createRound("floor");
11810           function max3(array2) {
11811             return array2 && array2.length ? baseExtremum(array2, identity4, baseGt) : undefined2;
11812           }
11813           function maxBy(array2, iteratee2) {
11814             return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseGt) : undefined2;
11815           }
11816           function mean(array2) {
11817             return baseMean(array2, identity4);
11818           }
11819           function meanBy(array2, iteratee2) {
11820             return baseMean(array2, getIteratee(iteratee2, 2));
11821           }
11822           function min3(array2) {
11823             return array2 && array2.length ? baseExtremum(array2, identity4, baseLt) : undefined2;
11824           }
11825           function minBy(array2, iteratee2) {
11826             return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseLt) : undefined2;
11827           }
11828           var multiply = createMathOperation(function(multiplier, multiplicand) {
11829             return multiplier * multiplicand;
11830           }, 1);
11831           var round = createRound("round");
11832           var subtract = createMathOperation(function(minuend, subtrahend) {
11833             return minuend - subtrahend;
11834           }, 0);
11835           function sum(array2) {
11836             return array2 && array2.length ? baseSum(array2, identity4) : 0;
11837           }
11838           function sumBy(array2, iteratee2) {
11839             return array2 && array2.length ? baseSum(array2, getIteratee(iteratee2, 2)) : 0;
11840           }
11841           lodash.after = after;
11842           lodash.ary = ary;
11843           lodash.assign = assign;
11844           lodash.assignIn = assignIn;
11845           lodash.assignInWith = assignInWith;
11846           lodash.assignWith = assignWith;
11847           lodash.at = at2;
11848           lodash.before = before;
11849           lodash.bind = bind;
11850           lodash.bindAll = bindAll;
11851           lodash.bindKey = bindKey2;
11852           lodash.castArray = castArray;
11853           lodash.chain = chain;
11854           lodash.chunk = chunk;
11855           lodash.compact = compact;
11856           lodash.concat = concat;
11857           lodash.cond = cond;
11858           lodash.conforms = conforms;
11859           lodash.constant = constant;
11860           lodash.countBy = countBy;
11861           lodash.create = create2;
11862           lodash.curry = curry;
11863           lodash.curryRight = curryRight;
11864           lodash.debounce = debounce2;
11865           lodash.defaults = defaults;
11866           lodash.defaultsDeep = defaultsDeep;
11867           lodash.defer = defer;
11868           lodash.delay = delay;
11869           lodash.difference = difference;
11870           lodash.differenceBy = differenceBy;
11871           lodash.differenceWith = differenceWith;
11872           lodash.drop = drop;
11873           lodash.dropRight = dropRight;
11874           lodash.dropRightWhile = dropRightWhile;
11875           lodash.dropWhile = dropWhile;
11876           lodash.fill = fill;
11877           lodash.filter = filter2;
11878           lodash.flatMap = flatMap;
11879           lodash.flatMapDeep = flatMapDeep;
11880           lodash.flatMapDepth = flatMapDepth;
11881           lodash.flatten = flatten2;
11882           lodash.flattenDeep = flattenDeep;
11883           lodash.flattenDepth = flattenDepth;
11884           lodash.flip = flip;
11885           lodash.flow = flow;
11886           lodash.flowRight = flowRight;
11887           lodash.fromPairs = fromPairs;
11888           lodash.functions = functions;
11889           lodash.functionsIn = functionsIn;
11890           lodash.groupBy = groupBy;
11891           lodash.initial = initial;
11892           lodash.intersection = intersection;
11893           lodash.intersectionBy = intersectionBy;
11894           lodash.intersectionWith = intersectionWith;
11895           lodash.invert = invert;
11896           lodash.invertBy = invertBy;
11897           lodash.invokeMap = invokeMap;
11898           lodash.iteratee = iteratee;
11899           lodash.keyBy = keyBy;
11900           lodash.keys = keys2;
11901           lodash.keysIn = keysIn;
11902           lodash.map = map2;
11903           lodash.mapKeys = mapKeys;
11904           lodash.mapValues = mapValues;
11905           lodash.matches = matches;
11906           lodash.matchesProperty = matchesProperty;
11907           lodash.memoize = memoize;
11908           lodash.merge = merge2;
11909           lodash.mergeWith = mergeWith;
11910           lodash.method = method;
11911           lodash.methodOf = methodOf;
11912           lodash.mixin = mixin;
11913           lodash.negate = negate;
11914           lodash.nthArg = nthArg;
11915           lodash.omit = omit;
11916           lodash.omitBy = omitBy;
11917           lodash.once = once;
11918           lodash.orderBy = orderBy;
11919           lodash.over = over;
11920           lodash.overArgs = overArgs;
11921           lodash.overEvery = overEvery;
11922           lodash.overSome = overSome;
11923           lodash.partial = partial;
11924           lodash.partialRight = partialRight;
11925           lodash.partition = partition;
11926           lodash.pick = pick;
11927           lodash.pickBy = pickBy;
11928           lodash.property = property;
11929           lodash.propertyOf = propertyOf;
11930           lodash.pull = pull;
11931           lodash.pullAll = pullAll;
11932           lodash.pullAllBy = pullAllBy;
11933           lodash.pullAllWith = pullAllWith;
11934           lodash.pullAt = pullAt;
11935           lodash.range = range3;
11936           lodash.rangeRight = rangeRight;
11937           lodash.rearg = rearg;
11938           lodash.reject = reject;
11939           lodash.remove = remove2;
11940           lodash.rest = rest;
11941           lodash.reverse = reverse;
11942           lodash.sampleSize = sampleSize;
11943           lodash.set = set3;
11944           lodash.setWith = setWith;
11945           lodash.shuffle = shuffle;
11946           lodash.slice = slice;
11947           lodash.sortBy = sortBy;
11948           lodash.sortedUniq = sortedUniq;
11949           lodash.sortedUniqBy = sortedUniqBy;
11950           lodash.split = split;
11951           lodash.spread = spread;
11952           lodash.tail = tail;
11953           lodash.take = take;
11954           lodash.takeRight = takeRight;
11955           lodash.takeRightWhile = takeRightWhile;
11956           lodash.takeWhile = takeWhile;
11957           lodash.tap = tap;
11958           lodash.throttle = throttle2;
11959           lodash.thru = thru;
11960           lodash.toArray = toArray;
11961           lodash.toPairs = toPairs;
11962           lodash.toPairsIn = toPairsIn;
11963           lodash.toPath = toPath;
11964           lodash.toPlainObject = toPlainObject;
11965           lodash.transform = transform2;
11966           lodash.unary = unary;
11967           lodash.union = union;
11968           lodash.unionBy = unionBy;
11969           lodash.unionWith = unionWith;
11970           lodash.uniq = uniq;
11971           lodash.uniqBy = uniqBy;
11972           lodash.uniqWith = uniqWith;
11973           lodash.unset = unset;
11974           lodash.unzip = unzip;
11975           lodash.unzipWith = unzipWith;
11976           lodash.update = update;
11977           lodash.updateWith = updateWith;
11978           lodash.values = values;
11979           lodash.valuesIn = valuesIn;
11980           lodash.without = without;
11981           lodash.words = words;
11982           lodash.wrap = wrap2;
11983           lodash.xor = xor;
11984           lodash.xorBy = xorBy;
11985           lodash.xorWith = xorWith;
11986           lodash.zip = zip;
11987           lodash.zipObject = zipObject;
11988           lodash.zipObjectDeep = zipObjectDeep;
11989           lodash.zipWith = zipWith;
11990           lodash.entries = toPairs;
11991           lodash.entriesIn = toPairsIn;
11992           lodash.extend = assignIn;
11993           lodash.extendWith = assignInWith;
11994           mixin(lodash, lodash);
11995           lodash.add = add;
11996           lodash.attempt = attempt;
11997           lodash.camelCase = camelCase;
11998           lodash.capitalize = capitalize;
11999           lodash.ceil = ceil;
12000           lodash.clamp = clamp3;
12001           lodash.clone = clone;
12002           lodash.cloneDeep = cloneDeep;
12003           lodash.cloneDeepWith = cloneDeepWith;
12004           lodash.cloneWith = cloneWith;
12005           lodash.conformsTo = conformsTo;
12006           lodash.deburr = deburr;
12007           lodash.defaultTo = defaultTo;
12008           lodash.divide = divide;
12009           lodash.endsWith = endsWith;
12010           lodash.eq = eq2;
12011           lodash.escape = escape6;
12012           lodash.escapeRegExp = escapeRegExp;
12013           lodash.every = every;
12014           lodash.find = find2;
12015           lodash.findIndex = findIndex;
12016           lodash.findKey = findKey;
12017           lodash.findLast = findLast;
12018           lodash.findLastIndex = findLastIndex;
12019           lodash.findLastKey = findLastKey;
12020           lodash.floor = floor;
12021           lodash.forEach = forEach;
12022           lodash.forEachRight = forEachRight;
12023           lodash.forIn = forIn;
12024           lodash.forInRight = forInRight;
12025           lodash.forOwn = forOwn;
12026           lodash.forOwnRight = forOwnRight;
12027           lodash.get = get4;
12028           lodash.gt = gt2;
12029           lodash.gte = gte;
12030           lodash.has = has;
12031           lodash.hasIn = hasIn;
12032           lodash.head = head;
12033           lodash.identity = identity4;
12034           lodash.includes = includes;
12035           lodash.indexOf = indexOf;
12036           lodash.inRange = inRange;
12037           lodash.invoke = invoke;
12038           lodash.isArguments = isArguments2;
12039           lodash.isArray = isArray2;
12040           lodash.isArrayBuffer = isArrayBuffer;
12041           lodash.isArrayLike = isArrayLike2;
12042           lodash.isArrayLikeObject = isArrayLikeObject;
12043           lodash.isBoolean = isBoolean;
12044           lodash.isBuffer = isBuffer2;
12045           lodash.isDate = isDate;
12046           lodash.isElement = isElement2;
12047           lodash.isEmpty = isEmpty;
12048           lodash.isEqual = isEqual4;
12049           lodash.isEqualWith = isEqualWith;
12050           lodash.isError = isError;
12051           lodash.isFinite = isFinite2;
12052           lodash.isFunction = isFunction2;
12053           lodash.isInteger = isInteger;
12054           lodash.isLength = isLength2;
12055           lodash.isMap = isMap;
12056           lodash.isMatch = isMatch;
12057           lodash.isMatchWith = isMatchWith;
12058           lodash.isNaN = isNaN2;
12059           lodash.isNative = isNative;
12060           lodash.isNil = isNil;
12061           lodash.isNull = isNull;
12062           lodash.isNumber = isNumber3;
12063           lodash.isObject = isObject3;
12064           lodash.isObjectLike = isObjectLike2;
12065           lodash.isPlainObject = isPlainObject;
12066           lodash.isRegExp = isRegExp;
12067           lodash.isSafeInteger = isSafeInteger;
12068           lodash.isSet = isSet;
12069           lodash.isString = isString;
12070           lodash.isSymbol = isSymbol2;
12071           lodash.isTypedArray = isTypedArray2;
12072           lodash.isUndefined = isUndefined;
12073           lodash.isWeakMap = isWeakMap;
12074           lodash.isWeakSet = isWeakSet;
12075           lodash.join = join;
12076           lodash.kebabCase = kebabCase;
12077           lodash.last = last;
12078           lodash.lastIndexOf = lastIndexOf;
12079           lodash.lowerCase = lowerCase;
12080           lodash.lowerFirst = lowerFirst;
12081           lodash.lt = lt2;
12082           lodash.lte = lte;
12083           lodash.max = max3;
12084           lodash.maxBy = maxBy;
12085           lodash.mean = mean;
12086           lodash.meanBy = meanBy;
12087           lodash.min = min3;
12088           lodash.minBy = minBy;
12089           lodash.stubArray = stubArray2;
12090           lodash.stubFalse = stubFalse2;
12091           lodash.stubObject = stubObject;
12092           lodash.stubString = stubString;
12093           lodash.stubTrue = stubTrue;
12094           lodash.multiply = multiply;
12095           lodash.nth = nth;
12096           lodash.noConflict = noConflict;
12097           lodash.noop = noop3;
12098           lodash.now = now3;
12099           lodash.pad = pad2;
12100           lodash.padEnd = padEnd;
12101           lodash.padStart = padStart;
12102           lodash.parseInt = parseInt2;
12103           lodash.random = random;
12104           lodash.reduce = reduce;
12105           lodash.reduceRight = reduceRight;
12106           lodash.repeat = repeat;
12107           lodash.replace = replace;
12108           lodash.result = result;
12109           lodash.round = round;
12110           lodash.runInContext = runInContext2;
12111           lodash.sample = sample;
12112           lodash.size = size;
12113           lodash.snakeCase = snakeCase;
12114           lodash.some = some;
12115           lodash.sortedIndex = sortedIndex;
12116           lodash.sortedIndexBy = sortedIndexBy;
12117           lodash.sortedIndexOf = sortedIndexOf;
12118           lodash.sortedLastIndex = sortedLastIndex;
12119           lodash.sortedLastIndexBy = sortedLastIndexBy;
12120           lodash.sortedLastIndexOf = sortedLastIndexOf;
12121           lodash.startCase = startCase;
12122           lodash.startsWith = startsWith;
12123           lodash.subtract = subtract;
12124           lodash.sum = sum;
12125           lodash.sumBy = sumBy;
12126           lodash.template = template;
12127           lodash.times = times;
12128           lodash.toFinite = toFinite;
12129           lodash.toInteger = toInteger;
12130           lodash.toLength = toLength;
12131           lodash.toLower = toLower;
12132           lodash.toNumber = toNumber3;
12133           lodash.toSafeInteger = toSafeInteger;
12134           lodash.toString = toString2;
12135           lodash.toUpper = toUpper;
12136           lodash.trim = trim;
12137           lodash.trimEnd = trimEnd;
12138           lodash.trimStart = trimStart;
12139           lodash.truncate = truncate;
12140           lodash.unescape = unescape4;
12141           lodash.uniqueId = uniqueId;
12142           lodash.upperCase = upperCase;
12143           lodash.upperFirst = upperFirst;
12144           lodash.each = forEach;
12145           lodash.eachRight = forEachRight;
12146           lodash.first = head;
12147           mixin(lodash, function() {
12148             var source = {};
12149             baseForOwn(lodash, function(func, methodName) {
12150               if (!hasOwnProperty10.call(lodash.prototype, methodName)) {
12151                 source[methodName] = func;
12152               }
12153             });
12154             return source;
12155           }(), { "chain": false });
12156           lodash.VERSION = VERSION;
12157           arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
12158             lodash[methodName].placeholder = lodash;
12159           });
12160           arrayEach(["drop", "take"], function(methodName, index) {
12161             LazyWrapper.prototype[methodName] = function(n3) {
12162               n3 = n3 === undefined2 ? 1 : nativeMax2(toInteger(n3), 0);
12163               var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
12164               if (result2.__filtered__) {
12165                 result2.__takeCount__ = nativeMin2(n3, result2.__takeCount__);
12166               } else {
12167                 result2.__views__.push({
12168                   "size": nativeMin2(n3, MAX_ARRAY_LENGTH),
12169                   "type": methodName + (result2.__dir__ < 0 ? "Right" : "")
12170                 });
12171               }
12172               return result2;
12173             };
12174             LazyWrapper.prototype[methodName + "Right"] = function(n3) {
12175               return this.reverse()[methodName](n3).reverse();
12176             };
12177           });
12178           arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
12179             var type2 = index + 1, isFilter = type2 == LAZY_FILTER_FLAG || type2 == LAZY_WHILE_FLAG;
12180             LazyWrapper.prototype[methodName] = function(iteratee2) {
12181               var result2 = this.clone();
12182               result2.__iteratees__.push({
12183                 "iteratee": getIteratee(iteratee2, 3),
12184                 "type": type2
12185               });
12186               result2.__filtered__ = result2.__filtered__ || isFilter;
12187               return result2;
12188             };
12189           });
12190           arrayEach(["head", "last"], function(methodName, index) {
12191             var takeName = "take" + (index ? "Right" : "");
12192             LazyWrapper.prototype[methodName] = function() {
12193               return this[takeName](1).value()[0];
12194             };
12195           });
12196           arrayEach(["initial", "tail"], function(methodName, index) {
12197             var dropName = "drop" + (index ? "" : "Right");
12198             LazyWrapper.prototype[methodName] = function() {
12199               return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
12200             };
12201           });
12202           LazyWrapper.prototype.compact = function() {
12203             return this.filter(identity4);
12204           };
12205           LazyWrapper.prototype.find = function(predicate) {
12206             return this.filter(predicate).head();
12207           };
12208           LazyWrapper.prototype.findLast = function(predicate) {
12209             return this.reverse().find(predicate);
12210           };
12211           LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
12212             if (typeof path == "function") {
12213               return new LazyWrapper(this);
12214             }
12215             return this.map(function(value) {
12216               return baseInvoke(value, path, args);
12217             });
12218           });
12219           LazyWrapper.prototype.reject = function(predicate) {
12220             return this.filter(negate(getIteratee(predicate)));
12221           };
12222           LazyWrapper.prototype.slice = function(start2, end) {
12223             start2 = toInteger(start2);
12224             var result2 = this;
12225             if (result2.__filtered__ && (start2 > 0 || end < 0)) {
12226               return new LazyWrapper(result2);
12227             }
12228             if (start2 < 0) {
12229               result2 = result2.takeRight(-start2);
12230             } else if (start2) {
12231               result2 = result2.drop(start2);
12232             }
12233             if (end !== undefined2) {
12234               end = toInteger(end);
12235               result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start2);
12236             }
12237             return result2;
12238           };
12239           LazyWrapper.prototype.takeRightWhile = function(predicate) {
12240             return this.reverse().takeWhile(predicate).reverse();
12241           };
12242           LazyWrapper.prototype.toArray = function() {
12243             return this.take(MAX_ARRAY_LENGTH);
12244           };
12245           baseForOwn(LazyWrapper.prototype, function(func, methodName) {
12246             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);
12247             if (!lodashFunc) {
12248               return;
12249             }
12250             lodash.prototype[methodName] = function() {
12251               var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray2(value);
12252               var interceptor = function(value2) {
12253                 var result3 = lodashFunc.apply(lodash, arrayPush2([value2], args));
12254                 return isTaker && chainAll ? result3[0] : result3;
12255               };
12256               if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
12257                 isLazy = useLazy = false;
12258               }
12259               var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
12260               if (!retUnwrapped && useLazy) {
12261                 value = onlyLazy ? value : new LazyWrapper(this);
12262                 var result2 = func.apply(value, args);
12263                 result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 });
12264                 return new LodashWrapper(result2, chainAll);
12265               }
12266               if (isUnwrapped && onlyLazy) {
12267                 return func.apply(this, args);
12268               }
12269               result2 = this.thru(interceptor);
12270               return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
12271             };
12272           });
12273           arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
12274             var func = arrayProto2[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
12275             lodash.prototype[methodName] = function() {
12276               var args = arguments;
12277               if (retUnwrapped && !this.__chain__) {
12278                 var value = this.value();
12279                 return func.apply(isArray2(value) ? value : [], args);
12280               }
12281               return this[chainName](function(value2) {
12282                 return func.apply(isArray2(value2) ? value2 : [], args);
12283               });
12284             };
12285           });
12286           baseForOwn(LazyWrapper.prototype, function(func, methodName) {
12287             var lodashFunc = lodash[methodName];
12288             if (lodashFunc) {
12289               var key = lodashFunc.name + "";
12290               if (!hasOwnProperty10.call(realNames, key)) {
12291                 realNames[key] = [];
12292               }
12293               realNames[key].push({ "name": methodName, "func": lodashFunc });
12294             }
12295           });
12296           realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{
12297             "name": "wrapper",
12298             "func": undefined2
12299           }];
12300           LazyWrapper.prototype.clone = lazyClone;
12301           LazyWrapper.prototype.reverse = lazyReverse;
12302           LazyWrapper.prototype.value = lazyValue;
12303           lodash.prototype.at = wrapperAt;
12304           lodash.prototype.chain = wrapperChain;
12305           lodash.prototype.commit = wrapperCommit;
12306           lodash.prototype.next = wrapperNext;
12307           lodash.prototype.plant = wrapperPlant;
12308           lodash.prototype.reverse = wrapperReverse;
12309           lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
12310           lodash.prototype.first = lodash.prototype.head;
12311           if (symIterator) {
12312             lodash.prototype[symIterator] = wrapperToIterator;
12313           }
12314           return lodash;
12315         };
12316         var _2 = runInContext();
12317         if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
12318           root3._ = _2;
12319           define(function() {
12320             return _2;
12321           });
12322         } else if (freeModule3) {
12323           (freeModule3.exports = _2)._ = _2;
12324           freeExports3._ = _2;
12325         } else {
12326           root3._ = _2;
12327         }
12328       }).call(exports2);
12329     }
12330   });
12331
12332   // node_modules/fast-deep-equal/index.js
12333   var require_fast_deep_equal = __commonJS({
12334     "node_modules/fast-deep-equal/index.js"(exports2, module2) {
12335       "use strict";
12336       module2.exports = function equal(a2, b2) {
12337         if (a2 === b2)
12338           return true;
12339         if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") {
12340           if (a2.constructor !== b2.constructor)
12341             return false;
12342           var length, i3, keys2;
12343           if (Array.isArray(a2)) {
12344             length = a2.length;
12345             if (length != b2.length)
12346               return false;
12347             for (i3 = length; i3-- !== 0; )
12348               if (!equal(a2[i3], b2[i3]))
12349                 return false;
12350             return true;
12351           }
12352           if (a2.constructor === RegExp)
12353             return a2.source === b2.source && a2.flags === b2.flags;
12354           if (a2.valueOf !== Object.prototype.valueOf)
12355             return a2.valueOf() === b2.valueOf();
12356           if (a2.toString !== Object.prototype.toString)
12357             return a2.toString() === b2.toString();
12358           keys2 = Object.keys(a2);
12359           length = keys2.length;
12360           if (length !== Object.keys(b2).length)
12361             return false;
12362           for (i3 = length; i3-- !== 0; )
12363             if (!Object.prototype.hasOwnProperty.call(b2, keys2[i3]))
12364               return false;
12365           for (i3 = length; i3-- !== 0; ) {
12366             var key = keys2[i3];
12367             if (!equal(a2[key], b2[key]))
12368               return false;
12369           }
12370           return true;
12371         }
12372         return a2 !== a2 && b2 !== b2;
12373       };
12374     }
12375   });
12376
12377   // node_modules/rbush/rbush.min.js
12378   var require_rbush_min = __commonJS({
12379     "node_modules/rbush/rbush.min.js"(exports2, module2) {
12380       !function(t2, i3) {
12381         "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = i3() : "function" == typeof define && define.amd ? define(i3) : (t2 = t2 || self).RBush = i3();
12382       }(exports2, function() {
12383         "use strict";
12384         function t2(t3, r3, e4, a3, h3) {
12385           !function t4(n4, r4, e6, a4, h4) {
12386             for (; a4 > e6; ) {
12387               if (a4 - e6 > 600) {
12388                 var o3 = a4 - e6 + 1, s3 = r4 - e6 + 1, l3 = Math.log(o3), f4 = 0.5 * Math.exp(2 * l3 / 3), u3 = 0.5 * Math.sqrt(l3 * f4 * (o3 - f4) / o3) * (s3 - o3 / 2 < 0 ? -1 : 1), m3 = Math.max(e6, Math.floor(r4 - s3 * f4 / o3 + u3)), c3 = Math.min(a4, Math.floor(r4 + (o3 - s3) * f4 / o3 + u3));
12389                 t4(n4, r4, m3, c3, h4);
12390               }
12391               var p3 = n4[r4], d4 = e6, x2 = a4;
12392               for (i3(n4, e6, r4), h4(n4[a4], p3) > 0 && i3(n4, e6, a4); d4 < x2; ) {
12393                 for (i3(n4, d4, x2), d4++, x2--; h4(n4[d4], p3) < 0; )
12394                   d4++;
12395                 for (; h4(n4[x2], p3) > 0; )
12396                   x2--;
12397               }
12398               0 === h4(n4[e6], p3) ? i3(n4, e6, x2) : i3(n4, ++x2, a4), x2 <= r4 && (e6 = x2 + 1), r4 <= x2 && (a4 = x2 - 1);
12399             }
12400           }(t3, r3, e4 || 0, a3 || t3.length - 1, h3 || n3);
12401         }
12402         function i3(t3, i4, n4) {
12403           var r3 = t3[i4];
12404           t3[i4] = t3[n4], t3[n4] = r3;
12405         }
12406         function n3(t3, i4) {
12407           return t3 < i4 ? -1 : t3 > i4 ? 1 : 0;
12408         }
12409         var r2 = function(t3) {
12410           void 0 === t3 && (t3 = 9), this._maxEntries = Math.max(4, t3), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
12411         };
12412         function e3(t3, i4, n4) {
12413           if (!n4)
12414             return i4.indexOf(t3);
12415           for (var r3 = 0; r3 < i4.length; r3++)
12416             if (n4(t3, i4[r3]))
12417               return r3;
12418           return -1;
12419         }
12420         function a2(t3, i4) {
12421           h2(t3, 0, t3.children.length, i4, t3);
12422         }
12423         function h2(t3, i4, n4, r3, e4) {
12424           e4 || (e4 = p2(null)), e4.minX = 1 / 0, e4.minY = 1 / 0, e4.maxX = -1 / 0, e4.maxY = -1 / 0;
12425           for (var a3 = i4; a3 < n4; a3++) {
12426             var h3 = t3.children[a3];
12427             o2(e4, t3.leaf ? r3(h3) : h3);
12428           }
12429           return e4;
12430         }
12431         function o2(t3, i4) {
12432           return t3.minX = Math.min(t3.minX, i4.minX), t3.minY = Math.min(t3.minY, i4.minY), t3.maxX = Math.max(t3.maxX, i4.maxX), t3.maxY = Math.max(t3.maxY, i4.maxY), t3;
12433         }
12434         function s2(t3, i4) {
12435           return t3.minX - i4.minX;
12436         }
12437         function l2(t3, i4) {
12438           return t3.minY - i4.minY;
12439         }
12440         function f3(t3) {
12441           return (t3.maxX - t3.minX) * (t3.maxY - t3.minY);
12442         }
12443         function u2(t3) {
12444           return t3.maxX - t3.minX + (t3.maxY - t3.minY);
12445         }
12446         function m2(t3, i4) {
12447           return t3.minX <= i4.minX && t3.minY <= i4.minY && i4.maxX <= t3.maxX && i4.maxY <= t3.maxY;
12448         }
12449         function c2(t3, i4) {
12450           return i4.minX <= t3.maxX && i4.minY <= t3.maxY && i4.maxX >= t3.minX && i4.maxY >= t3.minY;
12451         }
12452         function p2(t3) {
12453           return { children: t3, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
12454         }
12455         function d2(i4, n4, r3, e4, a3) {
12456           for (var h3 = [n4, r3]; h3.length; )
12457             if (!((r3 = h3.pop()) - (n4 = h3.pop()) <= e4)) {
12458               var o3 = n4 + Math.ceil((r3 - n4) / e4 / 2) * e4;
12459               t2(i4, o3, n4, r3, a3), h3.push(n4, o3, o3, r3);
12460             }
12461         }
12462         return r2.prototype.all = function() {
12463           return this._all(this.data, []);
12464         }, r2.prototype.search = function(t3) {
12465           var i4 = this.data, n4 = [];
12466           if (!c2(t3, i4))
12467             return n4;
12468           for (var r3 = this.toBBox, e4 = []; i4; ) {
12469             for (var a3 = 0; a3 < i4.children.length; a3++) {
12470               var h3 = i4.children[a3], o3 = i4.leaf ? r3(h3) : h3;
12471               c2(t3, o3) && (i4.leaf ? n4.push(h3) : m2(t3, o3) ? this._all(h3, n4) : e4.push(h3));
12472             }
12473             i4 = e4.pop();
12474           }
12475           return n4;
12476         }, r2.prototype.collides = function(t3) {
12477           var i4 = this.data;
12478           if (!c2(t3, i4))
12479             return false;
12480           for (var n4 = []; i4; ) {
12481             for (var r3 = 0; r3 < i4.children.length; r3++) {
12482               var e4 = i4.children[r3], a3 = i4.leaf ? this.toBBox(e4) : e4;
12483               if (c2(t3, a3)) {
12484                 if (i4.leaf || m2(t3, a3))
12485                   return true;
12486                 n4.push(e4);
12487               }
12488             }
12489             i4 = n4.pop();
12490           }
12491           return false;
12492         }, r2.prototype.load = function(t3) {
12493           if (!t3 || !t3.length)
12494             return this;
12495           if (t3.length < this._minEntries) {
12496             for (var i4 = 0; i4 < t3.length; i4++)
12497               this.insert(t3[i4]);
12498             return this;
12499           }
12500           var n4 = this._build(t3.slice(), 0, t3.length - 1, 0);
12501           if (this.data.children.length)
12502             if (this.data.height === n4.height)
12503               this._splitRoot(this.data, n4);
12504             else {
12505               if (this.data.height < n4.height) {
12506                 var r3 = this.data;
12507                 this.data = n4, n4 = r3;
12508               }
12509               this._insert(n4, this.data.height - n4.height - 1, true);
12510             }
12511           else
12512             this.data = n4;
12513           return this;
12514         }, r2.prototype.insert = function(t3) {
12515           return t3 && this._insert(t3, this.data.height - 1), this;
12516         }, r2.prototype.clear = function() {
12517           return this.data = p2([]), this;
12518         }, r2.prototype.remove = function(t3, i4) {
12519           if (!t3)
12520             return this;
12521           for (var n4, r3, a3, h3 = this.data, o3 = this.toBBox(t3), s3 = [], l3 = []; h3 || s3.length; ) {
12522             if (h3 || (h3 = s3.pop(), r3 = s3[s3.length - 1], n4 = l3.pop(), a3 = true), h3.leaf) {
12523               var f4 = e3(t3, h3.children, i4);
12524               if (-1 !== f4)
12525                 return h3.children.splice(f4, 1), s3.push(h3), this._condense(s3), this;
12526             }
12527             a3 || h3.leaf || !m2(h3, o3) ? r3 ? (n4++, h3 = r3.children[n4], a3 = false) : h3 = null : (s3.push(h3), l3.push(n4), n4 = 0, r3 = h3, h3 = h3.children[0]);
12528           }
12529           return this;
12530         }, r2.prototype.toBBox = function(t3) {
12531           return t3;
12532         }, r2.prototype.compareMinX = function(t3, i4) {
12533           return t3.minX - i4.minX;
12534         }, r2.prototype.compareMinY = function(t3, i4) {
12535           return t3.minY - i4.minY;
12536         }, r2.prototype.toJSON = function() {
12537           return this.data;
12538         }, r2.prototype.fromJSON = function(t3) {
12539           return this.data = t3, this;
12540         }, r2.prototype._all = function(t3, i4) {
12541           for (var n4 = []; t3; )
12542             t3.leaf ? i4.push.apply(i4, t3.children) : n4.push.apply(n4, t3.children), t3 = n4.pop();
12543           return i4;
12544         }, r2.prototype._build = function(t3, i4, n4, r3) {
12545           var e4, h3 = n4 - i4 + 1, o3 = this._maxEntries;
12546           if (h3 <= o3)
12547             return a2(e4 = p2(t3.slice(i4, n4 + 1)), this.toBBox), e4;
12548           r3 || (r3 = Math.ceil(Math.log(h3) / Math.log(o3)), o3 = Math.ceil(h3 / Math.pow(o3, r3 - 1))), (e4 = p2([])).leaf = false, e4.height = r3;
12549           var s3 = Math.ceil(h3 / o3), l3 = s3 * Math.ceil(Math.sqrt(o3));
12550           d2(t3, i4, n4, l3, this.compareMinX);
12551           for (var f4 = i4; f4 <= n4; f4 += l3) {
12552             var u3 = Math.min(f4 + l3 - 1, n4);
12553             d2(t3, f4, u3, s3, this.compareMinY);
12554             for (var m3 = f4; m3 <= u3; m3 += s3) {
12555               var c3 = Math.min(m3 + s3 - 1, u3);
12556               e4.children.push(this._build(t3, m3, c3, r3 - 1));
12557             }
12558           }
12559           return a2(e4, this.toBBox), e4;
12560         }, r2.prototype._chooseSubtree = function(t3, i4, n4, r3) {
12561           for (; r3.push(i4), !i4.leaf && r3.length - 1 !== n4; ) {
12562             for (var e4 = 1 / 0, a3 = 1 / 0, h3 = void 0, o3 = 0; o3 < i4.children.length; o3++) {
12563               var s3 = i4.children[o3], l3 = f3(s3), u3 = (m3 = t3, c3 = s3, (Math.max(c3.maxX, m3.maxX) - Math.min(c3.minX, m3.minX)) * (Math.max(c3.maxY, m3.maxY) - Math.min(c3.minY, m3.minY)) - l3);
12564               u3 < a3 ? (a3 = u3, e4 = l3 < e4 ? l3 : e4, h3 = s3) : u3 === a3 && l3 < e4 && (e4 = l3, h3 = s3);
12565             }
12566             i4 = h3 || i4.children[0];
12567           }
12568           var m3, c3;
12569           return i4;
12570         }, r2.prototype._insert = function(t3, i4, n4) {
12571           var r3 = n4 ? t3 : this.toBBox(t3), e4 = [], a3 = this._chooseSubtree(r3, this.data, i4, e4);
12572           for (a3.children.push(t3), o2(a3, r3); i4 >= 0 && e4[i4].children.length > this._maxEntries; )
12573             this._split(e4, i4), i4--;
12574           this._adjustParentBBoxes(r3, e4, i4);
12575         }, r2.prototype._split = function(t3, i4) {
12576           var n4 = t3[i4], r3 = n4.children.length, e4 = this._minEntries;
12577           this._chooseSplitAxis(n4, e4, r3);
12578           var h3 = this._chooseSplitIndex(n4, e4, r3), o3 = p2(n4.children.splice(h3, n4.children.length - h3));
12579           o3.height = n4.height, o3.leaf = n4.leaf, a2(n4, this.toBBox), a2(o3, this.toBBox), i4 ? t3[i4 - 1].children.push(o3) : this._splitRoot(n4, o3);
12580         }, r2.prototype._splitRoot = function(t3, i4) {
12581           this.data = p2([t3, i4]), this.data.height = t3.height + 1, this.data.leaf = false, a2(this.data, this.toBBox);
12582         }, r2.prototype._chooseSplitIndex = function(t3, i4, n4) {
12583           for (var r3, e4, a3, o3, s3, l3, u3, m3 = 1 / 0, c3 = 1 / 0, p3 = i4; p3 <= n4 - i4; p3++) {
12584             var d4 = h2(t3, 0, p3, this.toBBox), x2 = h2(t3, p3, n4, this.toBBox), v2 = (e4 = d4, a3 = x2, o3 = void 0, s3 = void 0, l3 = void 0, u3 = void 0, o3 = Math.max(e4.minX, a3.minX), s3 = Math.max(e4.minY, a3.minY), l3 = Math.min(e4.maxX, a3.maxX), u3 = Math.min(e4.maxY, a3.maxY), Math.max(0, l3 - o3) * Math.max(0, u3 - s3)), M2 = f3(d4) + f3(x2);
12585             v2 < m3 ? (m3 = v2, r3 = p3, c3 = M2 < c3 ? M2 : c3) : v2 === m3 && M2 < c3 && (c3 = M2, r3 = p3);
12586           }
12587           return r3 || n4 - i4;
12588         }, r2.prototype._chooseSplitAxis = function(t3, i4, n4) {
12589           var r3 = t3.leaf ? this.compareMinX : s2, e4 = t3.leaf ? this.compareMinY : l2;
12590           this._allDistMargin(t3, i4, n4, r3) < this._allDistMargin(t3, i4, n4, e4) && t3.children.sort(r3);
12591         }, r2.prototype._allDistMargin = function(t3, i4, n4, r3) {
12592           t3.children.sort(r3);
12593           for (var e4 = this.toBBox, a3 = h2(t3, 0, i4, e4), s3 = h2(t3, n4 - i4, n4, e4), l3 = u2(a3) + u2(s3), f4 = i4; f4 < n4 - i4; f4++) {
12594             var m3 = t3.children[f4];
12595             o2(a3, t3.leaf ? e4(m3) : m3), l3 += u2(a3);
12596           }
12597           for (var c3 = n4 - i4 - 1; c3 >= i4; c3--) {
12598             var p3 = t3.children[c3];
12599             o2(s3, t3.leaf ? e4(p3) : p3), l3 += u2(s3);
12600           }
12601           return l3;
12602         }, r2.prototype._adjustParentBBoxes = function(t3, i4, n4) {
12603           for (var r3 = n4; r3 >= 0; r3--)
12604             o2(i4[r3], t3);
12605         }, r2.prototype._condense = function(t3) {
12606           for (var i4 = t3.length - 1, n4 = void 0; i4 >= 0; i4--)
12607             0 === t3[i4].children.length ? i4 > 0 ? (n4 = t3[i4 - 1].children).splice(n4.indexOf(t3[i4]), 1) : this.clear() : a2(t3[i4], this.toBBox);
12608         }, r2;
12609       });
12610     }
12611   });
12612
12613   // node_modules/ieee754/index.js
12614   var require_ieee754 = __commonJS({
12615     "node_modules/ieee754/index.js"(exports2) {
12616       exports2.read = function(buffer, offset, isLE, mLen, nBytes) {
12617         var e3, m2;
12618         var eLen = nBytes * 8 - mLen - 1;
12619         var eMax = (1 << eLen) - 1;
12620         var eBias = eMax >> 1;
12621         var nBits = -7;
12622         var i3 = isLE ? nBytes - 1 : 0;
12623         var d2 = isLE ? -1 : 1;
12624         var s2 = buffer[offset + i3];
12625         i3 += d2;
12626         e3 = s2 & (1 << -nBits) - 1;
12627         s2 >>= -nBits;
12628         nBits += eLen;
12629         for (; nBits > 0; e3 = e3 * 256 + buffer[offset + i3], i3 += d2, nBits -= 8) {
12630         }
12631         m2 = e3 & (1 << -nBits) - 1;
12632         e3 >>= -nBits;
12633         nBits += mLen;
12634         for (; nBits > 0; m2 = m2 * 256 + buffer[offset + i3], i3 += d2, nBits -= 8) {
12635         }
12636         if (e3 === 0) {
12637           e3 = 1 - eBias;
12638         } else if (e3 === eMax) {
12639           return m2 ? NaN : (s2 ? -1 : 1) * Infinity;
12640         } else {
12641           m2 = m2 + Math.pow(2, mLen);
12642           e3 = e3 - eBias;
12643         }
12644         return (s2 ? -1 : 1) * m2 * Math.pow(2, e3 - mLen);
12645       };
12646       exports2.write = function(buffer, value, offset, isLE, mLen, nBytes) {
12647         var e3, m2, c2;
12648         var eLen = nBytes * 8 - mLen - 1;
12649         var eMax = (1 << eLen) - 1;
12650         var eBias = eMax >> 1;
12651         var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
12652         var i3 = isLE ? 0 : nBytes - 1;
12653         var d2 = isLE ? 1 : -1;
12654         var s2 = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
12655         value = Math.abs(value);
12656         if (isNaN(value) || value === Infinity) {
12657           m2 = isNaN(value) ? 1 : 0;
12658           e3 = eMax;
12659         } else {
12660           e3 = Math.floor(Math.log(value) / Math.LN2);
12661           if (value * (c2 = Math.pow(2, -e3)) < 1) {
12662             e3--;
12663             c2 *= 2;
12664           }
12665           if (e3 + eBias >= 1) {
12666             value += rt / c2;
12667           } else {
12668             value += rt * Math.pow(2, 1 - eBias);
12669           }
12670           if (value * c2 >= 2) {
12671             e3++;
12672             c2 /= 2;
12673           }
12674           if (e3 + eBias >= eMax) {
12675             m2 = 0;
12676             e3 = eMax;
12677           } else if (e3 + eBias >= 1) {
12678             m2 = (value * c2 - 1) * Math.pow(2, mLen);
12679             e3 = e3 + eBias;
12680           } else {
12681             m2 = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
12682             e3 = 0;
12683           }
12684         }
12685         for (; mLen >= 8; buffer[offset + i3] = m2 & 255, i3 += d2, m2 /= 256, mLen -= 8) {
12686         }
12687         e3 = e3 << mLen | m2;
12688         eLen += mLen;
12689         for (; eLen > 0; buffer[offset + i3] = e3 & 255, i3 += d2, e3 /= 256, eLen -= 8) {
12690         }
12691         buffer[offset + i3 - d2] |= s2 * 128;
12692       };
12693     }
12694   });
12695
12696   // node_modules/pbf/index.js
12697   var require_pbf = __commonJS({
12698     "node_modules/pbf/index.js"(exports2, module2) {
12699       "use strict";
12700       module2.exports = Pbf;
12701       var ieee754 = require_ieee754();
12702       function Pbf(buf) {
12703         this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);
12704         this.pos = 0;
12705         this.type = 0;
12706         this.length = this.buf.length;
12707       }
12708       Pbf.Varint = 0;
12709       Pbf.Fixed64 = 1;
12710       Pbf.Bytes = 2;
12711       Pbf.Fixed32 = 5;
12712       var SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
12713       var SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
12714       var TEXT_DECODER_MIN_LENGTH = 12;
12715       var utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf8");
12716       Pbf.prototype = {
12717         destroy: function() {
12718           this.buf = null;
12719         },
12720         // === READING =================================================================
12721         readFields: function(readField, result, end) {
12722           end = end || this.length;
12723           while (this.pos < end) {
12724             var val = this.readVarint(), tag = val >> 3, startPos = this.pos;
12725             this.type = val & 7;
12726             readField(tag, result, this);
12727             if (this.pos === startPos)
12728               this.skip(val);
12729           }
12730           return result;
12731         },
12732         readMessage: function(readField, result) {
12733           return this.readFields(readField, result, this.readVarint() + this.pos);
12734         },
12735         readFixed32: function() {
12736           var val = readUInt32(this.buf, this.pos);
12737           this.pos += 4;
12738           return val;
12739         },
12740         readSFixed32: function() {
12741           var val = readInt32(this.buf, this.pos);
12742           this.pos += 4;
12743           return val;
12744         },
12745         // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
12746         readFixed64: function() {
12747           var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
12748           this.pos += 8;
12749           return val;
12750         },
12751         readSFixed64: function() {
12752           var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
12753           this.pos += 8;
12754           return val;
12755         },
12756         readFloat: function() {
12757           var val = ieee754.read(this.buf, this.pos, true, 23, 4);
12758           this.pos += 4;
12759           return val;
12760         },
12761         readDouble: function() {
12762           var val = ieee754.read(this.buf, this.pos, true, 52, 8);
12763           this.pos += 8;
12764           return val;
12765         },
12766         readVarint: function(isSigned) {
12767           var buf = this.buf, val, b2;
12768           b2 = buf[this.pos++];
12769           val = b2 & 127;
12770           if (b2 < 128)
12771             return val;
12772           b2 = buf[this.pos++];
12773           val |= (b2 & 127) << 7;
12774           if (b2 < 128)
12775             return val;
12776           b2 = buf[this.pos++];
12777           val |= (b2 & 127) << 14;
12778           if (b2 < 128)
12779             return val;
12780           b2 = buf[this.pos++];
12781           val |= (b2 & 127) << 21;
12782           if (b2 < 128)
12783             return val;
12784           b2 = buf[this.pos];
12785           val |= (b2 & 15) << 28;
12786           return readVarintRemainder(val, isSigned, this);
12787         },
12788         readVarint64: function() {
12789           return this.readVarint(true);
12790         },
12791         readSVarint: function() {
12792           var num = this.readVarint();
12793           return num % 2 === 1 ? (num + 1) / -2 : num / 2;
12794         },
12795         readBoolean: function() {
12796           return Boolean(this.readVarint());
12797         },
12798         readString: function() {
12799           var end = this.readVarint() + this.pos;
12800           var pos = this.pos;
12801           this.pos = end;
12802           if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
12803             return readUtf8TextDecoder(this.buf, pos, end);
12804           }
12805           return readUtf8(this.buf, pos, end);
12806         },
12807         readBytes: function() {
12808           var end = this.readVarint() + this.pos, buffer = this.buf.subarray(this.pos, end);
12809           this.pos = end;
12810           return buffer;
12811         },
12812         // verbose for performance reasons; doesn't affect gzipped size
12813         readPackedVarint: function(arr, isSigned) {
12814           if (this.type !== Pbf.Bytes)
12815             return arr.push(this.readVarint(isSigned));
12816           var end = readPackedEnd(this);
12817           arr = arr || [];
12818           while (this.pos < end)
12819             arr.push(this.readVarint(isSigned));
12820           return arr;
12821         },
12822         readPackedSVarint: function(arr) {
12823           if (this.type !== Pbf.Bytes)
12824             return arr.push(this.readSVarint());
12825           var end = readPackedEnd(this);
12826           arr = arr || [];
12827           while (this.pos < end)
12828             arr.push(this.readSVarint());
12829           return arr;
12830         },
12831         readPackedBoolean: function(arr) {
12832           if (this.type !== Pbf.Bytes)
12833             return arr.push(this.readBoolean());
12834           var end = readPackedEnd(this);
12835           arr = arr || [];
12836           while (this.pos < end)
12837             arr.push(this.readBoolean());
12838           return arr;
12839         },
12840         readPackedFloat: function(arr) {
12841           if (this.type !== Pbf.Bytes)
12842             return arr.push(this.readFloat());
12843           var end = readPackedEnd(this);
12844           arr = arr || [];
12845           while (this.pos < end)
12846             arr.push(this.readFloat());
12847           return arr;
12848         },
12849         readPackedDouble: function(arr) {
12850           if (this.type !== Pbf.Bytes)
12851             return arr.push(this.readDouble());
12852           var end = readPackedEnd(this);
12853           arr = arr || [];
12854           while (this.pos < end)
12855             arr.push(this.readDouble());
12856           return arr;
12857         },
12858         readPackedFixed32: function(arr) {
12859           if (this.type !== Pbf.Bytes)
12860             return arr.push(this.readFixed32());
12861           var end = readPackedEnd(this);
12862           arr = arr || [];
12863           while (this.pos < end)
12864             arr.push(this.readFixed32());
12865           return arr;
12866         },
12867         readPackedSFixed32: function(arr) {
12868           if (this.type !== Pbf.Bytes)
12869             return arr.push(this.readSFixed32());
12870           var end = readPackedEnd(this);
12871           arr = arr || [];
12872           while (this.pos < end)
12873             arr.push(this.readSFixed32());
12874           return arr;
12875         },
12876         readPackedFixed64: function(arr) {
12877           if (this.type !== Pbf.Bytes)
12878             return arr.push(this.readFixed64());
12879           var end = readPackedEnd(this);
12880           arr = arr || [];
12881           while (this.pos < end)
12882             arr.push(this.readFixed64());
12883           return arr;
12884         },
12885         readPackedSFixed64: function(arr) {
12886           if (this.type !== Pbf.Bytes)
12887             return arr.push(this.readSFixed64());
12888           var end = readPackedEnd(this);
12889           arr = arr || [];
12890           while (this.pos < end)
12891             arr.push(this.readSFixed64());
12892           return arr;
12893         },
12894         skip: function(val) {
12895           var type2 = val & 7;
12896           if (type2 === Pbf.Varint)
12897             while (this.buf[this.pos++] > 127) {
12898             }
12899           else if (type2 === Pbf.Bytes)
12900             this.pos = this.readVarint() + this.pos;
12901           else if (type2 === Pbf.Fixed32)
12902             this.pos += 4;
12903           else if (type2 === Pbf.Fixed64)
12904             this.pos += 8;
12905           else
12906             throw new Error("Unimplemented type: " + type2);
12907         },
12908         // === WRITING =================================================================
12909         writeTag: function(tag, type2) {
12910           this.writeVarint(tag << 3 | type2);
12911         },
12912         realloc: function(min3) {
12913           var length = this.length || 16;
12914           while (length < this.pos + min3)
12915             length *= 2;
12916           if (length !== this.length) {
12917             var buf = new Uint8Array(length);
12918             buf.set(this.buf);
12919             this.buf = buf;
12920             this.length = length;
12921           }
12922         },
12923         finish: function() {
12924           this.length = this.pos;
12925           this.pos = 0;
12926           return this.buf.subarray(0, this.length);
12927         },
12928         writeFixed32: function(val) {
12929           this.realloc(4);
12930           writeInt32(this.buf, val, this.pos);
12931           this.pos += 4;
12932         },
12933         writeSFixed32: function(val) {
12934           this.realloc(4);
12935           writeInt32(this.buf, val, this.pos);
12936           this.pos += 4;
12937         },
12938         writeFixed64: function(val) {
12939           this.realloc(8);
12940           writeInt32(this.buf, val & -1, this.pos);
12941           writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
12942           this.pos += 8;
12943         },
12944         writeSFixed64: function(val) {
12945           this.realloc(8);
12946           writeInt32(this.buf, val & -1, this.pos);
12947           writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
12948           this.pos += 8;
12949         },
12950         writeVarint: function(val) {
12951           val = +val || 0;
12952           if (val > 268435455 || val < 0) {
12953             writeBigVarint(val, this);
12954             return;
12955           }
12956           this.realloc(4);
12957           this.buf[this.pos++] = val & 127 | (val > 127 ? 128 : 0);
12958           if (val <= 127)
12959             return;
12960           this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
12961           if (val <= 127)
12962             return;
12963           this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
12964           if (val <= 127)
12965             return;
12966           this.buf[this.pos++] = val >>> 7 & 127;
12967         },
12968         writeSVarint: function(val) {
12969           this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
12970         },
12971         writeBoolean: function(val) {
12972           this.writeVarint(Boolean(val));
12973         },
12974         writeString: function(str2) {
12975           str2 = String(str2);
12976           this.realloc(str2.length * 4);
12977           this.pos++;
12978           var startPos = this.pos;
12979           this.pos = writeUtf8(this.buf, str2, this.pos);
12980           var len = this.pos - startPos;
12981           if (len >= 128)
12982             makeRoomForExtraLength(startPos, len, this);
12983           this.pos = startPos - 1;
12984           this.writeVarint(len);
12985           this.pos += len;
12986         },
12987         writeFloat: function(val) {
12988           this.realloc(4);
12989           ieee754.write(this.buf, val, this.pos, true, 23, 4);
12990           this.pos += 4;
12991         },
12992         writeDouble: function(val) {
12993           this.realloc(8);
12994           ieee754.write(this.buf, val, this.pos, true, 52, 8);
12995           this.pos += 8;
12996         },
12997         writeBytes: function(buffer) {
12998           var len = buffer.length;
12999           this.writeVarint(len);
13000           this.realloc(len);
13001           for (var i3 = 0; i3 < len; i3++)
13002             this.buf[this.pos++] = buffer[i3];
13003         },
13004         writeRawMessage: function(fn, obj) {
13005           this.pos++;
13006           var startPos = this.pos;
13007           fn(obj, this);
13008           var len = this.pos - startPos;
13009           if (len >= 128)
13010             makeRoomForExtraLength(startPos, len, this);
13011           this.pos = startPos - 1;
13012           this.writeVarint(len);
13013           this.pos += len;
13014         },
13015         writeMessage: function(tag, fn, obj) {
13016           this.writeTag(tag, Pbf.Bytes);
13017           this.writeRawMessage(fn, obj);
13018         },
13019         writePackedVarint: function(tag, arr) {
13020           if (arr.length)
13021             this.writeMessage(tag, writePackedVarint, arr);
13022         },
13023         writePackedSVarint: function(tag, arr) {
13024           if (arr.length)
13025             this.writeMessage(tag, writePackedSVarint, arr);
13026         },
13027         writePackedBoolean: function(tag, arr) {
13028           if (arr.length)
13029             this.writeMessage(tag, writePackedBoolean, arr);
13030         },
13031         writePackedFloat: function(tag, arr) {
13032           if (arr.length)
13033             this.writeMessage(tag, writePackedFloat, arr);
13034         },
13035         writePackedDouble: function(tag, arr) {
13036           if (arr.length)
13037             this.writeMessage(tag, writePackedDouble, arr);
13038         },
13039         writePackedFixed32: function(tag, arr) {
13040           if (arr.length)
13041             this.writeMessage(tag, writePackedFixed32, arr);
13042         },
13043         writePackedSFixed32: function(tag, arr) {
13044           if (arr.length)
13045             this.writeMessage(tag, writePackedSFixed32, arr);
13046         },
13047         writePackedFixed64: function(tag, arr) {
13048           if (arr.length)
13049             this.writeMessage(tag, writePackedFixed64, arr);
13050         },
13051         writePackedSFixed64: function(tag, arr) {
13052           if (arr.length)
13053             this.writeMessage(tag, writePackedSFixed64, arr);
13054         },
13055         writeBytesField: function(tag, buffer) {
13056           this.writeTag(tag, Pbf.Bytes);
13057           this.writeBytes(buffer);
13058         },
13059         writeFixed32Field: function(tag, val) {
13060           this.writeTag(tag, Pbf.Fixed32);
13061           this.writeFixed32(val);
13062         },
13063         writeSFixed32Field: function(tag, val) {
13064           this.writeTag(tag, Pbf.Fixed32);
13065           this.writeSFixed32(val);
13066         },
13067         writeFixed64Field: function(tag, val) {
13068           this.writeTag(tag, Pbf.Fixed64);
13069           this.writeFixed64(val);
13070         },
13071         writeSFixed64Field: function(tag, val) {
13072           this.writeTag(tag, Pbf.Fixed64);
13073           this.writeSFixed64(val);
13074         },
13075         writeVarintField: function(tag, val) {
13076           this.writeTag(tag, Pbf.Varint);
13077           this.writeVarint(val);
13078         },
13079         writeSVarintField: function(tag, val) {
13080           this.writeTag(tag, Pbf.Varint);
13081           this.writeSVarint(val);
13082         },
13083         writeStringField: function(tag, str2) {
13084           this.writeTag(tag, Pbf.Bytes);
13085           this.writeString(str2);
13086         },
13087         writeFloatField: function(tag, val) {
13088           this.writeTag(tag, Pbf.Fixed32);
13089           this.writeFloat(val);
13090         },
13091         writeDoubleField: function(tag, val) {
13092           this.writeTag(tag, Pbf.Fixed64);
13093           this.writeDouble(val);
13094         },
13095         writeBooleanField: function(tag, val) {
13096           this.writeVarintField(tag, Boolean(val));
13097         }
13098       };
13099       function readVarintRemainder(l2, s2, p2) {
13100         var buf = p2.buf, h2, b2;
13101         b2 = buf[p2.pos++];
13102         h2 = (b2 & 112) >> 4;
13103         if (b2 < 128)
13104           return toNum(l2, h2, s2);
13105         b2 = buf[p2.pos++];
13106         h2 |= (b2 & 127) << 3;
13107         if (b2 < 128)
13108           return toNum(l2, h2, s2);
13109         b2 = buf[p2.pos++];
13110         h2 |= (b2 & 127) << 10;
13111         if (b2 < 128)
13112           return toNum(l2, h2, s2);
13113         b2 = buf[p2.pos++];
13114         h2 |= (b2 & 127) << 17;
13115         if (b2 < 128)
13116           return toNum(l2, h2, s2);
13117         b2 = buf[p2.pos++];
13118         h2 |= (b2 & 127) << 24;
13119         if (b2 < 128)
13120           return toNum(l2, h2, s2);
13121         b2 = buf[p2.pos++];
13122         h2 |= (b2 & 1) << 31;
13123         if (b2 < 128)
13124           return toNum(l2, h2, s2);
13125         throw new Error("Expected varint not more than 10 bytes");
13126       }
13127       function readPackedEnd(pbf) {
13128         return pbf.type === Pbf.Bytes ? pbf.readVarint() + pbf.pos : pbf.pos + 1;
13129       }
13130       function toNum(low, high, isSigned) {
13131         if (isSigned) {
13132           return high * 4294967296 + (low >>> 0);
13133         }
13134         return (high >>> 0) * 4294967296 + (low >>> 0);
13135       }
13136       function writeBigVarint(val, pbf) {
13137         var low, high;
13138         if (val >= 0) {
13139           low = val % 4294967296 | 0;
13140           high = val / 4294967296 | 0;
13141         } else {
13142           low = ~(-val % 4294967296);
13143           high = ~(-val / 4294967296);
13144           if (low ^ 4294967295) {
13145             low = low + 1 | 0;
13146           } else {
13147             low = 0;
13148             high = high + 1 | 0;
13149           }
13150         }
13151         if (val >= 18446744073709552e3 || val < -18446744073709552e3) {
13152           throw new Error("Given varint doesn't fit into 10 bytes");
13153         }
13154         pbf.realloc(10);
13155         writeBigVarintLow(low, high, pbf);
13156         writeBigVarintHigh(high, pbf);
13157       }
13158       function writeBigVarintLow(low, high, pbf) {
13159         pbf.buf[pbf.pos++] = low & 127 | 128;
13160         low >>>= 7;
13161         pbf.buf[pbf.pos++] = low & 127 | 128;
13162         low >>>= 7;
13163         pbf.buf[pbf.pos++] = low & 127 | 128;
13164         low >>>= 7;
13165         pbf.buf[pbf.pos++] = low & 127 | 128;
13166         low >>>= 7;
13167         pbf.buf[pbf.pos] = low & 127;
13168       }
13169       function writeBigVarintHigh(high, pbf) {
13170         var lsb = (high & 7) << 4;
13171         pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 128 : 0);
13172         if (!high)
13173           return;
13174         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
13175         if (!high)
13176           return;
13177         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
13178         if (!high)
13179           return;
13180         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
13181         if (!high)
13182           return;
13183         pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
13184         if (!high)
13185           return;
13186         pbf.buf[pbf.pos++] = high & 127;
13187       }
13188       function makeRoomForExtraLength(startPos, len, pbf) {
13189         var extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
13190         pbf.realloc(extraLen);
13191         for (var i3 = pbf.pos - 1; i3 >= startPos; i3--)
13192           pbf.buf[i3 + extraLen] = pbf.buf[i3];
13193       }
13194       function writePackedVarint(arr, pbf) {
13195         for (var i3 = 0; i3 < arr.length; i3++)
13196           pbf.writeVarint(arr[i3]);
13197       }
13198       function writePackedSVarint(arr, pbf) {
13199         for (var i3 = 0; i3 < arr.length; i3++)
13200           pbf.writeSVarint(arr[i3]);
13201       }
13202       function writePackedFloat(arr, pbf) {
13203         for (var i3 = 0; i3 < arr.length; i3++)
13204           pbf.writeFloat(arr[i3]);
13205       }
13206       function writePackedDouble(arr, pbf) {
13207         for (var i3 = 0; i3 < arr.length; i3++)
13208           pbf.writeDouble(arr[i3]);
13209       }
13210       function writePackedBoolean(arr, pbf) {
13211         for (var i3 = 0; i3 < arr.length; i3++)
13212           pbf.writeBoolean(arr[i3]);
13213       }
13214       function writePackedFixed32(arr, pbf) {
13215         for (var i3 = 0; i3 < arr.length; i3++)
13216           pbf.writeFixed32(arr[i3]);
13217       }
13218       function writePackedSFixed32(arr, pbf) {
13219         for (var i3 = 0; i3 < arr.length; i3++)
13220           pbf.writeSFixed32(arr[i3]);
13221       }
13222       function writePackedFixed64(arr, pbf) {
13223         for (var i3 = 0; i3 < arr.length; i3++)
13224           pbf.writeFixed64(arr[i3]);
13225       }
13226       function writePackedSFixed64(arr, pbf) {
13227         for (var i3 = 0; i3 < arr.length; i3++)
13228           pbf.writeSFixed64(arr[i3]);
13229       }
13230       function readUInt32(buf, pos) {
13231         return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + buf[pos + 3] * 16777216;
13232       }
13233       function writeInt32(buf, val, pos) {
13234         buf[pos] = val;
13235         buf[pos + 1] = val >>> 8;
13236         buf[pos + 2] = val >>> 16;
13237         buf[pos + 3] = val >>> 24;
13238       }
13239       function readInt32(buf, pos) {
13240         return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + (buf[pos + 3] << 24);
13241       }
13242       function readUtf8(buf, pos, end) {
13243         var str2 = "";
13244         var i3 = pos;
13245         while (i3 < end) {
13246           var b0 = buf[i3];
13247           var c2 = null;
13248           var bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
13249           if (i3 + bytesPerSequence > end)
13250             break;
13251           var b1, b2, b3;
13252           if (bytesPerSequence === 1) {
13253             if (b0 < 128) {
13254               c2 = b0;
13255             }
13256           } else if (bytesPerSequence === 2) {
13257             b1 = buf[i3 + 1];
13258             if ((b1 & 192) === 128) {
13259               c2 = (b0 & 31) << 6 | b1 & 63;
13260               if (c2 <= 127) {
13261                 c2 = null;
13262               }
13263             }
13264           } else if (bytesPerSequence === 3) {
13265             b1 = buf[i3 + 1];
13266             b2 = buf[i3 + 2];
13267             if ((b1 & 192) === 128 && (b2 & 192) === 128) {
13268               c2 = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;
13269               if (c2 <= 2047 || c2 >= 55296 && c2 <= 57343) {
13270                 c2 = null;
13271               }
13272             }
13273           } else if (bytesPerSequence === 4) {
13274             b1 = buf[i3 + 1];
13275             b2 = buf[i3 + 2];
13276             b3 = buf[i3 + 3];
13277             if ((b1 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {
13278               c2 = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;
13279               if (c2 <= 65535 || c2 >= 1114112) {
13280                 c2 = null;
13281               }
13282             }
13283           }
13284           if (c2 === null) {
13285             c2 = 65533;
13286             bytesPerSequence = 1;
13287           } else if (c2 > 65535) {
13288             c2 -= 65536;
13289             str2 += String.fromCharCode(c2 >>> 10 & 1023 | 55296);
13290             c2 = 56320 | c2 & 1023;
13291           }
13292           str2 += String.fromCharCode(c2);
13293           i3 += bytesPerSequence;
13294         }
13295         return str2;
13296       }
13297       function readUtf8TextDecoder(buf, pos, end) {
13298         return utf8TextDecoder.decode(buf.subarray(pos, end));
13299       }
13300       function writeUtf8(buf, str2, pos) {
13301         for (var i3 = 0, c2, lead; i3 < str2.length; i3++) {
13302           c2 = str2.charCodeAt(i3);
13303           if (c2 > 55295 && c2 < 57344) {
13304             if (lead) {
13305               if (c2 < 56320) {
13306                 buf[pos++] = 239;
13307                 buf[pos++] = 191;
13308                 buf[pos++] = 189;
13309                 lead = c2;
13310                 continue;
13311               } else {
13312                 c2 = lead - 55296 << 10 | c2 - 56320 | 65536;
13313                 lead = null;
13314               }
13315             } else {
13316               if (c2 > 56319 || i3 + 1 === str2.length) {
13317                 buf[pos++] = 239;
13318                 buf[pos++] = 191;
13319                 buf[pos++] = 189;
13320               } else {
13321                 lead = c2;
13322               }
13323               continue;
13324             }
13325           } else if (lead) {
13326             buf[pos++] = 239;
13327             buf[pos++] = 191;
13328             buf[pos++] = 189;
13329             lead = null;
13330           }
13331           if (c2 < 128) {
13332             buf[pos++] = c2;
13333           } else {
13334             if (c2 < 2048) {
13335               buf[pos++] = c2 >> 6 | 192;
13336             } else {
13337               if (c2 < 65536) {
13338                 buf[pos++] = c2 >> 12 | 224;
13339               } else {
13340                 buf[pos++] = c2 >> 18 | 240;
13341                 buf[pos++] = c2 >> 12 & 63 | 128;
13342               }
13343               buf[pos++] = c2 >> 6 & 63 | 128;
13344             }
13345             buf[pos++] = c2 & 63 | 128;
13346           }
13347         }
13348         return pos;
13349       }
13350     }
13351   });
13352
13353   // node_modules/@mapbox/point-geometry/index.js
13354   var require_point_geometry = __commonJS({
13355     "node_modules/@mapbox/point-geometry/index.js"(exports2, module2) {
13356       "use strict";
13357       module2.exports = Point;
13358       function Point(x2, y2) {
13359         this.x = x2;
13360         this.y = y2;
13361       }
13362       Point.prototype = {
13363         /**
13364          * Clone this point, returning a new point that can be modified
13365          * without affecting the old one.
13366          * @return {Point} the clone
13367          */
13368         clone: function() {
13369           return new Point(this.x, this.y);
13370         },
13371         /**
13372          * Add this point's x & y coordinates to another point,
13373          * yielding a new point.
13374          * @param {Point} p the other point
13375          * @return {Point} output point
13376          */
13377         add: function(p2) {
13378           return this.clone()._add(p2);
13379         },
13380         /**
13381          * Subtract this point's x & y coordinates to from point,
13382          * yielding a new point.
13383          * @param {Point} p the other point
13384          * @return {Point} output point
13385          */
13386         sub: function(p2) {
13387           return this.clone()._sub(p2);
13388         },
13389         /**
13390          * Multiply this point's x & y coordinates by point,
13391          * yielding a new point.
13392          * @param {Point} p the other point
13393          * @return {Point} output point
13394          */
13395         multByPoint: function(p2) {
13396           return this.clone()._multByPoint(p2);
13397         },
13398         /**
13399          * Divide this point's x & y coordinates by point,
13400          * yielding a new point.
13401          * @param {Point} p the other point
13402          * @return {Point} output point
13403          */
13404         divByPoint: function(p2) {
13405           return this.clone()._divByPoint(p2);
13406         },
13407         /**
13408          * Multiply this point's x & y coordinates by a factor,
13409          * yielding a new point.
13410          * @param {Point} k factor
13411          * @return {Point} output point
13412          */
13413         mult: function(k2) {
13414           return this.clone()._mult(k2);
13415         },
13416         /**
13417          * Divide this point's x & y coordinates by a factor,
13418          * yielding a new point.
13419          * @param {Point} k factor
13420          * @return {Point} output point
13421          */
13422         div: function(k2) {
13423           return this.clone()._div(k2);
13424         },
13425         /**
13426          * Rotate this point around the 0, 0 origin by an angle a,
13427          * given in radians
13428          * @param {Number} a angle to rotate around, in radians
13429          * @return {Point} output point
13430          */
13431         rotate: function(a2) {
13432           return this.clone()._rotate(a2);
13433         },
13434         /**
13435          * Rotate this point around p point by an angle a,
13436          * given in radians
13437          * @param {Number} a angle to rotate around, in radians
13438          * @param {Point} p Point to rotate around
13439          * @return {Point} output point
13440          */
13441         rotateAround: function(a2, p2) {
13442           return this.clone()._rotateAround(a2, p2);
13443         },
13444         /**
13445          * Multiply this point by a 4x1 transformation matrix
13446          * @param {Array<Number>} m transformation matrix
13447          * @return {Point} output point
13448          */
13449         matMult: function(m2) {
13450           return this.clone()._matMult(m2);
13451         },
13452         /**
13453          * Calculate this point but as a unit vector from 0, 0, meaning
13454          * that the distance from the resulting point to the 0, 0
13455          * coordinate will be equal to 1 and the angle from the resulting
13456          * point to the 0, 0 coordinate will be the same as before.
13457          * @return {Point} unit vector point
13458          */
13459         unit: function() {
13460           return this.clone()._unit();
13461         },
13462         /**
13463          * Compute a perpendicular point, where the new y coordinate
13464          * is the old x coordinate and the new x coordinate is the old y
13465          * coordinate multiplied by -1
13466          * @return {Point} perpendicular point
13467          */
13468         perp: function() {
13469           return this.clone()._perp();
13470         },
13471         /**
13472          * Return a version of this point with the x & y coordinates
13473          * rounded to integers.
13474          * @return {Point} rounded point
13475          */
13476         round: function() {
13477           return this.clone()._round();
13478         },
13479         /**
13480          * Return the magitude of this point: this is the Euclidean
13481          * distance from the 0, 0 coordinate to this point's x and y
13482          * coordinates.
13483          * @return {Number} magnitude
13484          */
13485         mag: function() {
13486           return Math.sqrt(this.x * this.x + this.y * this.y);
13487         },
13488         /**
13489          * Judge whether this point is equal to another point, returning
13490          * true or false.
13491          * @param {Point} other the other point
13492          * @return {boolean} whether the points are equal
13493          */
13494         equals: function(other) {
13495           return this.x === other.x && this.y === other.y;
13496         },
13497         /**
13498          * Calculate the distance from this point to another point
13499          * @param {Point} p the other point
13500          * @return {Number} distance
13501          */
13502         dist: function(p2) {
13503           return Math.sqrt(this.distSqr(p2));
13504         },
13505         /**
13506          * Calculate the distance from this point to another point,
13507          * without the square root step. Useful if you're comparing
13508          * relative distances.
13509          * @param {Point} p the other point
13510          * @return {Number} distance
13511          */
13512         distSqr: function(p2) {
13513           var dx = p2.x - this.x, dy = p2.y - this.y;
13514           return dx * dx + dy * dy;
13515         },
13516         /**
13517          * Get the angle from the 0, 0 coordinate to this point, in radians
13518          * coordinates.
13519          * @return {Number} angle
13520          */
13521         angle: function() {
13522           return Math.atan2(this.y, this.x);
13523         },
13524         /**
13525          * Get the angle from this point to another point, in radians
13526          * @param {Point} b the other point
13527          * @return {Number} angle
13528          */
13529         angleTo: function(b2) {
13530           return Math.atan2(this.y - b2.y, this.x - b2.x);
13531         },
13532         /**
13533          * Get the angle between this point and another point, in radians
13534          * @param {Point} b the other point
13535          * @return {Number} angle
13536          */
13537         angleWith: function(b2) {
13538           return this.angleWithSep(b2.x, b2.y);
13539         },
13540         /*
13541          * Find the angle of the two vectors, solving the formula for
13542          * the cross product a x b = |a||b|sin(θ) for θ.
13543          * @param {Number} x the x-coordinate
13544          * @param {Number} y the y-coordinate
13545          * @return {Number} the angle in radians
13546          */
13547         angleWithSep: function(x2, y2) {
13548           return Math.atan2(
13549             this.x * y2 - this.y * x2,
13550             this.x * x2 + this.y * y2
13551           );
13552         },
13553         _matMult: function(m2) {
13554           var x2 = m2[0] * this.x + m2[1] * this.y, y2 = m2[2] * this.x + m2[3] * this.y;
13555           this.x = x2;
13556           this.y = y2;
13557           return this;
13558         },
13559         _add: function(p2) {
13560           this.x += p2.x;
13561           this.y += p2.y;
13562           return this;
13563         },
13564         _sub: function(p2) {
13565           this.x -= p2.x;
13566           this.y -= p2.y;
13567           return this;
13568         },
13569         _mult: function(k2) {
13570           this.x *= k2;
13571           this.y *= k2;
13572           return this;
13573         },
13574         _div: function(k2) {
13575           this.x /= k2;
13576           this.y /= k2;
13577           return this;
13578         },
13579         _multByPoint: function(p2) {
13580           this.x *= p2.x;
13581           this.y *= p2.y;
13582           return this;
13583         },
13584         _divByPoint: function(p2) {
13585           this.x /= p2.x;
13586           this.y /= p2.y;
13587           return this;
13588         },
13589         _unit: function() {
13590           this._div(this.mag());
13591           return this;
13592         },
13593         _perp: function() {
13594           var y2 = this.y;
13595           this.y = this.x;
13596           this.x = -y2;
13597           return this;
13598         },
13599         _rotate: function(angle2) {
13600           var cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x2 = cos2 * this.x - sin2 * this.y, y2 = sin2 * this.x + cos2 * this.y;
13601           this.x = x2;
13602           this.y = y2;
13603           return this;
13604         },
13605         _rotateAround: function(angle2, p2) {
13606           var cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x2 = p2.x + cos2 * (this.x - p2.x) - sin2 * (this.y - p2.y), y2 = p2.y + sin2 * (this.x - p2.x) + cos2 * (this.y - p2.y);
13607           this.x = x2;
13608           this.y = y2;
13609           return this;
13610         },
13611         _round: function() {
13612           this.x = Math.round(this.x);
13613           this.y = Math.round(this.y);
13614           return this;
13615         }
13616       };
13617       Point.convert = function(a2) {
13618         if (a2 instanceof Point) {
13619           return a2;
13620         }
13621         if (Array.isArray(a2)) {
13622           return new Point(a2[0], a2[1]);
13623         }
13624         return a2;
13625       };
13626     }
13627   });
13628
13629   // node_modules/@mapbox/vector-tile/lib/vectortilefeature.js
13630   var require_vectortilefeature = __commonJS({
13631     "node_modules/@mapbox/vector-tile/lib/vectortilefeature.js"(exports2, module2) {
13632       "use strict";
13633       var Point = require_point_geometry();
13634       module2.exports = VectorTileFeature;
13635       function VectorTileFeature(pbf, end, extent, keys2, values) {
13636         this.properties = {};
13637         this.extent = extent;
13638         this.type = 0;
13639         this._pbf = pbf;
13640         this._geometry = -1;
13641         this._keys = keys2;
13642         this._values = values;
13643         pbf.readFields(readFeature, this, end);
13644       }
13645       function readFeature(tag, feature3, pbf) {
13646         if (tag == 1)
13647           feature3.id = pbf.readVarint();
13648         else if (tag == 2)
13649           readTag(pbf, feature3);
13650         else if (tag == 3)
13651           feature3.type = pbf.readVarint();
13652         else if (tag == 4)
13653           feature3._geometry = pbf.pos;
13654       }
13655       function readTag(pbf, feature3) {
13656         var end = pbf.readVarint() + pbf.pos;
13657         while (pbf.pos < end) {
13658           var key = feature3._keys[pbf.readVarint()], value = feature3._values[pbf.readVarint()];
13659           feature3.properties[key] = value;
13660         }
13661       }
13662       VectorTileFeature.types = ["Unknown", "Point", "LineString", "Polygon"];
13663       VectorTileFeature.prototype.loadGeometry = function() {
13664         var pbf = this._pbf;
13665         pbf.pos = this._geometry;
13666         var end = pbf.readVarint() + pbf.pos, cmd = 1, length = 0, x2 = 0, y2 = 0, lines = [], line;
13667         while (pbf.pos < end) {
13668           if (length <= 0) {
13669             var cmdLen = pbf.readVarint();
13670             cmd = cmdLen & 7;
13671             length = cmdLen >> 3;
13672           }
13673           length--;
13674           if (cmd === 1 || cmd === 2) {
13675             x2 += pbf.readSVarint();
13676             y2 += pbf.readSVarint();
13677             if (cmd === 1) {
13678               if (line)
13679                 lines.push(line);
13680               line = [];
13681             }
13682             line.push(new Point(x2, y2));
13683           } else if (cmd === 7) {
13684             if (line) {
13685               line.push(line[0].clone());
13686             }
13687           } else {
13688             throw new Error("unknown command " + cmd);
13689           }
13690         }
13691         if (line)
13692           lines.push(line);
13693         return lines;
13694       };
13695       VectorTileFeature.prototype.bbox = function() {
13696         var pbf = this._pbf;
13697         pbf.pos = this._geometry;
13698         var end = pbf.readVarint() + pbf.pos, cmd = 1, length = 0, x2 = 0, y2 = 0, x12 = Infinity, x22 = -Infinity, y12 = Infinity, y22 = -Infinity;
13699         while (pbf.pos < end) {
13700           if (length <= 0) {
13701             var cmdLen = pbf.readVarint();
13702             cmd = cmdLen & 7;
13703             length = cmdLen >> 3;
13704           }
13705           length--;
13706           if (cmd === 1 || cmd === 2) {
13707             x2 += pbf.readSVarint();
13708             y2 += pbf.readSVarint();
13709             if (x2 < x12)
13710               x12 = x2;
13711             if (x2 > x22)
13712               x22 = x2;
13713             if (y2 < y12)
13714               y12 = y2;
13715             if (y2 > y22)
13716               y22 = y2;
13717           } else if (cmd !== 7) {
13718             throw new Error("unknown command " + cmd);
13719           }
13720         }
13721         return [x12, y12, x22, y22];
13722       };
13723       VectorTileFeature.prototype.toGeoJSON = function(x2, y2, z2) {
13724         var size = this.extent * Math.pow(2, z2), x05 = this.extent * x2, y05 = this.extent * y2, coords = this.loadGeometry(), type2 = VectorTileFeature.types[this.type], i3, j3;
13725         function project(line) {
13726           for (var j4 = 0; j4 < line.length; j4++) {
13727             var p2 = line[j4], y22 = 180 - (p2.y + y05) * 360 / size;
13728             line[j4] = [
13729               (p2.x + x05) * 360 / size - 180,
13730               360 / Math.PI * Math.atan(Math.exp(y22 * Math.PI / 180)) - 90
13731             ];
13732           }
13733         }
13734         switch (this.type) {
13735           case 1:
13736             var points = [];
13737             for (i3 = 0; i3 < coords.length; i3++) {
13738               points[i3] = coords[i3][0];
13739             }
13740             coords = points;
13741             project(coords);
13742             break;
13743           case 2:
13744             for (i3 = 0; i3 < coords.length; i3++) {
13745               project(coords[i3]);
13746             }
13747             break;
13748           case 3:
13749             coords = classifyRings(coords);
13750             for (i3 = 0; i3 < coords.length; i3++) {
13751               for (j3 = 0; j3 < coords[i3].length; j3++) {
13752                 project(coords[i3][j3]);
13753               }
13754             }
13755             break;
13756         }
13757         if (coords.length === 1) {
13758           coords = coords[0];
13759         } else {
13760           type2 = "Multi" + type2;
13761         }
13762         var result = {
13763           type: "Feature",
13764           geometry: {
13765             type: type2,
13766             coordinates: coords
13767           },
13768           properties: this.properties
13769         };
13770         if ("id" in this) {
13771           result.id = this.id;
13772         }
13773         return result;
13774       };
13775       function classifyRings(rings) {
13776         var len = rings.length;
13777         if (len <= 1)
13778           return [rings];
13779         var polygons = [], polygon2, ccw;
13780         for (var i3 = 0; i3 < len; i3++) {
13781           var area = signedArea(rings[i3]);
13782           if (area === 0)
13783             continue;
13784           if (ccw === void 0)
13785             ccw = area < 0;
13786           if (ccw === area < 0) {
13787             if (polygon2)
13788               polygons.push(polygon2);
13789             polygon2 = [rings[i3]];
13790           } else {
13791             polygon2.push(rings[i3]);
13792           }
13793         }
13794         if (polygon2)
13795           polygons.push(polygon2);
13796         return polygons;
13797       }
13798       function signedArea(ring) {
13799         var sum = 0;
13800         for (var i3 = 0, len = ring.length, j3 = len - 1, p1, p2; i3 < len; j3 = i3++) {
13801           p1 = ring[i3];
13802           p2 = ring[j3];
13803           sum += (p2.x - p1.x) * (p1.y + p2.y);
13804         }
13805         return sum;
13806       }
13807     }
13808   });
13809
13810   // node_modules/@mapbox/vector-tile/lib/vectortilelayer.js
13811   var require_vectortilelayer = __commonJS({
13812     "node_modules/@mapbox/vector-tile/lib/vectortilelayer.js"(exports2, module2) {
13813       "use strict";
13814       var VectorTileFeature = require_vectortilefeature();
13815       module2.exports = VectorTileLayer;
13816       function VectorTileLayer(pbf, end) {
13817         this.version = 1;
13818         this.name = null;
13819         this.extent = 4096;
13820         this.length = 0;
13821         this._pbf = pbf;
13822         this._keys = [];
13823         this._values = [];
13824         this._features = [];
13825         pbf.readFields(readLayer, this, end);
13826         this.length = this._features.length;
13827       }
13828       function readLayer(tag, layer, pbf) {
13829         if (tag === 15)
13830           layer.version = pbf.readVarint();
13831         else if (tag === 1)
13832           layer.name = pbf.readString();
13833         else if (tag === 5)
13834           layer.extent = pbf.readVarint();
13835         else if (tag === 2)
13836           layer._features.push(pbf.pos);
13837         else if (tag === 3)
13838           layer._keys.push(pbf.readString());
13839         else if (tag === 4)
13840           layer._values.push(readValueMessage(pbf));
13841       }
13842       function readValueMessage(pbf) {
13843         var value = null, end = pbf.readVarint() + pbf.pos;
13844         while (pbf.pos < end) {
13845           var tag = pbf.readVarint() >> 3;
13846           value = tag === 1 ? pbf.readString() : tag === 2 ? pbf.readFloat() : tag === 3 ? pbf.readDouble() : tag === 4 ? pbf.readVarint64() : tag === 5 ? pbf.readVarint() : tag === 6 ? pbf.readSVarint() : tag === 7 ? pbf.readBoolean() : null;
13847         }
13848         return value;
13849       }
13850       VectorTileLayer.prototype.feature = function(i3) {
13851         if (i3 < 0 || i3 >= this._features.length)
13852           throw new Error("feature index out of bounds");
13853         this._pbf.pos = this._features[i3];
13854         var end = this._pbf.readVarint() + this._pbf.pos;
13855         return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
13856       };
13857     }
13858   });
13859
13860   // node_modules/@mapbox/vector-tile/lib/vectortile.js
13861   var require_vectortile = __commonJS({
13862     "node_modules/@mapbox/vector-tile/lib/vectortile.js"(exports2, module2) {
13863       "use strict";
13864       var VectorTileLayer = require_vectortilelayer();
13865       module2.exports = VectorTile3;
13866       function VectorTile3(pbf, end) {
13867         this.layers = pbf.readFields(readTile, {}, end);
13868       }
13869       function readTile(tag, layers, pbf) {
13870         if (tag === 3) {
13871           var layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
13872           if (layer.length)
13873             layers[layer.name] = layer;
13874         }
13875       }
13876     }
13877   });
13878
13879   // node_modules/@mapbox/vector-tile/index.js
13880   var require_vector_tile = __commonJS({
13881     "node_modules/@mapbox/vector-tile/index.js"(exports2, module2) {
13882       module2.exports.VectorTile = require_vectortile();
13883       module2.exports.VectorTileFeature = require_vectortilefeature();
13884       module2.exports.VectorTileLayer = require_vectortilelayer();
13885     }
13886   });
13887
13888   // node_modules/fast-json-stable-stringify/index.js
13889   var require_fast_json_stable_stringify = __commonJS({
13890     "node_modules/fast-json-stable-stringify/index.js"(exports2, module2) {
13891       "use strict";
13892       module2.exports = function(data, opts) {
13893         if (!opts)
13894           opts = {};
13895         if (typeof opts === "function")
13896           opts = { cmp: opts };
13897         var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false;
13898         var cmp = opts.cmp && function(f3) {
13899           return function(node) {
13900             return function(a2, b2) {
13901               var aobj = { key: a2, value: node[a2] };
13902               var bobj = { key: b2, value: node[b2] };
13903               return f3(aobj, bobj);
13904             };
13905           };
13906         }(opts.cmp);
13907         var seen = [];
13908         return function stringify3(node) {
13909           if (node && node.toJSON && typeof node.toJSON === "function") {
13910             node = node.toJSON();
13911           }
13912           if (node === void 0)
13913             return;
13914           if (typeof node == "number")
13915             return isFinite(node) ? "" + node : "null";
13916           if (typeof node !== "object")
13917             return JSON.stringify(node);
13918           var i3, out;
13919           if (Array.isArray(node)) {
13920             out = "[";
13921             for (i3 = 0; i3 < node.length; i3++) {
13922               if (i3)
13923                 out += ",";
13924               out += stringify3(node[i3]) || "null";
13925             }
13926             return out + "]";
13927           }
13928           if (node === null)
13929             return "null";
13930           if (seen.indexOf(node) !== -1) {
13931             if (cycles)
13932               return JSON.stringify("__cycle__");
13933             throw new TypeError("Converting circular structure to JSON");
13934           }
13935           var seenIndex = seen.push(node) - 1;
13936           var keys2 = Object.keys(node).sort(cmp && cmp(node));
13937           out = "";
13938           for (i3 = 0; i3 < keys2.length; i3++) {
13939             var key = keys2[i3];
13940             var value = stringify3(node[key]);
13941             if (!value)
13942               continue;
13943             if (out)
13944               out += ",";
13945             out += JSON.stringify(key) + ":" + value;
13946           }
13947           seen.splice(seenIndex, 1);
13948           return "{" + out + "}";
13949         }(data);
13950       };
13951     }
13952   });
13953
13954   // node_modules/@mapbox/sexagesimal/index.js
13955   var require_sexagesimal = __commonJS({
13956     "node_modules/@mapbox/sexagesimal/index.js"(exports2, module2) {
13957       module2.exports = element;
13958       module2.exports.pair = pair3;
13959       module2.exports.format = format2;
13960       module2.exports.formatPair = formatPair;
13961       module2.exports.coordToDMS = coordToDMS;
13962       function element(input, dims) {
13963         var result = search(input, dims);
13964         return result === null ? null : result.val;
13965       }
13966       function formatPair(input) {
13967         return format2(input.lat, "lat") + " " + format2(input.lon, "lon");
13968       }
13969       function format2(input, dim) {
13970         var dms = coordToDMS(input, dim);
13971         return dms.whole + "\xB0 " + (dms.minutes ? dms.minutes + "' " : "") + (dms.seconds ? dms.seconds + '" ' : "") + dms.dir;
13972       }
13973       function coordToDMS(input, dim) {
13974         var dirs = { lat: ["N", "S"], lon: ["E", "W"] }[dim] || "";
13975         var dir = dirs[input >= 0 ? 0 : 1];
13976         var abs3 = Math.abs(input);
13977         var whole = Math.floor(abs3);
13978         var fraction = abs3 - whole;
13979         var fractionMinutes = fraction * 60;
13980         var minutes = Math.floor(fractionMinutes);
13981         var seconds = Math.floor((fractionMinutes - minutes) * 60);
13982         return {
13983           whole,
13984           minutes,
13985           seconds,
13986           dir
13987         };
13988       }
13989       function search(input, dims) {
13990         if (!dims)
13991           dims = "NSEW";
13992         if (typeof input !== "string")
13993           return null;
13994         input = input.toUpperCase();
13995         var regex = /^[\s\,]*([NSEW])?\s*([\-|\—|\―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/;
13996         var m2 = input.match(regex);
13997         if (!m2)
13998           return null;
13999         var matched = m2[0];
14000         var dim;
14001         if (m2[1] && m2[5]) {
14002           dim = m2[1];
14003           matched = matched.slice(0, -1);
14004         } else {
14005           dim = m2[1] || m2[5];
14006         }
14007         if (dim && dims.indexOf(dim) === -1)
14008           return null;
14009         var deg = m2[2] ? parseFloat(m2[2]) : 0;
14010         var min3 = m2[3] ? parseFloat(m2[3]) / 60 : 0;
14011         var sec = m2[4] ? parseFloat(m2[4]) / 3600 : 0;
14012         var sign2 = deg < 0 ? -1 : 1;
14013         if (dim === "S" || dim === "W")
14014           sign2 *= -1;
14015         return {
14016           val: (Math.abs(deg) + min3 + sec) * sign2,
14017           dim,
14018           matched,
14019           remain: input.slice(matched.length)
14020         };
14021       }
14022       function pair3(input, dims) {
14023         input = input.trim();
14024         var one2 = search(input, dims);
14025         if (!one2)
14026           return null;
14027         input = one2.remain.trim();
14028         var two = search(input, dims);
14029         if (!two || two.remain)
14030           return null;
14031         if (one2.dim) {
14032           return swapdim(one2.val, two.val, one2.dim);
14033         } else {
14034           return [one2.val, two.val];
14035         }
14036       }
14037       function swapdim(a2, b2, dim) {
14038         if (dim === "N" || dim === "S")
14039           return [a2, b2];
14040         if (dim === "W" || dim === "E")
14041           return [b2, a2];
14042       }
14043     }
14044   });
14045
14046   // node_modules/store/src/util.js
14047   var require_util = __commonJS({
14048     "node_modules/store/src/util.js"(exports2, module2) {
14049       var assign = make_assign();
14050       var create2 = make_create();
14051       var trim = make_trim();
14052       var Global = typeof window !== "undefined" ? window : global;
14053       module2.exports = {
14054         assign,
14055         create: create2,
14056         trim,
14057         bind,
14058         slice,
14059         each,
14060         map: map2,
14061         pluck,
14062         isList,
14063         isFunction: isFunction2,
14064         isObject: isObject3,
14065         Global
14066       };
14067       function make_assign() {
14068         if (Object.assign) {
14069           return Object.assign;
14070         } else {
14071           return function shimAssign(obj, props1, props2, etc) {
14072             for (var i3 = 1; i3 < arguments.length; i3++) {
14073               each(Object(arguments[i3]), function(val, key) {
14074                 obj[key] = val;
14075               });
14076             }
14077             return obj;
14078           };
14079         }
14080       }
14081       function make_create() {
14082         if (Object.create) {
14083           return function create3(obj, assignProps1, assignProps2, etc) {
14084             var assignArgsList = slice(arguments, 1);
14085             return assign.apply(this, [Object.create(obj)].concat(assignArgsList));
14086           };
14087         } else {
14088           let F3 = function() {
14089           };
14090           var F2 = F3;
14091           return function create3(obj, assignProps1, assignProps2, etc) {
14092             var assignArgsList = slice(arguments, 1);
14093             F3.prototype = obj;
14094             return assign.apply(this, [new F3()].concat(assignArgsList));
14095           };
14096         }
14097       }
14098       function make_trim() {
14099         if (String.prototype.trim) {
14100           return function trim2(str2) {
14101             return String.prototype.trim.call(str2);
14102           };
14103         } else {
14104           return function trim2(str2) {
14105             return str2.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
14106           };
14107         }
14108       }
14109       function bind(obj, fn) {
14110         return function() {
14111           return fn.apply(obj, Array.prototype.slice.call(arguments, 0));
14112         };
14113       }
14114       function slice(arr, index) {
14115         return Array.prototype.slice.call(arr, index || 0);
14116       }
14117       function each(obj, fn) {
14118         pluck(obj, function(val, key) {
14119           fn(val, key);
14120           return false;
14121         });
14122       }
14123       function map2(obj, fn) {
14124         var res = isList(obj) ? [] : {};
14125         pluck(obj, function(v2, k2) {
14126           res[k2] = fn(v2, k2);
14127           return false;
14128         });
14129         return res;
14130       }
14131       function pluck(obj, fn) {
14132         if (isList(obj)) {
14133           for (var i3 = 0; i3 < obj.length; i3++) {
14134             if (fn(obj[i3], i3)) {
14135               return obj[i3];
14136             }
14137           }
14138         } else {
14139           for (var key in obj) {
14140             if (obj.hasOwnProperty(key)) {
14141               if (fn(obj[key], key)) {
14142                 return obj[key];
14143               }
14144             }
14145           }
14146         }
14147       }
14148       function isList(val) {
14149         return val != null && typeof val != "function" && typeof val.length == "number";
14150       }
14151       function isFunction2(val) {
14152         return val && {}.toString.call(val) === "[object Function]";
14153       }
14154       function isObject3(val) {
14155         return val && {}.toString.call(val) === "[object Object]";
14156       }
14157     }
14158   });
14159
14160   // node_modules/store/src/store-engine.js
14161   var require_store_engine = __commonJS({
14162     "node_modules/store/src/store-engine.js"(exports2, module2) {
14163       var util = require_util();
14164       var slice = util.slice;
14165       var pluck = util.pluck;
14166       var each = util.each;
14167       var bind = util.bind;
14168       var create2 = util.create;
14169       var isList = util.isList;
14170       var isFunction2 = util.isFunction;
14171       var isObject3 = util.isObject;
14172       module2.exports = {
14173         createStore
14174       };
14175       var storeAPI = {
14176         version: "2.0.12",
14177         enabled: false,
14178         // get returns the value of the given key. If that value
14179         // is undefined, it returns optionalDefaultValue instead.
14180         get: function(key, optionalDefaultValue) {
14181           var data = this.storage.read(this._namespacePrefix + key);
14182           return this._deserialize(data, optionalDefaultValue);
14183         },
14184         // set will store the given value at key and returns value.
14185         // Calling set with value === undefined is equivalent to calling remove.
14186         set: function(key, value) {
14187           if (value === void 0) {
14188             return this.remove(key);
14189           }
14190           this.storage.write(this._namespacePrefix + key, this._serialize(value));
14191           return value;
14192         },
14193         // remove deletes the key and value stored at the given key.
14194         remove: function(key) {
14195           this.storage.remove(this._namespacePrefix + key);
14196         },
14197         // each will call the given callback once for each key-value pair
14198         // in this store.
14199         each: function(callback) {
14200           var self2 = this;
14201           this.storage.each(function(val, namespacedKey) {
14202             callback.call(self2, self2._deserialize(val), (namespacedKey || "").replace(self2._namespaceRegexp, ""));
14203           });
14204         },
14205         // clearAll will remove all the stored key-value pairs in this store.
14206         clearAll: function() {
14207           this.storage.clearAll();
14208         },
14209         // additional functionality that can't live in plugins
14210         // ---------------------------------------------------
14211         // hasNamespace returns true if this store instance has the given namespace.
14212         hasNamespace: function(namespace) {
14213           return this._namespacePrefix == "__storejs_" + namespace + "_";
14214         },
14215         // createStore creates a store.js instance with the first
14216         // functioning storage in the list of storage candidates,
14217         // and applies the the given mixins to the instance.
14218         createStore: function() {
14219           return createStore.apply(this, arguments);
14220         },
14221         addPlugin: function(plugin) {
14222           this._addPlugin(plugin);
14223         },
14224         namespace: function(namespace) {
14225           return createStore(this.storage, this.plugins, namespace);
14226         }
14227       };
14228       function _warn() {
14229         var _console = typeof console == "undefined" ? null : console;
14230         if (!_console) {
14231           return;
14232         }
14233         var fn = _console.warn ? _console.warn : _console.log;
14234         fn.apply(_console, arguments);
14235       }
14236       function createStore(storages, plugins, namespace) {
14237         if (!namespace) {
14238           namespace = "";
14239         }
14240         if (storages && !isList(storages)) {
14241           storages = [storages];
14242         }
14243         if (plugins && !isList(plugins)) {
14244           plugins = [plugins];
14245         }
14246         var namespacePrefix = namespace ? "__storejs_" + namespace + "_" : "";
14247         var namespaceRegexp = namespace ? new RegExp("^" + namespacePrefix) : null;
14248         var legalNamespaces = /^[a-zA-Z0-9_\-]*$/;
14249         if (!legalNamespaces.test(namespace)) {
14250           throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");
14251         }
14252         var _privateStoreProps = {
14253           _namespacePrefix: namespacePrefix,
14254           _namespaceRegexp: namespaceRegexp,
14255           _testStorage: function(storage) {
14256             try {
14257               var testStr = "__storejs__test__";
14258               storage.write(testStr, testStr);
14259               var ok = storage.read(testStr) === testStr;
14260               storage.remove(testStr);
14261               return ok;
14262             } catch (e3) {
14263               return false;
14264             }
14265           },
14266           _assignPluginFnProp: function(pluginFnProp, propName) {
14267             var oldFn = this[propName];
14268             this[propName] = function pluginFn() {
14269               var args = slice(arguments, 0);
14270               var self2 = this;
14271               function super_fn() {
14272                 if (!oldFn) {
14273                   return;
14274                 }
14275                 each(arguments, function(arg, i3) {
14276                   args[i3] = arg;
14277                 });
14278                 return oldFn.apply(self2, args);
14279               }
14280               var newFnArgs = [super_fn].concat(args);
14281               return pluginFnProp.apply(self2, newFnArgs);
14282             };
14283           },
14284           _serialize: function(obj) {
14285             return JSON.stringify(obj);
14286           },
14287           _deserialize: function(strVal, defaultVal) {
14288             if (!strVal) {
14289               return defaultVal;
14290             }
14291             var val = "";
14292             try {
14293               val = JSON.parse(strVal);
14294             } catch (e3) {
14295               val = strVal;
14296             }
14297             return val !== void 0 ? val : defaultVal;
14298           },
14299           _addStorage: function(storage) {
14300             if (this.enabled) {
14301               return;
14302             }
14303             if (this._testStorage(storage)) {
14304               this.storage = storage;
14305               this.enabled = true;
14306             }
14307           },
14308           _addPlugin: function(plugin) {
14309             var self2 = this;
14310             if (isList(plugin)) {
14311               each(plugin, function(plugin2) {
14312                 self2._addPlugin(plugin2);
14313               });
14314               return;
14315             }
14316             var seenPlugin = pluck(this.plugins, function(seenPlugin2) {
14317               return plugin === seenPlugin2;
14318             });
14319             if (seenPlugin) {
14320               return;
14321             }
14322             this.plugins.push(plugin);
14323             if (!isFunction2(plugin)) {
14324               throw new Error("Plugins must be function values that return objects");
14325             }
14326             var pluginProperties = plugin.call(this);
14327             if (!isObject3(pluginProperties)) {
14328               throw new Error("Plugins must return an object of function properties");
14329             }
14330             each(pluginProperties, function(pluginFnProp, propName) {
14331               if (!isFunction2(pluginFnProp)) {
14332                 throw new Error("Bad plugin property: " + propName + " from plugin " + plugin.name + ". Plugins should only return functions.");
14333               }
14334               self2._assignPluginFnProp(pluginFnProp, propName);
14335             });
14336           },
14337           // Put deprecated properties in the private API, so as to not expose it to accidential
14338           // discovery through inspection of the store object.
14339           // Deprecated: addStorage
14340           addStorage: function(storage) {
14341             _warn("store.addStorage(storage) is deprecated. Use createStore([storages])");
14342             this._addStorage(storage);
14343           }
14344         };
14345         var store2 = create2(_privateStoreProps, storeAPI, {
14346           plugins: []
14347         });
14348         store2.raw = {};
14349         each(store2, function(prop, propName) {
14350           if (isFunction2(prop)) {
14351             store2.raw[propName] = bind(store2, prop);
14352           }
14353         });
14354         each(storages, function(storage) {
14355           store2._addStorage(storage);
14356         });
14357         each(plugins, function(plugin) {
14358           store2._addPlugin(plugin);
14359         });
14360         return store2;
14361       }
14362     }
14363   });
14364
14365   // node_modules/store/storages/localStorage.js
14366   var require_localStorage = __commonJS({
14367     "node_modules/store/storages/localStorage.js"(exports2, module2) {
14368       var util = require_util();
14369       var Global = util.Global;
14370       module2.exports = {
14371         name: "localStorage",
14372         read,
14373         write,
14374         each,
14375         remove: remove2,
14376         clearAll
14377       };
14378       function localStorage2() {
14379         return Global.localStorage;
14380       }
14381       function read(key) {
14382         return localStorage2().getItem(key);
14383       }
14384       function write(key, data) {
14385         return localStorage2().setItem(key, data);
14386       }
14387       function each(fn) {
14388         for (var i3 = localStorage2().length - 1; i3 >= 0; i3--) {
14389           var key = localStorage2().key(i3);
14390           fn(read(key), key);
14391         }
14392       }
14393       function remove2(key) {
14394         return localStorage2().removeItem(key);
14395       }
14396       function clearAll() {
14397         return localStorage2().clear();
14398       }
14399     }
14400   });
14401
14402   // node_modules/store/storages/oldFF-globalStorage.js
14403   var require_oldFF_globalStorage = __commonJS({
14404     "node_modules/store/storages/oldFF-globalStorage.js"(exports2, module2) {
14405       var util = require_util();
14406       var Global = util.Global;
14407       module2.exports = {
14408         name: "oldFF-globalStorage",
14409         read,
14410         write,
14411         each,
14412         remove: remove2,
14413         clearAll
14414       };
14415       var globalStorage = Global.globalStorage;
14416       function read(key) {
14417         return globalStorage[key];
14418       }
14419       function write(key, data) {
14420         globalStorage[key] = data;
14421       }
14422       function each(fn) {
14423         for (var i3 = globalStorage.length - 1; i3 >= 0; i3--) {
14424           var key = globalStorage.key(i3);
14425           fn(globalStorage[key], key);
14426         }
14427       }
14428       function remove2(key) {
14429         return globalStorage.removeItem(key);
14430       }
14431       function clearAll() {
14432         each(function(key, _2) {
14433           delete globalStorage[key];
14434         });
14435       }
14436     }
14437   });
14438
14439   // node_modules/store/storages/oldIE-userDataStorage.js
14440   var require_oldIE_userDataStorage = __commonJS({
14441     "node_modules/store/storages/oldIE-userDataStorage.js"(exports2, module2) {
14442       var util = require_util();
14443       var Global = util.Global;
14444       module2.exports = {
14445         name: "oldIE-userDataStorage",
14446         write,
14447         read,
14448         each,
14449         remove: remove2,
14450         clearAll
14451       };
14452       var storageName = "storejs";
14453       var doc = Global.document;
14454       var _withStorageEl = _makeIEStorageElFunction();
14455       var disable = (Global.navigator ? Global.navigator.userAgent : "").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);
14456       function write(unfixedKey, data) {
14457         if (disable) {
14458           return;
14459         }
14460         var fixedKey = fixKey(unfixedKey);
14461         _withStorageEl(function(storageEl) {
14462           storageEl.setAttribute(fixedKey, data);
14463           storageEl.save(storageName);
14464         });
14465       }
14466       function read(unfixedKey) {
14467         if (disable) {
14468           return;
14469         }
14470         var fixedKey = fixKey(unfixedKey);
14471         var res = null;
14472         _withStorageEl(function(storageEl) {
14473           res = storageEl.getAttribute(fixedKey);
14474         });
14475         return res;
14476       }
14477       function each(callback) {
14478         _withStorageEl(function(storageEl) {
14479           var attributes = storageEl.XMLDocument.documentElement.attributes;
14480           for (var i3 = attributes.length - 1; i3 >= 0; i3--) {
14481             var attr = attributes[i3];
14482             callback(storageEl.getAttribute(attr.name), attr.name);
14483           }
14484         });
14485       }
14486       function remove2(unfixedKey) {
14487         var fixedKey = fixKey(unfixedKey);
14488         _withStorageEl(function(storageEl) {
14489           storageEl.removeAttribute(fixedKey);
14490           storageEl.save(storageName);
14491         });
14492       }
14493       function clearAll() {
14494         _withStorageEl(function(storageEl) {
14495           var attributes = storageEl.XMLDocument.documentElement.attributes;
14496           storageEl.load(storageName);
14497           for (var i3 = attributes.length - 1; i3 >= 0; i3--) {
14498             storageEl.removeAttribute(attributes[i3].name);
14499           }
14500           storageEl.save(storageName);
14501         });
14502       }
14503       var forbiddenCharsRegex = new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]", "g");
14504       function fixKey(key) {
14505         return key.replace(/^\d/, "___$&").replace(forbiddenCharsRegex, "___");
14506       }
14507       function _makeIEStorageElFunction() {
14508         if (!doc || !doc.documentElement || !doc.documentElement.addBehavior) {
14509           return null;
14510         }
14511         var scriptTag = "script", storageOwner, storageContainer, storageEl;
14512         try {
14513           storageContainer = new ActiveXObject("htmlfile");
14514           storageContainer.open();
14515           storageContainer.write("<" + scriptTag + ">document.w=window</" + scriptTag + '><iframe src="/favicon.ico"></iframe>');
14516           storageContainer.close();
14517           storageOwner = storageContainer.w.frames[0].document;
14518           storageEl = storageOwner.createElement("div");
14519         } catch (e3) {
14520           storageEl = doc.createElement("div");
14521           storageOwner = doc.body;
14522         }
14523         return function(storeFunction) {
14524           var args = [].slice.call(arguments, 0);
14525           args.unshift(storageEl);
14526           storageOwner.appendChild(storageEl);
14527           storageEl.addBehavior("#default#userData");
14528           storageEl.load(storageName);
14529           storeFunction.apply(this, args);
14530           storageOwner.removeChild(storageEl);
14531           return;
14532         };
14533       }
14534     }
14535   });
14536
14537   // node_modules/store/storages/cookieStorage.js
14538   var require_cookieStorage = __commonJS({
14539     "node_modules/store/storages/cookieStorage.js"(exports2, module2) {
14540       var util = require_util();
14541       var Global = util.Global;
14542       var trim = util.trim;
14543       module2.exports = {
14544         name: "cookieStorage",
14545         read,
14546         write,
14547         each,
14548         remove: remove2,
14549         clearAll
14550       };
14551       var doc = Global.document;
14552       function read(key) {
14553         if (!key || !_has(key)) {
14554           return null;
14555         }
14556         var regexpStr = "(?:^|.*;\\s*)" + escape(key).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";
14557         return unescape(doc.cookie.replace(new RegExp(regexpStr), "$1"));
14558       }
14559       function each(callback) {
14560         var cookies = doc.cookie.split(/; ?/g);
14561         for (var i3 = cookies.length - 1; i3 >= 0; i3--) {
14562           if (!trim(cookies[i3])) {
14563             continue;
14564           }
14565           var kvp = cookies[i3].split("=");
14566           var key = unescape(kvp[0]);
14567           var val = unescape(kvp[1]);
14568           callback(val, key);
14569         }
14570       }
14571       function write(key, data) {
14572         if (!key) {
14573           return;
14574         }
14575         doc.cookie = escape(key) + "=" + escape(data) + "; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/";
14576       }
14577       function remove2(key) {
14578         if (!key || !_has(key)) {
14579           return;
14580         }
14581         doc.cookie = escape(key) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
14582       }
14583       function clearAll() {
14584         each(function(_2, key) {
14585           remove2(key);
14586         });
14587       }
14588       function _has(key) {
14589         return new RegExp("(?:^|;\\s*)" + escape(key).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=").test(doc.cookie);
14590       }
14591     }
14592   });
14593
14594   // node_modules/store/storages/sessionStorage.js
14595   var require_sessionStorage = __commonJS({
14596     "node_modules/store/storages/sessionStorage.js"(exports2, module2) {
14597       var util = require_util();
14598       var Global = util.Global;
14599       module2.exports = {
14600         name: "sessionStorage",
14601         read,
14602         write,
14603         each,
14604         remove: remove2,
14605         clearAll
14606       };
14607       function sessionStorage() {
14608         return Global.sessionStorage;
14609       }
14610       function read(key) {
14611         return sessionStorage().getItem(key);
14612       }
14613       function write(key, data) {
14614         return sessionStorage().setItem(key, data);
14615       }
14616       function each(fn) {
14617         for (var i3 = sessionStorage().length - 1; i3 >= 0; i3--) {
14618           var key = sessionStorage().key(i3);
14619           fn(read(key), key);
14620         }
14621       }
14622       function remove2(key) {
14623         return sessionStorage().removeItem(key);
14624       }
14625       function clearAll() {
14626         return sessionStorage().clear();
14627       }
14628     }
14629   });
14630
14631   // node_modules/store/storages/memoryStorage.js
14632   var require_memoryStorage = __commonJS({
14633     "node_modules/store/storages/memoryStorage.js"(exports2, module2) {
14634       module2.exports = {
14635         name: "memoryStorage",
14636         read,
14637         write,
14638         each,
14639         remove: remove2,
14640         clearAll
14641       };
14642       var memoryStorage = {};
14643       function read(key) {
14644         return memoryStorage[key];
14645       }
14646       function write(key, data) {
14647         memoryStorage[key] = data;
14648       }
14649       function each(callback) {
14650         for (var key in memoryStorage) {
14651           if (memoryStorage.hasOwnProperty(key)) {
14652             callback(memoryStorage[key], key);
14653           }
14654         }
14655       }
14656       function remove2(key) {
14657         delete memoryStorage[key];
14658       }
14659       function clearAll(key) {
14660         memoryStorage = {};
14661       }
14662     }
14663   });
14664
14665   // node_modules/store/storages/all.js
14666   var require_all = __commonJS({
14667     "node_modules/store/storages/all.js"(exports2, module2) {
14668       module2.exports = [
14669         // Listed in order of usage preference
14670         require_localStorage(),
14671         require_oldFF_globalStorage(),
14672         require_oldIE_userDataStorage(),
14673         require_cookieStorage(),
14674         require_sessionStorage(),
14675         require_memoryStorage()
14676       ];
14677     }
14678   });
14679
14680   // node_modules/store/plugins/lib/json2.js
14681   var require_json2 = __commonJS({
14682     "node_modules/store/plugins/lib/json2.js"(exports, module) {
14683       if (typeof JSON !== "object") {
14684         JSON = {};
14685       }
14686       (function() {
14687         "use strict";
14688         var rx_one = /^[\],:{}\s]*$/;
14689         var rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;
14690         var rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;
14691         var rx_four = /(?:^|:|,)(?:\s*\[)+/g;
14692         var rx_escapable = /[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
14693         var rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
14694         function f(n3) {
14695           return n3 < 10 ? "0" + n3 : n3;
14696         }
14697         function this_value() {
14698           return this.valueOf();
14699         }
14700         if (typeof Date.prototype.toJSON !== "function") {
14701           Date.prototype.toJSON = function() {
14702             return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-" + f(this.getUTCMonth() + 1) + "-" + f(this.getUTCDate()) + "T" + f(this.getUTCHours()) + ":" + f(this.getUTCMinutes()) + ":" + f(this.getUTCSeconds()) + "Z" : null;
14703           };
14704           Boolean.prototype.toJSON = this_value;
14705           Number.prototype.toJSON = this_value;
14706           String.prototype.toJSON = this_value;
14707         }
14708         var gap;
14709         var indent;
14710         var meta;
14711         var rep;
14712         function quote(string) {
14713           rx_escapable.lastIndex = 0;
14714           return rx_escapable.test(string) ? '"' + string.replace(rx_escapable, function(a2) {
14715             var c2 = meta[a2];
14716             return typeof c2 === "string" ? c2 : "\\u" + ("0000" + a2.charCodeAt(0).toString(16)).slice(-4);
14717           }) + '"' : '"' + string + '"';
14718         }
14719         function str(key, holder) {
14720           var i3;
14721           var k2;
14722           var v2;
14723           var length;
14724           var mind = gap;
14725           var partial;
14726           var value = holder[key];
14727           if (value && typeof value === "object" && typeof value.toJSON === "function") {
14728             value = value.toJSON(key);
14729           }
14730           if (typeof rep === "function") {
14731             value = rep.call(holder, key, value);
14732           }
14733           switch (typeof value) {
14734             case "string":
14735               return quote(value);
14736             case "number":
14737               return isFinite(value) ? String(value) : "null";
14738             case "boolean":
14739             case "null":
14740               return String(value);
14741             case "object":
14742               if (!value) {
14743                 return "null";
14744               }
14745               gap += indent;
14746               partial = [];
14747               if (Object.prototype.toString.apply(value) === "[object Array]") {
14748                 length = value.length;
14749                 for (i3 = 0; i3 < length; i3 += 1) {
14750                   partial[i3] = str(i3, value) || "null";
14751                 }
14752                 v2 = partial.length === 0 ? "[]" : gap ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" : "[" + partial.join(",") + "]";
14753                 gap = mind;
14754                 return v2;
14755               }
14756               if (rep && typeof rep === "object") {
14757                 length = rep.length;
14758                 for (i3 = 0; i3 < length; i3 += 1) {
14759                   if (typeof rep[i3] === "string") {
14760                     k2 = rep[i3];
14761                     v2 = str(k2, value);
14762                     if (v2) {
14763                       partial.push(quote(k2) + (gap ? ": " : ":") + v2);
14764                     }
14765                   }
14766                 }
14767               } else {
14768                 for (k2 in value) {
14769                   if (Object.prototype.hasOwnProperty.call(value, k2)) {
14770                     v2 = str(k2, value);
14771                     if (v2) {
14772                       partial.push(quote(k2) + (gap ? ": " : ":") + v2);
14773                     }
14774                   }
14775                 }
14776               }
14777               v2 = partial.length === 0 ? "{}" : gap ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}" : "{" + partial.join(",") + "}";
14778               gap = mind;
14779               return v2;
14780           }
14781         }
14782         if (typeof JSON.stringify !== "function") {
14783           meta = {
14784             // table of character substitutions
14785             "\b": "\\b",
14786             "   ": "\\t",
14787             "\n": "\\n",
14788             "\f": "\\f",
14789             "\r": "\\r",
14790             '"': '\\"',
14791             "\\": "\\\\"
14792           };
14793           JSON.stringify = function(value, replacer, space) {
14794             var i3;
14795             gap = "";
14796             indent = "";
14797             if (typeof space === "number") {
14798               for (i3 = 0; i3 < space; i3 += 1) {
14799                 indent += " ";
14800               }
14801             } else if (typeof space === "string") {
14802               indent = space;
14803             }
14804             rep = replacer;
14805             if (replacer && typeof replacer !== "function" && (typeof replacer !== "object" || typeof replacer.length !== "number")) {
14806               throw new Error("JSON.stringify");
14807             }
14808             return str("", { "": value });
14809           };
14810         }
14811         if (typeof JSON.parse !== "function") {
14812           JSON.parse = function(text, reviver) {
14813             var j;
14814             function walk(holder, key) {
14815               var k2;
14816               var v2;
14817               var value = holder[key];
14818               if (value && typeof value === "object") {
14819                 for (k2 in value) {
14820                   if (Object.prototype.hasOwnProperty.call(value, k2)) {
14821                     v2 = walk(value, k2);
14822                     if (v2 !== void 0) {
14823                       value[k2] = v2;
14824                     } else {
14825                       delete value[k2];
14826                     }
14827                   }
14828                 }
14829               }
14830               return reviver.call(holder, key, value);
14831             }
14832             text = String(text);
14833             rx_dangerous.lastIndex = 0;
14834             if (rx_dangerous.test(text)) {
14835               text = text.replace(rx_dangerous, function(a2) {
14836                 return "\\u" + ("0000" + a2.charCodeAt(0).toString(16)).slice(-4);
14837               });
14838             }
14839             if (rx_one.test(
14840               text.replace(rx_two, "@").replace(rx_three, "]").replace(rx_four, "")
14841             )) {
14842               j = eval("(" + text + ")");
14843               return typeof reviver === "function" ? walk({ "": j }, "") : j;
14844             }
14845             throw new SyntaxError("JSON.parse");
14846           };
14847         }
14848       })();
14849     }
14850   });
14851
14852   // node_modules/store/plugins/json2.js
14853   var require_json22 = __commonJS({
14854     "node_modules/store/plugins/json2.js"(exports2, module2) {
14855       module2.exports = json2Plugin;
14856       function json2Plugin() {
14857         require_json2();
14858         return {};
14859       }
14860     }
14861   });
14862
14863   // node_modules/store/dist/store.legacy.js
14864   var require_store_legacy = __commonJS({
14865     "node_modules/store/dist/store.legacy.js"(exports2, module2) {
14866       var engine = require_store_engine();
14867       var storages = require_all();
14868       var plugins = [require_json22()];
14869       module2.exports = engine.createStore(storages, plugins);
14870     }
14871   });
14872
14873   // node_modules/whatwg-fetch/fetch.js
14874   var g = typeof globalThis !== "undefined" && globalThis || typeof self !== "undefined" && self || // eslint-disable-next-line no-undef
14875   typeof global !== "undefined" && global || {};
14876   var support = {
14877     searchParams: "URLSearchParams" in g,
14878     iterable: "Symbol" in g && "iterator" in Symbol,
14879     blob: "FileReader" in g && "Blob" in g && function() {
14880       try {
14881         new Blob();
14882         return true;
14883       } catch (e3) {
14884         return false;
14885       }
14886     }(),
14887     formData: "FormData" in g,
14888     arrayBuffer: "ArrayBuffer" in g
14889   };
14890   function isDataView(obj) {
14891     return obj && DataView.prototype.isPrototypeOf(obj);
14892   }
14893   if (support.arrayBuffer) {
14894     viewClasses = [
14895       "[object Int8Array]",
14896       "[object Uint8Array]",
14897       "[object Uint8ClampedArray]",
14898       "[object Int16Array]",
14899       "[object Uint16Array]",
14900       "[object Int32Array]",
14901       "[object Uint32Array]",
14902       "[object Float32Array]",
14903       "[object Float64Array]"
14904     ];
14905     isArrayBufferView = ArrayBuffer.isView || function(obj) {
14906       return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1;
14907     };
14908   }
14909   var viewClasses;
14910   var isArrayBufferView;
14911   function normalizeName(name) {
14912     if (typeof name !== "string") {
14913       name = String(name);
14914     }
14915     if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === "") {
14916       throw new TypeError('Invalid character in header field name: "' + name + '"');
14917     }
14918     return name.toLowerCase();
14919   }
14920   function normalizeValue(value) {
14921     if (typeof value !== "string") {
14922       value = String(value);
14923     }
14924     return value;
14925   }
14926   function iteratorFor(items) {
14927     var iterator = {
14928       next: function() {
14929         var value = items.shift();
14930         return { done: value === void 0, value };
14931       }
14932     };
14933     if (support.iterable) {
14934       iterator[Symbol.iterator] = function() {
14935         return iterator;
14936       };
14937     }
14938     return iterator;
14939   }
14940   function Headers(headers) {
14941     this.map = {};
14942     if (headers instanceof Headers) {
14943       headers.forEach(function(value, name) {
14944         this.append(name, value);
14945       }, this);
14946     } else if (Array.isArray(headers)) {
14947       headers.forEach(function(header) {
14948         if (header.length != 2) {
14949           throw new TypeError("Headers constructor: expected name/value pair to be length 2, found" + header.length);
14950         }
14951         this.append(header[0], header[1]);
14952       }, this);
14953     } else if (headers) {
14954       Object.getOwnPropertyNames(headers).forEach(function(name) {
14955         this.append(name, headers[name]);
14956       }, this);
14957     }
14958   }
14959   Headers.prototype.append = function(name, value) {
14960     name = normalizeName(name);
14961     value = normalizeValue(value);
14962     var oldValue = this.map[name];
14963     this.map[name] = oldValue ? oldValue + ", " + value : value;
14964   };
14965   Headers.prototype["delete"] = function(name) {
14966     delete this.map[normalizeName(name)];
14967   };
14968   Headers.prototype.get = function(name) {
14969     name = normalizeName(name);
14970     return this.has(name) ? this.map[name] : null;
14971   };
14972   Headers.prototype.has = function(name) {
14973     return this.map.hasOwnProperty(normalizeName(name));
14974   };
14975   Headers.prototype.set = function(name, value) {
14976     this.map[normalizeName(name)] = normalizeValue(value);
14977   };
14978   Headers.prototype.forEach = function(callback, thisArg) {
14979     for (var name in this.map) {
14980       if (this.map.hasOwnProperty(name)) {
14981         callback.call(thisArg, this.map[name], name, this);
14982       }
14983     }
14984   };
14985   Headers.prototype.keys = function() {
14986     var items = [];
14987     this.forEach(function(value, name) {
14988       items.push(name);
14989     });
14990     return iteratorFor(items);
14991   };
14992   Headers.prototype.values = function() {
14993     var items = [];
14994     this.forEach(function(value) {
14995       items.push(value);
14996     });
14997     return iteratorFor(items);
14998   };
14999   Headers.prototype.entries = function() {
15000     var items = [];
15001     this.forEach(function(value, name) {
15002       items.push([name, value]);
15003     });
15004     return iteratorFor(items);
15005   };
15006   if (support.iterable) {
15007     Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
15008   }
15009   function consumed(body) {
15010     if (body._noBody)
15011       return;
15012     if (body.bodyUsed) {
15013       return Promise.reject(new TypeError("Already read"));
15014     }
15015     body.bodyUsed = true;
15016   }
15017   function fileReaderReady(reader) {
15018     return new Promise(function(resolve, reject) {
15019       reader.onload = function() {
15020         resolve(reader.result);
15021       };
15022       reader.onerror = function() {
15023         reject(reader.error);
15024       };
15025     });
15026   }
15027   function readBlobAsArrayBuffer(blob) {
15028     var reader = new FileReader();
15029     var promise = fileReaderReady(reader);
15030     reader.readAsArrayBuffer(blob);
15031     return promise;
15032   }
15033   function readBlobAsText(blob) {
15034     var reader = new FileReader();
15035     var promise = fileReaderReady(reader);
15036     var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type);
15037     var encoding = match ? match[1] : "utf-8";
15038     reader.readAsText(blob, encoding);
15039     return promise;
15040   }
15041   function readArrayBufferAsText(buf) {
15042     var view = new Uint8Array(buf);
15043     var chars = new Array(view.length);
15044     for (var i3 = 0; i3 < view.length; i3++) {
15045       chars[i3] = String.fromCharCode(view[i3]);
15046     }
15047     return chars.join("");
15048   }
15049   function bufferClone(buf) {
15050     if (buf.slice) {
15051       return buf.slice(0);
15052     } else {
15053       var view = new Uint8Array(buf.byteLength);
15054       view.set(new Uint8Array(buf));
15055       return view.buffer;
15056     }
15057   }
15058   function Body() {
15059     this.bodyUsed = false;
15060     this._initBody = function(body) {
15061       this.bodyUsed = this.bodyUsed;
15062       this._bodyInit = body;
15063       if (!body) {
15064         this._noBody = true;
15065         this._bodyText = "";
15066       } else if (typeof body === "string") {
15067         this._bodyText = body;
15068       } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
15069         this._bodyBlob = body;
15070       } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
15071         this._bodyFormData = body;
15072       } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
15073         this._bodyText = body.toString();
15074       } else if (support.arrayBuffer && support.blob && isDataView(body)) {
15075         this._bodyArrayBuffer = bufferClone(body.buffer);
15076         this._bodyInit = new Blob([this._bodyArrayBuffer]);
15077       } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
15078         this._bodyArrayBuffer = bufferClone(body);
15079       } else {
15080         this._bodyText = body = Object.prototype.toString.call(body);
15081       }
15082       if (!this.headers.get("content-type")) {
15083         if (typeof body === "string") {
15084           this.headers.set("content-type", "text/plain;charset=UTF-8");
15085         } else if (this._bodyBlob && this._bodyBlob.type) {
15086           this.headers.set("content-type", this._bodyBlob.type);
15087         } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
15088           this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8");
15089         }
15090       }
15091     };
15092     if (support.blob) {
15093       this.blob = function() {
15094         var rejected = consumed(this);
15095         if (rejected) {
15096           return rejected;
15097         }
15098         if (this._bodyBlob) {
15099           return Promise.resolve(this._bodyBlob);
15100         } else if (this._bodyArrayBuffer) {
15101           return Promise.resolve(new Blob([this._bodyArrayBuffer]));
15102         } else if (this._bodyFormData) {
15103           throw new Error("could not read FormData body as blob");
15104         } else {
15105           return Promise.resolve(new Blob([this._bodyText]));
15106         }
15107       };
15108     }
15109     this.arrayBuffer = function() {
15110       if (this._bodyArrayBuffer) {
15111         var isConsumed = consumed(this);
15112         if (isConsumed) {
15113           return isConsumed;
15114         } else if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
15115           return Promise.resolve(
15116             this._bodyArrayBuffer.buffer.slice(
15117               this._bodyArrayBuffer.byteOffset,
15118               this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
15119             )
15120           );
15121         } else {
15122           return Promise.resolve(this._bodyArrayBuffer);
15123         }
15124       } else if (support.blob) {
15125         return this.blob().then(readBlobAsArrayBuffer);
15126       } else {
15127         throw new Error("could not read as ArrayBuffer");
15128       }
15129     };
15130     this.text = function() {
15131       var rejected = consumed(this);
15132       if (rejected) {
15133         return rejected;
15134       }
15135       if (this._bodyBlob) {
15136         return readBlobAsText(this._bodyBlob);
15137       } else if (this._bodyArrayBuffer) {
15138         return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));
15139       } else if (this._bodyFormData) {
15140         throw new Error("could not read FormData body as text");
15141       } else {
15142         return Promise.resolve(this._bodyText);
15143       }
15144     };
15145     if (support.formData) {
15146       this.formData = function() {
15147         return this.text().then(decode);
15148       };
15149     }
15150     this.json = function() {
15151       return this.text().then(JSON.parse);
15152     };
15153     return this;
15154   }
15155   var methods = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
15156   function normalizeMethod(method) {
15157     var upcased = method.toUpperCase();
15158     return methods.indexOf(upcased) > -1 ? upcased : method;
15159   }
15160   function Request(input, options2) {
15161     if (!(this instanceof Request)) {
15162       throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
15163     }
15164     options2 = options2 || {};
15165     var body = options2.body;
15166     if (input instanceof Request) {
15167       if (input.bodyUsed) {
15168         throw new TypeError("Already read");
15169       }
15170       this.url = input.url;
15171       this.credentials = input.credentials;
15172       if (!options2.headers) {
15173         this.headers = new Headers(input.headers);
15174       }
15175       this.method = input.method;
15176       this.mode = input.mode;
15177       this.signal = input.signal;
15178       if (!body && input._bodyInit != null) {
15179         body = input._bodyInit;
15180         input.bodyUsed = true;
15181       }
15182     } else {
15183       this.url = String(input);
15184     }
15185     this.credentials = options2.credentials || this.credentials || "same-origin";
15186     if (options2.headers || !this.headers) {
15187       this.headers = new Headers(options2.headers);
15188     }
15189     this.method = normalizeMethod(options2.method || this.method || "GET");
15190     this.mode = options2.mode || this.mode || null;
15191     this.signal = options2.signal || this.signal || function() {
15192       if ("AbortController" in g) {
15193         var ctrl = new AbortController();
15194         return ctrl.signal;
15195       }
15196     }();
15197     this.referrer = null;
15198     if ((this.method === "GET" || this.method === "HEAD") && body) {
15199       throw new TypeError("Body not allowed for GET or HEAD requests");
15200     }
15201     this._initBody(body);
15202     if (this.method === "GET" || this.method === "HEAD") {
15203       if (options2.cache === "no-store" || options2.cache === "no-cache") {
15204         var reParamSearch = /([?&])_=[^&]*/;
15205         if (reParamSearch.test(this.url)) {
15206           this.url = this.url.replace(reParamSearch, "$1_=" + (/* @__PURE__ */ new Date()).getTime());
15207         } else {
15208           var reQueryString = /\?/;
15209           this.url += (reQueryString.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
15210         }
15211       }
15212     }
15213   }
15214   Request.prototype.clone = function() {
15215     return new Request(this, { body: this._bodyInit });
15216   };
15217   function decode(body) {
15218     var form = new FormData();
15219     body.trim().split("&").forEach(function(bytes) {
15220       if (bytes) {
15221         var split = bytes.split("=");
15222         var name = split.shift().replace(/\+/g, " ");
15223         var value = split.join("=").replace(/\+/g, " ");
15224         form.append(decodeURIComponent(name), decodeURIComponent(value));
15225       }
15226     });
15227     return form;
15228   }
15229   function parseHeaders(rawHeaders) {
15230     var headers = new Headers();
15231     var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, " ");
15232     preProcessedHeaders.split("\r").map(function(header) {
15233       return header.indexOf("\n") === 0 ? header.substr(1, header.length) : header;
15234     }).forEach(function(line) {
15235       var parts = line.split(":");
15236       var key = parts.shift().trim();
15237       if (key) {
15238         var value = parts.join(":").trim();
15239         try {
15240           headers.append(key, value);
15241         } catch (error) {
15242           console.warn("Response " + error.message);
15243         }
15244       }
15245     });
15246     return headers;
15247   }
15248   Body.call(Request.prototype);
15249   function Response(bodyInit, options2) {
15250     if (!(this instanceof Response)) {
15251       throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
15252     }
15253     if (!options2) {
15254       options2 = {};
15255     }
15256     this.type = "default";
15257     this.status = options2.status === void 0 ? 200 : options2.status;
15258     if (this.status < 200 || this.status > 599) {
15259       throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");
15260     }
15261     this.ok = this.status >= 200 && this.status < 300;
15262     this.statusText = options2.statusText === void 0 ? "" : "" + options2.statusText;
15263     this.headers = new Headers(options2.headers);
15264     this.url = options2.url || "";
15265     this._initBody(bodyInit);
15266   }
15267   Body.call(Response.prototype);
15268   Response.prototype.clone = function() {
15269     return new Response(this._bodyInit, {
15270       status: this.status,
15271       statusText: this.statusText,
15272       headers: new Headers(this.headers),
15273       url: this.url
15274     });
15275   };
15276   Response.error = function() {
15277     var response = new Response(null, { status: 200, statusText: "" });
15278     response.status = 0;
15279     response.type = "error";
15280     return response;
15281   };
15282   var redirectStatuses = [301, 302, 303, 307, 308];
15283   Response.redirect = function(url, status) {
15284     if (redirectStatuses.indexOf(status) === -1) {
15285       throw new RangeError("Invalid status code");
15286     }
15287     return new Response(null, { status, headers: { location: url } });
15288   };
15289   var DOMException2 = g.DOMException;
15290   try {
15291     new DOMException2();
15292   } catch (err) {
15293     DOMException2 = function(message, name) {
15294       this.message = message;
15295       this.name = name;
15296       var error = Error(message);
15297       this.stack = error.stack;
15298     };
15299     DOMException2.prototype = Object.create(Error.prototype);
15300     DOMException2.prototype.constructor = DOMException2;
15301   }
15302   function fetch2(input, init2) {
15303     return new Promise(function(resolve, reject) {
15304       var request3 = new Request(input, init2);
15305       if (request3.signal && request3.signal.aborted) {
15306         return reject(new DOMException2("Aborted", "AbortError"));
15307       }
15308       var xhr = new XMLHttpRequest();
15309       function abortXhr() {
15310         xhr.abort();
15311       }
15312       xhr.onload = function() {
15313         var options2 = {
15314           status: xhr.status,
15315           statusText: xhr.statusText,
15316           headers: parseHeaders(xhr.getAllResponseHeaders() || "")
15317         };
15318         options2.url = "responseURL" in xhr ? xhr.responseURL : options2.headers.get("X-Request-URL");
15319         var body = "response" in xhr ? xhr.response : xhr.responseText;
15320         setTimeout(function() {
15321           resolve(new Response(body, options2));
15322         }, 0);
15323       };
15324       xhr.onerror = function() {
15325         setTimeout(function() {
15326           reject(new TypeError("Network request failed"));
15327         }, 0);
15328       };
15329       xhr.ontimeout = function() {
15330         setTimeout(function() {
15331           reject(new TypeError("Network request failed"));
15332         }, 0);
15333       };
15334       xhr.onabort = function() {
15335         setTimeout(function() {
15336           reject(new DOMException2("Aborted", "AbortError"));
15337         }, 0);
15338       };
15339       function fixUrl(url) {
15340         try {
15341           return url === "" && g.location.href ? g.location.href : url;
15342         } catch (e3) {
15343           return url;
15344         }
15345       }
15346       xhr.open(request3.method, fixUrl(request3.url), true);
15347       if (request3.credentials === "include") {
15348         xhr.withCredentials = true;
15349       } else if (request3.credentials === "omit") {
15350         xhr.withCredentials = false;
15351       }
15352       if ("responseType" in xhr) {
15353         if (support.blob) {
15354           xhr.responseType = "blob";
15355         } else if (support.arrayBuffer) {
15356           xhr.responseType = "arraybuffer";
15357         }
15358       }
15359       if (init2 && typeof init2.headers === "object" && !(init2.headers instanceof Headers || g.Headers && init2.headers instanceof g.Headers)) {
15360         var names = [];
15361         Object.getOwnPropertyNames(init2.headers).forEach(function(name) {
15362           names.push(normalizeName(name));
15363           xhr.setRequestHeader(name, normalizeValue(init2.headers[name]));
15364         });
15365         request3.headers.forEach(function(value, name) {
15366           if (names.indexOf(name) === -1) {
15367             xhr.setRequestHeader(name, value);
15368           }
15369         });
15370       } else {
15371         request3.headers.forEach(function(value, name) {
15372           xhr.setRequestHeader(name, value);
15373         });
15374       }
15375       if (request3.signal) {
15376         request3.signal.addEventListener("abort", abortXhr);
15377         xhr.onreadystatechange = function() {
15378           if (xhr.readyState === 4) {
15379             request3.signal.removeEventListener("abort", abortXhr);
15380           }
15381         };
15382       }
15383       xhr.send(typeof request3._bodyInit === "undefined" ? null : request3._bodyInit);
15384     });
15385   }
15386   fetch2.polyfill = true;
15387   if (!g.fetch) {
15388     g.fetch = fetch2;
15389     g.Headers = Headers;
15390     g.Request = Request;
15391     g.Response = Response;
15392   }
15393
15394   // node_modules/abortcontroller-polyfill/dist/polyfill-patch-fetch.js
15395   (function(factory) {
15396     typeof define === "function" && define.amd ? define(factory) : factory();
15397   })(function() {
15398     "use strict";
15399     function _classCallCheck(instance, Constructor) {
15400       if (!(instance instanceof Constructor)) {
15401         throw new TypeError("Cannot call a class as a function");
15402       }
15403     }
15404     function _defineProperties(target, props) {
15405       for (var i3 = 0; i3 < props.length; i3++) {
15406         var descriptor = props[i3];
15407         descriptor.enumerable = descriptor.enumerable || false;
15408         descriptor.configurable = true;
15409         if ("value" in descriptor)
15410           descriptor.writable = true;
15411         Object.defineProperty(target, descriptor.key, descriptor);
15412       }
15413     }
15414     function _createClass(Constructor, protoProps, staticProps) {
15415       if (protoProps)
15416         _defineProperties(Constructor.prototype, protoProps);
15417       if (staticProps)
15418         _defineProperties(Constructor, staticProps);
15419       Object.defineProperty(Constructor, "prototype", {
15420         writable: false
15421       });
15422       return Constructor;
15423     }
15424     function _inherits(subClass, superClass) {
15425       if (typeof superClass !== "function" && superClass !== null) {
15426         throw new TypeError("Super expression must either be null or a function");
15427       }
15428       subClass.prototype = Object.create(superClass && superClass.prototype, {
15429         constructor: {
15430           value: subClass,
15431           writable: true,
15432           configurable: true
15433         }
15434       });
15435       Object.defineProperty(subClass, "prototype", {
15436         writable: false
15437       });
15438       if (superClass)
15439         _setPrototypeOf(subClass, superClass);
15440     }
15441     function _getPrototypeOf(o2) {
15442       _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o3) {
15443         return o3.__proto__ || Object.getPrototypeOf(o3);
15444       };
15445       return _getPrototypeOf(o2);
15446     }
15447     function _setPrototypeOf(o2, p2) {
15448       _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o3, p3) {
15449         o3.__proto__ = p3;
15450         return o3;
15451       };
15452       return _setPrototypeOf(o2, p2);
15453     }
15454     function _isNativeReflectConstruct() {
15455       if (typeof Reflect === "undefined" || !Reflect.construct)
15456         return false;
15457       if (Reflect.construct.sham)
15458         return false;
15459       if (typeof Proxy === "function")
15460         return true;
15461       try {
15462         Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
15463         }));
15464         return true;
15465       } catch (e3) {
15466         return false;
15467       }
15468     }
15469     function _assertThisInitialized(self2) {
15470       if (self2 === void 0) {
15471         throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
15472       }
15473       return self2;
15474     }
15475     function _possibleConstructorReturn(self2, call) {
15476       if (call && (typeof call === "object" || typeof call === "function")) {
15477         return call;
15478       } else if (call !== void 0) {
15479         throw new TypeError("Derived constructors may only return object or undefined");
15480       }
15481       return _assertThisInitialized(self2);
15482     }
15483     function _createSuper(Derived) {
15484       var hasNativeReflectConstruct = _isNativeReflectConstruct();
15485       return function _createSuperInternal() {
15486         var Super = _getPrototypeOf(Derived), result;
15487         if (hasNativeReflectConstruct) {
15488           var NewTarget = _getPrototypeOf(this).constructor;
15489           result = Reflect.construct(Super, arguments, NewTarget);
15490         } else {
15491           result = Super.apply(this, arguments);
15492         }
15493         return _possibleConstructorReturn(this, result);
15494       };
15495     }
15496     function _superPropBase(object, property) {
15497       while (!Object.prototype.hasOwnProperty.call(object, property)) {
15498         object = _getPrototypeOf(object);
15499         if (object === null)
15500           break;
15501       }
15502       return object;
15503     }
15504     function _get() {
15505       if (typeof Reflect !== "undefined" && Reflect.get) {
15506         _get = Reflect.get.bind();
15507       } else {
15508         _get = function _get2(target, property, receiver) {
15509           var base = _superPropBase(target, property);
15510           if (!base)
15511             return;
15512           var desc = Object.getOwnPropertyDescriptor(base, property);
15513           if (desc.get) {
15514             return desc.get.call(arguments.length < 3 ? target : receiver);
15515           }
15516           return desc.value;
15517         };
15518       }
15519       return _get.apply(this, arguments);
15520     }
15521     var Emitter = /* @__PURE__ */ function() {
15522       function Emitter2() {
15523         _classCallCheck(this, Emitter2);
15524         Object.defineProperty(this, "listeners", {
15525           value: {},
15526           writable: true,
15527           configurable: true
15528         });
15529       }
15530       _createClass(Emitter2, [{
15531         key: "addEventListener",
15532         value: function addEventListener(type2, callback, options2) {
15533           if (!(type2 in this.listeners)) {
15534             this.listeners[type2] = [];
15535           }
15536           this.listeners[type2].push({
15537             callback,
15538             options: options2
15539           });
15540         }
15541       }, {
15542         key: "removeEventListener",
15543         value: function removeEventListener(type2, callback) {
15544           if (!(type2 in this.listeners)) {
15545             return;
15546           }
15547           var stack = this.listeners[type2];
15548           for (var i3 = 0, l2 = stack.length; i3 < l2; i3++) {
15549             if (stack[i3].callback === callback) {
15550               stack.splice(i3, 1);
15551               return;
15552             }
15553           }
15554         }
15555       }, {
15556         key: "dispatchEvent",
15557         value: function dispatchEvent2(event) {
15558           if (!(event.type in this.listeners)) {
15559             return;
15560           }
15561           var stack = this.listeners[event.type];
15562           var stackToCall = stack.slice();
15563           for (var i3 = 0, l2 = stackToCall.length; i3 < l2; i3++) {
15564             var listener = stackToCall[i3];
15565             try {
15566               listener.callback.call(this, event);
15567             } catch (e3) {
15568               Promise.resolve().then(function() {
15569                 throw e3;
15570               });
15571             }
15572             if (listener.options && listener.options.once) {
15573               this.removeEventListener(event.type, listener.callback);
15574             }
15575           }
15576           return !event.defaultPrevented;
15577         }
15578       }]);
15579       return Emitter2;
15580     }();
15581     var AbortSignal = /* @__PURE__ */ function(_Emitter) {
15582       _inherits(AbortSignal2, _Emitter);
15583       var _super = _createSuper(AbortSignal2);
15584       function AbortSignal2() {
15585         var _this;
15586         _classCallCheck(this, AbortSignal2);
15587         _this = _super.call(this);
15588         if (!_this.listeners) {
15589           Emitter.call(_assertThisInitialized(_this));
15590         }
15591         Object.defineProperty(_assertThisInitialized(_this), "aborted", {
15592           value: false,
15593           writable: true,
15594           configurable: true
15595         });
15596         Object.defineProperty(_assertThisInitialized(_this), "onabort", {
15597           value: null,
15598           writable: true,
15599           configurable: true
15600         });
15601         Object.defineProperty(_assertThisInitialized(_this), "reason", {
15602           value: void 0,
15603           writable: true,
15604           configurable: true
15605         });
15606         return _this;
15607       }
15608       _createClass(AbortSignal2, [{
15609         key: "toString",
15610         value: function toString2() {
15611           return "[object AbortSignal]";
15612         }
15613       }, {
15614         key: "dispatchEvent",
15615         value: function dispatchEvent2(event) {
15616           if (event.type === "abort") {
15617             this.aborted = true;
15618             if (typeof this.onabort === "function") {
15619               this.onabort.call(this, event);
15620             }
15621           }
15622           _get(_getPrototypeOf(AbortSignal2.prototype), "dispatchEvent", this).call(this, event);
15623         }
15624       }]);
15625       return AbortSignal2;
15626     }(Emitter);
15627     var AbortController2 = /* @__PURE__ */ function() {
15628       function AbortController3() {
15629         _classCallCheck(this, AbortController3);
15630         Object.defineProperty(this, "signal", {
15631           value: new AbortSignal(),
15632           writable: true,
15633           configurable: true
15634         });
15635       }
15636       _createClass(AbortController3, [{
15637         key: "abort",
15638         value: function abort(reason) {
15639           var event;
15640           try {
15641             event = new Event("abort");
15642           } catch (e3) {
15643             if (typeof document !== "undefined") {
15644               if (!document.createEvent) {
15645                 event = document.createEventObject();
15646                 event.type = "abort";
15647               } else {
15648                 event = document.createEvent("Event");
15649                 event.initEvent("abort", false, false);
15650               }
15651             } else {
15652               event = {
15653                 type: "abort",
15654                 bubbles: false,
15655                 cancelable: false
15656               };
15657             }
15658           }
15659           var signalReason = reason;
15660           if (signalReason === void 0) {
15661             if (typeof document === "undefined") {
15662               signalReason = new Error("This operation was aborted");
15663               signalReason.name = "AbortError";
15664             } else {
15665               try {
15666                 signalReason = new DOMException("signal is aborted without reason");
15667               } catch (err) {
15668                 signalReason = new Error("This operation was aborted");
15669                 signalReason.name = "AbortError";
15670               }
15671             }
15672           }
15673           this.signal.reason = signalReason;
15674           this.signal.dispatchEvent(event);
15675         }
15676       }, {
15677         key: "toString",
15678         value: function toString2() {
15679           return "[object AbortController]";
15680         }
15681       }]);
15682       return AbortController3;
15683     }();
15684     if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
15685       AbortController2.prototype[Symbol.toStringTag] = "AbortController";
15686       AbortSignal.prototype[Symbol.toStringTag] = "AbortSignal";
15687     }
15688     function polyfillNeeded(self2) {
15689       if (self2.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
15690         console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill");
15691         return true;
15692       }
15693       return typeof self2.Request === "function" && !self2.Request.prototype.hasOwnProperty("signal") || !self2.AbortController;
15694     }
15695     function abortableFetchDecorator(patchTargets) {
15696       if ("function" === typeof patchTargets) {
15697         patchTargets = {
15698           fetch: patchTargets
15699         };
15700       }
15701       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;
15702       if (!polyfillNeeded({
15703         fetch: fetch3,
15704         Request: NativeRequest,
15705         AbortController: NativeAbortController,
15706         __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL
15707       })) {
15708         return {
15709           fetch: fetch3,
15710           Request: Request2
15711         };
15712       }
15713       var Request2 = NativeRequest;
15714       if (Request2 && !Request2.prototype.hasOwnProperty("signal") || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
15715         Request2 = function Request3(input, init2) {
15716           var signal;
15717           if (init2 && init2.signal) {
15718             signal = init2.signal;
15719             delete init2.signal;
15720           }
15721           var request3 = new NativeRequest(input, init2);
15722           if (signal) {
15723             Object.defineProperty(request3, "signal", {
15724               writable: false,
15725               enumerable: false,
15726               configurable: true,
15727               value: signal
15728             });
15729           }
15730           return request3;
15731         };
15732         Request2.prototype = NativeRequest.prototype;
15733       }
15734       var realFetch = fetch3;
15735       var abortableFetch = function abortableFetch2(input, init2) {
15736         var signal = Request2 && Request2.prototype.isPrototypeOf(input) ? input.signal : init2 ? init2.signal : void 0;
15737         if (signal) {
15738           var abortError;
15739           try {
15740             abortError = new DOMException("Aborted", "AbortError");
15741           } catch (err) {
15742             abortError = new Error("Aborted");
15743             abortError.name = "AbortError";
15744           }
15745           if (signal.aborted) {
15746             return Promise.reject(abortError);
15747           }
15748           var cancellation = new Promise(function(_2, reject) {
15749             signal.addEventListener("abort", function() {
15750               return reject(abortError);
15751             }, {
15752               once: true
15753             });
15754           });
15755           if (init2 && init2.signal) {
15756             delete init2.signal;
15757           }
15758           return Promise.race([cancellation, realFetch(input, init2)]);
15759         }
15760         return realFetch(input, init2);
15761       };
15762       return {
15763         fetch: abortableFetch,
15764         Request: Request2
15765       };
15766     }
15767     (function(self2) {
15768       if (!polyfillNeeded(self2)) {
15769         return;
15770       }
15771       if (!self2.fetch) {
15772         console.warn("fetch() is not available, cannot install abortcontroller-polyfill");
15773         return;
15774       }
15775       var _abortableFetch = abortableFetchDecorator(self2), fetch3 = _abortableFetch.fetch, Request2 = _abortableFetch.Request;
15776       self2.fetch = fetch3;
15777       self2.Request = Request2;
15778       Object.defineProperty(self2, "AbortController", {
15779         writable: true,
15780         enumerable: false,
15781         configurable: true,
15782         value: AbortController2
15783       });
15784       Object.defineProperty(self2, "AbortSignal", {
15785         writable: true,
15786         enumerable: false,
15787         configurable: true,
15788         value: AbortSignal
15789       });
15790     })(typeof self !== "undefined" ? self : global);
15791   });
15792
15793   // modules/index.js
15794   var modules_exports = {};
15795   __export(modules_exports, {
15796     LocationManager: () => LocationManager,
15797     QAItem: () => QAItem,
15798     actionAddEntity: () => actionAddEntity,
15799     actionAddMember: () => actionAddMember,
15800     actionAddMidpoint: () => actionAddMidpoint,
15801     actionAddVertex: () => actionAddVertex,
15802     actionChangeMember: () => actionChangeMember,
15803     actionChangePreset: () => actionChangePreset,
15804     actionChangeTags: () => actionChangeTags,
15805     actionCircularize: () => actionCircularize,
15806     actionConnect: () => actionConnect,
15807     actionCopyEntities: () => actionCopyEntities,
15808     actionDeleteMember: () => actionDeleteMember,
15809     actionDeleteMultiple: () => actionDeleteMultiple,
15810     actionDeleteNode: () => actionDeleteNode,
15811     actionDeleteRelation: () => actionDeleteRelation,
15812     actionDeleteWay: () => actionDeleteWay,
15813     actionDiscardTags: () => actionDiscardTags,
15814     actionDisconnect: () => actionDisconnect,
15815     actionExtract: () => actionExtract,
15816     actionJoin: () => actionJoin,
15817     actionMerge: () => actionMerge,
15818     actionMergeNodes: () => actionMergeNodes,
15819     actionMergePolygon: () => actionMergePolygon,
15820     actionMergeRemoteChanges: () => actionMergeRemoteChanges,
15821     actionMove: () => actionMove,
15822     actionMoveMember: () => actionMoveMember,
15823     actionMoveNode: () => actionMoveNode,
15824     actionNoop: () => actionNoop,
15825     actionOrthogonalize: () => actionOrthogonalize,
15826     actionReflect: () => actionReflect,
15827     actionRestrictTurn: () => actionRestrictTurn,
15828     actionReverse: () => actionReverse,
15829     actionRevert: () => actionRevert,
15830     actionRotate: () => actionRotate,
15831     actionScale: () => actionScale,
15832     actionSplit: () => actionSplit,
15833     actionStraightenNodes: () => actionStraightenNodes,
15834     actionStraightenWay: () => actionStraightenWay,
15835     actionUnrestrictTurn: () => actionUnrestrictTurn,
15836     actionUpgradeTags: () => actionUpgradeTags,
15837     behaviorAddWay: () => behaviorAddWay,
15838     behaviorBreathe: () => behaviorBreathe,
15839     behaviorDrag: () => behaviorDrag,
15840     behaviorDraw: () => behaviorDraw,
15841     behaviorDrawWay: () => behaviorDrawWay,
15842     behaviorEdit: () => behaviorEdit,
15843     behaviorHash: () => behaviorHash,
15844     behaviorHover: () => behaviorHover,
15845     behaviorLasso: () => behaviorLasso,
15846     behaviorOperation: () => behaviorOperation,
15847     behaviorPaste: () => behaviorPaste,
15848     behaviorSelect: () => behaviorSelect,
15849     coreContext: () => coreContext,
15850     coreDifference: () => coreDifference,
15851     coreFileFetcher: () => coreFileFetcher,
15852     coreGraph: () => coreGraph,
15853     coreHistory: () => coreHistory,
15854     coreLocalizer: () => coreLocalizer,
15855     coreTree: () => coreTree,
15856     coreUploader: () => coreUploader,
15857     coreValidator: () => coreValidator,
15858     d3: () => d3,
15859     debug: () => debug,
15860     fileFetcher: () => _mainFileFetcher,
15861     geoAngle: () => geoAngle,
15862     geoChooseEdge: () => geoChooseEdge,
15863     geoEdgeEqual: () => geoEdgeEqual,
15864     geoExtent: () => geoExtent,
15865     geoGetSmallestSurroundingRectangle: () => geoGetSmallestSurroundingRectangle,
15866     geoHasLineIntersections: () => geoHasLineIntersections,
15867     geoHasSelfIntersections: () => geoHasSelfIntersections,
15868     geoLatToMeters: () => geoLatToMeters,
15869     geoLineIntersection: () => geoLineIntersection,
15870     geoLonToMeters: () => geoLonToMeters,
15871     geoMetersToLat: () => geoMetersToLat,
15872     geoMetersToLon: () => geoMetersToLon,
15873     geoMetersToOffset: () => geoMetersToOffset,
15874     geoOffsetToMeters: () => geoOffsetToMeters,
15875     geoOrthoCalcScore: () => geoOrthoCalcScore,
15876     geoOrthoCanOrthogonalize: () => geoOrthoCanOrthogonalize,
15877     geoOrthoMaxOffsetAngle: () => geoOrthoMaxOffsetAngle,
15878     geoOrthoNormalizedDotProduct: () => geoOrthoNormalizedDotProduct,
15879     geoPathHasIntersections: () => geoPathHasIntersections,
15880     geoPathIntersections: () => geoPathIntersections,
15881     geoPathLength: () => geoPathLength,
15882     geoPointInPolygon: () => geoPointInPolygon,
15883     geoPolygonContainsPolygon: () => geoPolygonContainsPolygon,
15884     geoPolygonIntersectsPolygon: () => geoPolygonIntersectsPolygon,
15885     geoRawMercator: () => geoRawMercator,
15886     geoRotate: () => geoRotate,
15887     geoScaleToZoom: () => geoScaleToZoom,
15888     geoSphericalClosestNode: () => geoSphericalClosestNode,
15889     geoSphericalDistance: () => geoSphericalDistance,
15890     geoVecAdd: () => geoVecAdd,
15891     geoVecAngle: () => geoVecAngle,
15892     geoVecCross: () => geoVecCross,
15893     geoVecDot: () => geoVecDot,
15894     geoVecEqual: () => geoVecEqual,
15895     geoVecFloor: () => geoVecFloor,
15896     geoVecInterp: () => geoVecInterp,
15897     geoVecLength: () => geoVecLength,
15898     geoVecLengthSquare: () => geoVecLengthSquare,
15899     geoVecNormalize: () => geoVecNormalize,
15900     geoVecNormalizedDot: () => geoVecNormalizedDot,
15901     geoVecProject: () => geoVecProject,
15902     geoVecScale: () => geoVecScale,
15903     geoVecSubtract: () => geoVecSubtract,
15904     geoViewportEdge: () => geoViewportEdge,
15905     geoZoomToScale: () => geoZoomToScale,
15906     likelyRawNumberFormat: () => likelyRawNumberFormat,
15907     localizer: () => _mainLocalizer,
15908     locationManager: () => _sharedLocationManager,
15909     modeAddArea: () => modeAddArea,
15910     modeAddLine: () => modeAddLine,
15911     modeAddNote: () => modeAddNote,
15912     modeAddPoint: () => modeAddPoint,
15913     modeBrowse: () => modeBrowse,
15914     modeDragNode: () => modeDragNode,
15915     modeDragNote: () => modeDragNote,
15916     modeDrawArea: () => modeDrawArea,
15917     modeDrawLine: () => modeDrawLine,
15918     modeMove: () => modeMove,
15919     modeRotate: () => modeRotate,
15920     modeSave: () => modeSave,
15921     modeSelect: () => modeSelect,
15922     modeSelectData: () => modeSelectData,
15923     modeSelectError: () => modeSelectError,
15924     modeSelectNote: () => modeSelectNote,
15925     operationCircularize: () => operationCircularize,
15926     operationContinue: () => operationContinue,
15927     operationCopy: () => operationCopy,
15928     operationDelete: () => operationDelete,
15929     operationDisconnect: () => operationDisconnect,
15930     operationDowngrade: () => operationDowngrade,
15931     operationExtract: () => operationExtract,
15932     operationMerge: () => operationMerge,
15933     operationMove: () => operationMove,
15934     operationOrthogonalize: () => operationOrthogonalize,
15935     operationPaste: () => operationPaste,
15936     operationReflectLong: () => operationReflectLong,
15937     operationReflectShort: () => operationReflectShort,
15938     operationReverse: () => operationReverse,
15939     operationRotate: () => operationRotate,
15940     operationSplit: () => operationSplit,
15941     operationStraighten: () => operationStraighten,
15942     osmAreaKeys: () => osmAreaKeys,
15943     osmChangeset: () => osmChangeset,
15944     osmEntity: () => osmEntity,
15945     osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
15946     osmInferRestriction: () => osmInferRestriction,
15947     osmIntersection: () => osmIntersection,
15948     osmIsInterestingTag: () => osmIsInterestingTag,
15949     osmIsOldMultipolygonOuterMember: () => osmIsOldMultipolygonOuterMember,
15950     osmJoinWays: () => osmJoinWays,
15951     osmLanes: () => osmLanes,
15952     osmLifecyclePrefixes: () => osmLifecyclePrefixes,
15953     osmNode: () => osmNode,
15954     osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
15955     osmNote: () => osmNote,
15956     osmOldMultipolygonOuterMember: () => osmOldMultipolygonOuterMember,
15957     osmOldMultipolygonOuterMemberOfRelation: () => osmOldMultipolygonOuterMemberOfRelation,
15958     osmOneWayTags: () => osmOneWayTags,
15959     osmPavedTags: () => osmPavedTags,
15960     osmPointTags: () => osmPointTags,
15961     osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
15962     osmRelation: () => osmRelation,
15963     osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
15964     osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
15965     osmSetAreaKeys: () => osmSetAreaKeys,
15966     osmSetPointTags: () => osmSetPointTags,
15967     osmSetVertexTags: () => osmSetVertexTags,
15968     osmTagSuggestingArea: () => osmTagSuggestingArea,
15969     osmTurn: () => osmTurn,
15970     osmVertexTags: () => osmVertexTags,
15971     osmWay: () => osmWay,
15972     prefs: () => corePreferences,
15973     presetCategory: () => presetCategory,
15974     presetCollection: () => presetCollection,
15975     presetField: () => presetField,
15976     presetIndex: () => presetIndex,
15977     presetManager: () => _mainPresetIndex,
15978     presetPreset: () => presetPreset,
15979     rendererBackground: () => rendererBackground,
15980     rendererBackgroundSource: () => rendererBackgroundSource,
15981     rendererFeatures: () => rendererFeatures,
15982     rendererMap: () => rendererMap,
15983     rendererPhotos: () => rendererPhotos,
15984     rendererTileLayer: () => rendererTileLayer,
15985     serviceImproveOSM: () => improveOSM_default,
15986     serviceKartaview: () => kartaview_default,
15987     serviceKeepRight: () => keepRight_default,
15988     serviceMapRules: () => maprules_default,
15989     serviceMapilio: () => mapilio_default,
15990     serviceMapillary: () => mapillary_default,
15991     serviceNominatim: () => nominatim_default,
15992     serviceNsi: () => nsi_default,
15993     serviceOsm: () => osm_default,
15994     serviceOsmWikibase: () => osm_wikibase_default,
15995     serviceOsmose: () => osmose_default,
15996     serviceStreetside: () => streetside_default,
15997     serviceTaginfo: () => taginfo_default,
15998     serviceVectorTile: () => vector_tile_default,
15999     serviceVegbilder: () => vegbilder_default,
16000     serviceWikidata: () => wikidata_default,
16001     serviceWikipedia: () => wikipedia_default,
16002     services: () => services,
16003     svgAreas: () => svgAreas,
16004     svgData: () => svgData,
16005     svgDebug: () => svgDebug,
16006     svgDefs: () => svgDefs,
16007     svgGeolocate: () => svgGeolocate,
16008     svgIcon: () => svgIcon,
16009     svgKartaviewImages: () => svgKartaviewImages,
16010     svgKeepRight: () => svgKeepRight,
16011     svgLabels: () => svgLabels,
16012     svgLayers: () => svgLayers,
16013     svgLines: () => svgLines,
16014     svgMapilioImages: () => svgMapilioImages,
16015     svgMapillaryImages: () => svgMapillaryImages,
16016     svgMapillarySigns: () => svgMapillarySigns,
16017     svgMarkerSegments: () => svgMarkerSegments,
16018     svgMidpoints: () => svgMidpoints,
16019     svgNotes: () => svgNotes,
16020     svgOsm: () => svgOsm,
16021     svgPassiveVertex: () => svgPassiveVertex,
16022     svgPath: () => svgPath,
16023     svgPointTransform: () => svgPointTransform,
16024     svgPoints: () => svgPoints,
16025     svgRelationMemberTags: () => svgRelationMemberTags,
16026     svgSegmentWay: () => svgSegmentWay,
16027     svgStreetside: () => svgStreetside,
16028     svgTagClasses: () => svgTagClasses,
16029     svgTagPattern: () => svgTagPattern,
16030     svgTouch: () => svgTouch,
16031     svgTurns: () => svgTurns,
16032     svgVegbilder: () => svgVegbilder,
16033     svgVertices: () => svgVertices,
16034     t: () => _t,
16035     uiAccount: () => uiAccount,
16036     uiAttribution: () => uiAttribution,
16037     uiChangesetEditor: () => uiChangesetEditor,
16038     uiCmd: () => uiCmd,
16039     uiCombobox: () => uiCombobox,
16040     uiCommit: () => uiCommit,
16041     uiCommitWarnings: () => uiCommitWarnings,
16042     uiConfirm: () => uiConfirm,
16043     uiConflicts: () => uiConflicts,
16044     uiContributors: () => uiContributors,
16045     uiCurtain: () => uiCurtain,
16046     uiDataEditor: () => uiDataEditor,
16047     uiDataHeader: () => uiDataHeader,
16048     uiDisclosure: () => uiDisclosure,
16049     uiEditMenu: () => uiEditMenu,
16050     uiEntityEditor: () => uiEntityEditor,
16051     uiFeatureInfo: () => uiFeatureInfo,
16052     uiFeatureList: () => uiFeatureList,
16053     uiField: () => uiField,
16054     uiFieldAccess: () => uiFieldAccess,
16055     uiFieldAddress: () => uiFieldAddress,
16056     uiFieldCheck: () => uiFieldCheck,
16057     uiFieldColour: () => uiFieldText,
16058     uiFieldCombo: () => uiFieldCombo,
16059     uiFieldDefaultCheck: () => uiFieldCheck,
16060     uiFieldDirectionalCombo: () => uiFieldDirectionalCombo,
16061     uiFieldEmail: () => uiFieldText,
16062     uiFieldHelp: () => uiFieldHelp,
16063     uiFieldIdentifier: () => uiFieldText,
16064     uiFieldLanes: () => uiFieldLanes,
16065     uiFieldLocalized: () => uiFieldLocalized,
16066     uiFieldManyCombo: () => uiFieldCombo,
16067     uiFieldMultiCombo: () => uiFieldCombo,
16068     uiFieldNetworkCombo: () => uiFieldCombo,
16069     uiFieldNumber: () => uiFieldText,
16070     uiFieldOnewayCheck: () => uiFieldCheck,
16071     uiFieldRadio: () => uiFieldRadio,
16072     uiFieldRestrictions: () => uiFieldRestrictions,
16073     uiFieldRoadheight: () => uiFieldRoadheight,
16074     uiFieldRoadspeed: () => uiFieldRoadspeed,
16075     uiFieldSemiCombo: () => uiFieldCombo,
16076     uiFieldStructureRadio: () => uiFieldRadio,
16077     uiFieldTel: () => uiFieldText,
16078     uiFieldText: () => uiFieldText,
16079     uiFieldTextarea: () => uiFieldTextarea,
16080     uiFieldTypeCombo: () => uiFieldCombo,
16081     uiFieldUrl: () => uiFieldText,
16082     uiFieldWikidata: () => uiFieldWikidata,
16083     uiFieldWikipedia: () => uiFieldWikipedia,
16084     uiFields: () => uiFields,
16085     uiFlash: () => uiFlash,
16086     uiFormFields: () => uiFormFields,
16087     uiFullScreen: () => uiFullScreen,
16088     uiGeolocate: () => uiGeolocate,
16089     uiImproveOsmComments: () => uiImproveOsmComments,
16090     uiImproveOsmDetails: () => uiImproveOsmDetails,
16091     uiImproveOsmEditor: () => uiImproveOsmEditor,
16092     uiImproveOsmHeader: () => uiImproveOsmHeader,
16093     uiInfo: () => uiInfo,
16094     uiInfoPanels: () => uiInfoPanels,
16095     uiInit: () => uiInit,
16096     uiInspector: () => uiInspector,
16097     uiIntro: () => uiIntro,
16098     uiIssuesInfo: () => uiIssuesInfo,
16099     uiKeepRightDetails: () => uiKeepRightDetails,
16100     uiKeepRightEditor: () => uiKeepRightEditor,
16101     uiKeepRightHeader: () => uiKeepRightHeader,
16102     uiLasso: () => uiLasso,
16103     uiLengthIndicator: () => uiLengthIndicator,
16104     uiLoading: () => uiLoading,
16105     uiMapInMap: () => uiMapInMap,
16106     uiModal: () => uiModal,
16107     uiNoteComments: () => uiNoteComments,
16108     uiNoteEditor: () => uiNoteEditor,
16109     uiNoteHeader: () => uiNoteHeader,
16110     uiNoteReport: () => uiNoteReport,
16111     uiNotice: () => uiNotice,
16112     uiPaneBackground: () => uiPaneBackground,
16113     uiPaneHelp: () => uiPaneHelp,
16114     uiPaneIssues: () => uiPaneIssues,
16115     uiPaneMapData: () => uiPaneMapData,
16116     uiPanePreferences: () => uiPanePreferences,
16117     uiPanelBackground: () => uiPanelBackground,
16118     uiPanelHistory: () => uiPanelHistory,
16119     uiPanelLocation: () => uiPanelLocation,
16120     uiPanelMeasurement: () => uiPanelMeasurement,
16121     uiPopover: () => uiPopover,
16122     uiPresetIcon: () => uiPresetIcon,
16123     uiPresetList: () => uiPresetList,
16124     uiRestore: () => uiRestore,
16125     uiScale: () => uiScale,
16126     uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
16127     uiSectionBackgroundList: () => uiSectionBackgroundList,
16128     uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
16129     uiSectionChanges: () => uiSectionChanges,
16130     uiSectionDataLayers: () => uiSectionDataLayers,
16131     uiSectionEntityIssues: () => uiSectionEntityIssues,
16132     uiSectionFeatureType: () => uiSectionFeatureType,
16133     uiSectionMapFeatures: () => uiSectionMapFeatures,
16134     uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
16135     uiSectionOverlayList: () => uiSectionOverlayList,
16136     uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
16137     uiSectionPresetFields: () => uiSectionPresetFields,
16138     uiSectionPrivacy: () => uiSectionPrivacy,
16139     uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
16140     uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
16141     uiSectionRawTagEditor: () => uiSectionRawTagEditor,
16142     uiSectionSelectionList: () => uiSectionSelectionList,
16143     uiSectionValidationIssues: () => uiSectionValidationIssues,
16144     uiSectionValidationOptions: () => uiSectionValidationOptions,
16145     uiSectionValidationRules: () => uiSectionValidationRules,
16146     uiSectionValidationStatus: () => uiSectionValidationStatus,
16147     uiSettingsCustomBackground: () => uiSettingsCustomBackground,
16148     uiSettingsCustomData: () => uiSettingsCustomData,
16149     uiSidebar: () => uiSidebar,
16150     uiSourceSwitch: () => uiSourceSwitch,
16151     uiSpinner: () => uiSpinner,
16152     uiSplash: () => uiSplash,
16153     uiStatus: () => uiStatus,
16154     uiSuccess: () => uiSuccess,
16155     uiTagReference: () => uiTagReference,
16156     uiToggle: () => uiToggle,
16157     uiTooltip: () => uiTooltip,
16158     uiVersion: () => uiVersion,
16159     uiViewOnKeepRight: () => uiViewOnKeepRight,
16160     uiViewOnOSM: () => uiViewOnOSM,
16161     uiZoom: () => uiZoom,
16162     utilAesDecrypt: () => utilAesDecrypt,
16163     utilAesEncrypt: () => utilAesEncrypt,
16164     utilArrayChunk: () => utilArrayChunk,
16165     utilArrayDifference: () => utilArrayDifference,
16166     utilArrayFlatten: () => utilArrayFlatten,
16167     utilArrayGroupBy: () => utilArrayGroupBy,
16168     utilArrayIdentical: () => utilArrayIdentical,
16169     utilArrayIntersection: () => utilArrayIntersection,
16170     utilArrayUnion: () => utilArrayUnion,
16171     utilArrayUniq: () => utilArrayUniq,
16172     utilArrayUniqBy: () => utilArrayUniqBy,
16173     utilAsyncMap: () => utilAsyncMap,
16174     utilCleanOsmString: () => utilCleanOsmString,
16175     utilCleanTags: () => utilCleanTags,
16176     utilCombinedTags: () => utilCombinedTags,
16177     utilCompareIDs: () => utilCompareIDs,
16178     utilDeepMemberSelector: () => utilDeepMemberSelector,
16179     utilDetect: () => utilDetect,
16180     utilDisplayLabel: () => utilDisplayLabel,
16181     utilDisplayName: () => utilDisplayName,
16182     utilDisplayNameForPath: () => utilDisplayNameForPath,
16183     utilDisplayType: () => utilDisplayType,
16184     utilEditDistance: () => utilEditDistance,
16185     utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
16186     utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
16187     utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
16188     utilEntityRoot: () => utilEntityRoot,
16189     utilEntitySelector: () => utilEntitySelector,
16190     utilFastMouse: () => utilFastMouse,
16191     utilFunctor: () => utilFunctor,
16192     utilGetAllNodes: () => utilGetAllNodes,
16193     utilGetSetValue: () => utilGetSetValue,
16194     utilHashcode: () => utilHashcode,
16195     utilHighlightEntities: () => utilHighlightEntities,
16196     utilKeybinding: () => utilKeybinding,
16197     utilNoAuto: () => utilNoAuto,
16198     utilObjectOmit: () => utilObjectOmit,
16199     utilOldestID: () => utilOldestID,
16200     utilPrefixCSSProperty: () => utilPrefixCSSProperty,
16201     utilPrefixDOMProperty: () => utilPrefixDOMProperty,
16202     utilQsString: () => utilQsString,
16203     utilRebind: () => utilRebind,
16204     utilSafeClassName: () => utilSafeClassName,
16205     utilSessionMutex: () => utilSessionMutex,
16206     utilSetTransform: () => utilSetTransform,
16207     utilStringQs: () => utilStringQs,
16208     utilTagDiff: () => utilTagDiff,
16209     utilTagText: () => utilTagText,
16210     utilTiler: () => utilTiler,
16211     utilTotalExtent: () => utilTotalExtent,
16212     utilTriggerEvent: () => utilTriggerEvent,
16213     utilUnicodeCharsCount: () => utilUnicodeCharsCount,
16214     utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
16215     utilUniqueDomId: () => utilUniqueDomId,
16216     utilWrap: () => utilWrap,
16217     validationAlmostJunction: () => validationAlmostJunction,
16218     validationCloseNodes: () => validationCloseNodes,
16219     validationCrossingWays: () => validationCrossingWays,
16220     validationDisconnectedWay: () => validationDisconnectedWay,
16221     validationFormatting: () => validationFormatting,
16222     validationHelpRequest: () => validationHelpRequest,
16223     validationImpossibleOneway: () => validationImpossibleOneway,
16224     validationIncompatibleSource: () => validationIncompatibleSource,
16225     validationMaprules: () => validationMaprules,
16226     validationMismatchedGeometry: () => validationMismatchedGeometry,
16227     validationMissingRole: () => validationMissingRole,
16228     validationMissingTag: () => validationMissingTag,
16229     validationOutdatedTags: () => validationOutdatedTags,
16230     validationPrivateData: () => validationPrivateData,
16231     validationSuspiciousName: () => validationSuspiciousName,
16232     validationUnsquareWay: () => validationUnsquareWay
16233   });
16234
16235   // modules/actions/add_entity.js
16236   function actionAddEntity(way) {
16237     return function(graph) {
16238       return graph.replace(way);
16239     };
16240   }
16241
16242   // modules/actions/reverse.js
16243   function actionReverse(entityID, options2) {
16244     var ignoreKey = /^.*(_|:)?(description|name|note|website|ref|source|comment|watch|attribution)(_|:)?/;
16245     var numeric = /^([+\-]?)(?=[\d.])/;
16246     var directionKey = /direction$/;
16247     var turn_lanes = /^turn:lanes:?/;
16248     var keyReplacements = [
16249       [/:right$/, ":left"],
16250       [/:left$/, ":right"],
16251       [/:forward$/, ":backward"],
16252       [/:backward$/, ":forward"],
16253       [/:right:/, ":left:"],
16254       [/:left:/, ":right:"],
16255       [/:forward:/, ":backward:"],
16256       [/:backward:/, ":forward:"]
16257     ];
16258     var valueReplacements = {
16259       left: "right",
16260       right: "left",
16261       up: "down",
16262       down: "up",
16263       forward: "backward",
16264       backward: "forward",
16265       forwards: "backward",
16266       backwards: "forward"
16267     };
16268     var roleReplacements = {
16269       forward: "backward",
16270       backward: "forward",
16271       forwards: "backward",
16272       backwards: "forward"
16273     };
16274     var onewayReplacements = {
16275       yes: "-1",
16276       "1": "-1",
16277       "-1": "yes"
16278     };
16279     var compassReplacements = {
16280       N: "S",
16281       NNE: "SSW",
16282       NE: "SW",
16283       ENE: "WSW",
16284       E: "W",
16285       ESE: "WNW",
16286       SE: "NW",
16287       SSE: "NNW",
16288       S: "N",
16289       SSW: "NNE",
16290       SW: "NE",
16291       WSW: "ENE",
16292       W: "E",
16293       WNW: "ESE",
16294       NW: "SE",
16295       NNW: "SSE"
16296     };
16297     function reverseKey(key) {
16298       for (var i3 = 0; i3 < keyReplacements.length; ++i3) {
16299         var replacement = keyReplacements[i3];
16300         if (replacement[0].test(key)) {
16301           return key.replace(replacement[0], replacement[1]);
16302         }
16303       }
16304       return key;
16305     }
16306     function reverseValue(key, value, includeAbsolute) {
16307       if (ignoreKey.test(key))
16308         return value;
16309       if (turn_lanes.test(key)) {
16310         return value;
16311       } else if (key === "incline" && numeric.test(value)) {
16312         return value.replace(numeric, function(_2, sign2) {
16313           return sign2 === "-" ? "" : "-";
16314         });
16315       } else if (options2 && options2.reverseOneway && key === "oneway") {
16316         return onewayReplacements[value] || value;
16317       } else if (includeAbsolute && directionKey.test(key)) {
16318         return value.split(";").map((value2) => {
16319           if (compassReplacements[value2])
16320             return compassReplacements[value2];
16321           var degrees3 = Number(value2);
16322           if (isFinite(degrees3)) {
16323             if (degrees3 < 180) {
16324               degrees3 += 180;
16325             } else {
16326               degrees3 -= 180;
16327             }
16328             return degrees3.toString();
16329           } else {
16330             return valueReplacements[value2] || value2;
16331           }
16332         }).join(";");
16333       }
16334       return valueReplacements[value] || value;
16335     }
16336     function reverseNodeTags(graph, nodeIDs) {
16337       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
16338         var node = graph.hasEntity(nodeIDs[i3]);
16339         if (!node || !Object.keys(node.tags).length)
16340           continue;
16341         var tags = {};
16342         for (var key in node.tags) {
16343           tags[reverseKey(key)] = reverseValue(key, node.tags[key], node.id === entityID);
16344         }
16345         graph = graph.replace(node.update({ tags }));
16346       }
16347       return graph;
16348     }
16349     function reverseWay(graph, way) {
16350       var nodes = way.nodes.slice().reverse();
16351       var tags = {};
16352       var role;
16353       for (var key in way.tags) {
16354         tags[reverseKey(key)] = reverseValue(key, way.tags[key]);
16355       }
16356       graph.parentRelations(way).forEach(function(relation) {
16357         relation.members.forEach(function(member, index) {
16358           if (member.id === way.id && (role = roleReplacements[member.role])) {
16359             relation = relation.updateMember({ role }, index);
16360             graph = graph.replace(relation);
16361           }
16362         });
16363       });
16364       return reverseNodeTags(graph, nodes).replace(way.update({ nodes, tags }));
16365     }
16366     var action = function(graph) {
16367       var entity = graph.entity(entityID);
16368       if (entity.type === "way") {
16369         return reverseWay(graph, entity);
16370       }
16371       return reverseNodeTags(graph, [entityID]);
16372     };
16373     action.disabled = function(graph) {
16374       var entity = graph.hasEntity(entityID);
16375       if (!entity || entity.type === "way")
16376         return false;
16377       for (var key in entity.tags) {
16378         var value = entity.tags[key];
16379         if (reverseKey(key) !== key || reverseValue(key, value, true) !== value) {
16380           return false;
16381         }
16382       }
16383       return "nondirectional_node";
16384     };
16385     action.entityID = function() {
16386       return entityID;
16387     };
16388     return action;
16389   }
16390
16391   // modules/osm/tags.js
16392   function osmIsInterestingTag(key) {
16393     return key !== "attribution" && key !== "created_by" && key !== "source" && key !== "odbl" && key.indexOf("source:") !== 0 && key.indexOf("source_ref") !== 0 && // purposely exclude colon
16394     key.indexOf("tiger:") !== 0;
16395   }
16396   var osmLifecyclePrefixes = {
16397     // nonexistent, might be built
16398     proposed: true,
16399     planned: true,
16400     // under maintentance or between groundbreaking and opening
16401     construction: true,
16402     // existent but not functional
16403     disused: true,
16404     // dilapidated to nonexistent
16405     abandoned: true,
16406     was: true,
16407     // nonexistent, still may appear in imagery
16408     dismantled: true,
16409     razed: true,
16410     demolished: true,
16411     destroyed: true,
16412     removed: true,
16413     obliterated: true,
16414     // existent occasionally, e.g. stormwater drainage basin
16415     intermittent: true
16416   };
16417   function osmRemoveLifecyclePrefix(key) {
16418     const keySegments = key.split(":");
16419     if (keySegments.length === 1)
16420       return key;
16421     if (keySegments[0] in osmLifecyclePrefixes) {
16422       return key.slice(keySegments[0].length + 1);
16423     }
16424     return key;
16425   }
16426   var osmAreaKeys = {};
16427   function osmSetAreaKeys(value) {
16428     osmAreaKeys = value;
16429   }
16430   var osmAreaKeysExceptions = {
16431     highway: {
16432       elevator: true,
16433       rest_area: true,
16434       services: true
16435     },
16436     public_transport: {
16437       platform: true
16438     },
16439     railway: {
16440       platform: true,
16441       roundhouse: true,
16442       station: true,
16443       traverser: true,
16444       turntable: true,
16445       wash: true
16446     },
16447     traffic_calming: {
16448       island: true
16449     },
16450     waterway: {
16451       dam: true
16452     }
16453   };
16454   function osmTagSuggestingArea(tags) {
16455     if (tags.area === "yes")
16456       return { area: "yes" };
16457     if (tags.area === "no")
16458       return null;
16459     var returnTags = {};
16460     for (var realKey in tags) {
16461       const key = osmRemoveLifecyclePrefix(realKey);
16462       if (key in osmAreaKeys && !(tags[realKey] in osmAreaKeys[key])) {
16463         returnTags[realKey] = tags[realKey];
16464         return returnTags;
16465       }
16466       if (key in osmAreaKeysExceptions && tags[realKey] in osmAreaKeysExceptions[key]) {
16467         returnTags[realKey] = tags[realKey];
16468         return returnTags;
16469       }
16470     }
16471     return null;
16472   }
16473   var osmLineTags = {};
16474   function osmSetLineTags(value) {
16475     osmLineTags = value;
16476   }
16477   var osmPointTags = {};
16478   function osmSetPointTags(value) {
16479     osmPointTags = value;
16480   }
16481   var osmVertexTags = {};
16482   function osmSetVertexTags(value) {
16483     osmVertexTags = value;
16484   }
16485   function osmNodeGeometriesForTags(nodeTags) {
16486     var geometries = {};
16487     for (var key in nodeTags) {
16488       if (osmPointTags[key] && (osmPointTags[key]["*"] || osmPointTags[key][nodeTags[key]])) {
16489         geometries.point = true;
16490       }
16491       if (osmVertexTags[key] && (osmVertexTags[key]["*"] || osmVertexTags[key][nodeTags[key]])) {
16492         geometries.vertex = true;
16493       }
16494       if (geometries.point && geometries.vertex)
16495         break;
16496     }
16497     return geometries;
16498   }
16499   var osmOneWayTags = {
16500     "aerialway": {
16501       "chair_lift": true,
16502       "drag_lift": true,
16503       "j-bar": true,
16504       "magic_carpet": true,
16505       "mixed_lift": true,
16506       "platter": true,
16507       "rope_tow": true,
16508       "t-bar": true,
16509       "zip_line": true
16510     },
16511     "highway": {
16512       "motorway": true
16513     },
16514     "junction": {
16515       "circular": true,
16516       "roundabout": true
16517     },
16518     "man_made": {
16519       "goods_conveyor": true,
16520       "piste:halfpipe": true
16521     },
16522     "piste:type": {
16523       "downhill": true,
16524       "sled": true,
16525       "yes": true
16526     },
16527     "seamark:type": {
16528       "two-way_route": true,
16529       "recommended_traffic_lane": true,
16530       "separation_lane": true,
16531       "separation_roundabout": true
16532     },
16533     "waterway": {
16534       "canal": true,
16535       "ditch": true,
16536       "drain": true,
16537       "fish_pass": true,
16538       "pressurised": true,
16539       "river": true,
16540       "spillway": true,
16541       "stream": true,
16542       "tidal_channel": true
16543     }
16544   };
16545   var osmPavedTags = {
16546     "surface": {
16547       "paved": true,
16548       "asphalt": true,
16549       "concrete": true,
16550       "chipseal": true,
16551       "concrete:lanes": true,
16552       "concrete:plates": true
16553     },
16554     "tracktype": {
16555       "grade1": true
16556     }
16557   };
16558   var osmSemipavedTags = {
16559     "surface": {
16560       "cobblestone": true,
16561       "cobblestone:flattened": true,
16562       "unhewn_cobblestone": true,
16563       "sett": true,
16564       "paving_stones": true,
16565       "metal": true,
16566       "wood": true
16567     }
16568   };
16569   var osmRightSideIsInsideTags = {
16570     "natural": {
16571       "cliff": true,
16572       "coastline": "coastline"
16573     },
16574     "barrier": {
16575       "retaining_wall": true,
16576       "kerb": true,
16577       "guard_rail": true,
16578       "city_wall": true
16579     },
16580     "man_made": {
16581       "embankment": true,
16582       "quay": true
16583     },
16584     "waterway": {
16585       "weir": true
16586     }
16587   };
16588   var osmRoutableHighwayTagValues = {
16589     motorway: true,
16590     trunk: true,
16591     primary: true,
16592     secondary: true,
16593     tertiary: true,
16594     residential: true,
16595     motorway_link: true,
16596     trunk_link: true,
16597     primary_link: true,
16598     secondary_link: true,
16599     tertiary_link: true,
16600     unclassified: true,
16601     road: true,
16602     service: true,
16603     track: true,
16604     living_street: true,
16605     bus_guideway: true,
16606     path: true,
16607     footway: true,
16608     cycleway: true,
16609     bridleway: true,
16610     pedestrian: true,
16611     corridor: true,
16612     steps: true
16613   };
16614   var osmPathHighwayTagValues = {
16615     path: true,
16616     footway: true,
16617     cycleway: true,
16618     bridleway: true,
16619     pedestrian: true,
16620     corridor: true,
16621     steps: true
16622   };
16623   var osmRailwayTrackTagValues = {
16624     rail: true,
16625     light_rail: true,
16626     tram: true,
16627     subway: true,
16628     monorail: true,
16629     funicular: true,
16630     miniature: true,
16631     narrow_gauge: true,
16632     disused: true,
16633     preserved: true
16634   };
16635   var osmFlowingWaterwayTagValues = {
16636     canal: true,
16637     ditch: true,
16638     drain: true,
16639     fish_pass: true,
16640     river: true,
16641     stream: true,
16642     tidal_channel: true
16643   };
16644   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/;
16645
16646   // node_modules/d3-array/src/ascending.js
16647   function ascending(a2, b2) {
16648     return a2 == null || b2 == null ? NaN : a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 0 : NaN;
16649   }
16650
16651   // node_modules/d3-array/src/descending.js
16652   function descending(a2, b2) {
16653     return a2 == null || b2 == null ? NaN : b2 < a2 ? -1 : b2 > a2 ? 1 : b2 >= a2 ? 0 : NaN;
16654   }
16655
16656   // node_modules/d3-array/src/bisector.js
16657   function bisector(f3) {
16658     let compare1, compare2, delta;
16659     if (f3.length !== 2) {
16660       compare1 = ascending;
16661       compare2 = (d2, x2) => ascending(f3(d2), x2);
16662       delta = (d2, x2) => f3(d2) - x2;
16663     } else {
16664       compare1 = f3 === ascending || f3 === descending ? f3 : zero;
16665       compare2 = f3;
16666       delta = f3;
16667     }
16668     function left(a2, x2, lo = 0, hi = a2.length) {
16669       if (lo < hi) {
16670         if (compare1(x2, x2) !== 0)
16671           return hi;
16672         do {
16673           const mid = lo + hi >>> 1;
16674           if (compare2(a2[mid], x2) < 0)
16675             lo = mid + 1;
16676           else
16677             hi = mid;
16678         } while (lo < hi);
16679       }
16680       return lo;
16681     }
16682     function right(a2, x2, lo = 0, hi = a2.length) {
16683       if (lo < hi) {
16684         if (compare1(x2, x2) !== 0)
16685           return hi;
16686         do {
16687           const mid = lo + hi >>> 1;
16688           if (compare2(a2[mid], x2) <= 0)
16689             lo = mid + 1;
16690           else
16691             hi = mid;
16692         } while (lo < hi);
16693       }
16694       return lo;
16695     }
16696     function center(a2, x2, lo = 0, hi = a2.length) {
16697       const i3 = left(a2, x2, lo, hi - 1);
16698       return i3 > lo && delta(a2[i3 - 1], x2) > -delta(a2[i3], x2) ? i3 - 1 : i3;
16699     }
16700     return { left, center, right };
16701   }
16702   function zero() {
16703     return 0;
16704   }
16705
16706   // node_modules/d3-array/src/number.js
16707   function number(x2) {
16708     return x2 === null ? NaN : +x2;
16709   }
16710   function* numbers(values, valueof) {
16711     if (valueof === void 0) {
16712       for (let value of values) {
16713         if (value != null && (value = +value) >= value) {
16714           yield value;
16715         }
16716       }
16717     } else {
16718       let index = -1;
16719       for (let value of values) {
16720         if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
16721           yield value;
16722         }
16723       }
16724     }
16725   }
16726
16727   // node_modules/d3-array/src/bisect.js
16728   var ascendingBisect = bisector(ascending);
16729   var bisectRight = ascendingBisect.right;
16730   var bisectLeft = ascendingBisect.left;
16731   var bisectCenter = bisector(number).center;
16732   var bisect_default = bisectRight;
16733
16734   // node_modules/d3-array/src/fsum.js
16735   var Adder = class {
16736     constructor() {
16737       this._partials = new Float64Array(32);
16738       this._n = 0;
16739     }
16740     add(x2) {
16741       const p2 = this._partials;
16742       let i3 = 0;
16743       for (let j3 = 0; j3 < this._n && j3 < 32; j3++) {
16744         const y2 = p2[j3], hi = x2 + y2, lo = Math.abs(x2) < Math.abs(y2) ? x2 - (hi - y2) : y2 - (hi - x2);
16745         if (lo)
16746           p2[i3++] = lo;
16747         x2 = hi;
16748       }
16749       p2[i3] = x2;
16750       this._n = i3 + 1;
16751       return this;
16752     }
16753     valueOf() {
16754       const p2 = this._partials;
16755       let n3 = this._n, x2, y2, lo, hi = 0;
16756       if (n3 > 0) {
16757         hi = p2[--n3];
16758         while (n3 > 0) {
16759           x2 = hi;
16760           y2 = p2[--n3];
16761           hi = x2 + y2;
16762           lo = y2 - (hi - x2);
16763           if (lo)
16764             break;
16765         }
16766         if (n3 > 0 && (lo < 0 && p2[n3 - 1] < 0 || lo > 0 && p2[n3 - 1] > 0)) {
16767           y2 = lo * 2;
16768           x2 = hi + y2;
16769           if (y2 == x2 - hi)
16770             hi = x2;
16771         }
16772       }
16773       return hi;
16774     }
16775   };
16776
16777   // node_modules/d3-array/src/sort.js
16778   function compareDefined(compare = ascending) {
16779     if (compare === ascending)
16780       return ascendingDefined;
16781     if (typeof compare !== "function")
16782       throw new TypeError("compare is not a function");
16783     return (a2, b2) => {
16784       const x2 = compare(a2, b2);
16785       if (x2 || x2 === 0)
16786         return x2;
16787       return (compare(b2, b2) === 0) - (compare(a2, a2) === 0);
16788     };
16789   }
16790   function ascendingDefined(a2, b2) {
16791     return (a2 == null || !(a2 >= a2)) - (b2 == null || !(b2 >= b2)) || (a2 < b2 ? -1 : a2 > b2 ? 1 : 0);
16792   }
16793
16794   // node_modules/d3-array/src/ticks.js
16795   var e10 = Math.sqrt(50);
16796   var e5 = Math.sqrt(10);
16797   var e2 = Math.sqrt(2);
16798   function ticks(start2, stop, count) {
16799     var reverse, i3 = -1, n3, ticks2, step;
16800     stop = +stop, start2 = +start2, count = +count;
16801     if (start2 === stop && count > 0)
16802       return [start2];
16803     if (reverse = stop < start2)
16804       n3 = start2, start2 = stop, stop = n3;
16805     if ((step = tickIncrement(start2, stop, count)) === 0 || !isFinite(step))
16806       return [];
16807     if (step > 0) {
16808       let r0 = Math.round(start2 / step), r1 = Math.round(stop / step);
16809       if (r0 * step < start2)
16810         ++r0;
16811       if (r1 * step > stop)
16812         --r1;
16813       ticks2 = new Array(n3 = r1 - r0 + 1);
16814       while (++i3 < n3)
16815         ticks2[i3] = (r0 + i3) * step;
16816     } else {
16817       step = -step;
16818       let r0 = Math.round(start2 * step), r1 = Math.round(stop * step);
16819       if (r0 / step < start2)
16820         ++r0;
16821       if (r1 / step > stop)
16822         --r1;
16823       ticks2 = new Array(n3 = r1 - r0 + 1);
16824       while (++i3 < n3)
16825         ticks2[i3] = (r0 + i3) / step;
16826     }
16827     if (reverse)
16828       ticks2.reverse();
16829     return ticks2;
16830   }
16831   function tickIncrement(start2, stop, count) {
16832     var step = (stop - start2) / Math.max(0, count), power = Math.floor(Math.log(step) / Math.LN10), error = step / Math.pow(10, power);
16833     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);
16834   }
16835   function tickStep(start2, stop, count) {
16836     var step0 = Math.abs(stop - start2) / Math.max(0, count), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1;
16837     if (error >= e10)
16838       step1 *= 10;
16839     else if (error >= e5)
16840       step1 *= 5;
16841     else if (error >= e2)
16842       step1 *= 2;
16843     return stop < start2 ? -step1 : step1;
16844   }
16845
16846   // node_modules/d3-array/src/max.js
16847   function max(values, valueof) {
16848     let max3;
16849     if (valueof === void 0) {
16850       for (const value of values) {
16851         if (value != null && (max3 < value || max3 === void 0 && value >= value)) {
16852           max3 = value;
16853         }
16854       }
16855     } else {
16856       let index = -1;
16857       for (let value of values) {
16858         if ((value = valueof(value, ++index, values)) != null && (max3 < value || max3 === void 0 && value >= value)) {
16859           max3 = value;
16860         }
16861       }
16862     }
16863     return max3;
16864   }
16865
16866   // node_modules/d3-array/src/min.js
16867   function min(values, valueof) {
16868     let min3;
16869     if (valueof === void 0) {
16870       for (const value of values) {
16871         if (value != null && (min3 > value || min3 === void 0 && value >= value)) {
16872           min3 = value;
16873         }
16874       }
16875     } else {
16876       let index = -1;
16877       for (let value of values) {
16878         if ((value = valueof(value, ++index, values)) != null && (min3 > value || min3 === void 0 && value >= value)) {
16879           min3 = value;
16880         }
16881       }
16882     }
16883     return min3;
16884   }
16885
16886   // node_modules/d3-array/src/quickselect.js
16887   function quickselect(array2, k2, left = 0, right = array2.length - 1, compare) {
16888     compare = compare === void 0 ? ascendingDefined : compareDefined(compare);
16889     while (right > left) {
16890       if (right - left > 600) {
16891         const n3 = right - left + 1;
16892         const m2 = k2 - left + 1;
16893         const z2 = Math.log(n3);
16894         const s2 = 0.5 * Math.exp(2 * z2 / 3);
16895         const sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m2 - n3 / 2 < 0 ? -1 : 1);
16896         const newLeft = Math.max(left, Math.floor(k2 - m2 * s2 / n3 + sd));
16897         const newRight = Math.min(right, Math.floor(k2 + (n3 - m2) * s2 / n3 + sd));
16898         quickselect(array2, k2, newLeft, newRight, compare);
16899       }
16900       const t2 = array2[k2];
16901       let i3 = left;
16902       let j3 = right;
16903       swap(array2, left, k2);
16904       if (compare(array2[right], t2) > 0)
16905         swap(array2, left, right);
16906       while (i3 < j3) {
16907         swap(array2, i3, j3), ++i3, --j3;
16908         while (compare(array2[i3], t2) < 0)
16909           ++i3;
16910         while (compare(array2[j3], t2) > 0)
16911           --j3;
16912       }
16913       if (compare(array2[left], t2) === 0)
16914         swap(array2, left, j3);
16915       else
16916         ++j3, swap(array2, j3, right);
16917       if (j3 <= k2)
16918         left = j3 + 1;
16919       if (k2 <= j3)
16920         right = j3 - 1;
16921     }
16922     return array2;
16923   }
16924   function swap(array2, i3, j3) {
16925     const t2 = array2[i3];
16926     array2[i3] = array2[j3];
16927     array2[j3] = t2;
16928   }
16929
16930   // node_modules/d3-array/src/quantile.js
16931   function quantile(values, p2, valueof) {
16932     values = Float64Array.from(numbers(values, valueof));
16933     if (!(n3 = values.length))
16934       return;
16935     if ((p2 = +p2) <= 0 || n3 < 2)
16936       return min(values);
16937     if (p2 >= 1)
16938       return max(values);
16939     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));
16940     return value0 + (value1 - value0) * (i3 - i0);
16941   }
16942
16943   // node_modules/d3-array/src/median.js
16944   function median(values, valueof) {
16945     return quantile(values, 0.5, valueof);
16946   }
16947
16948   // node_modules/d3-array/src/merge.js
16949   function* flatten(arrays) {
16950     for (const array2 of arrays) {
16951       yield* __yieldStar(array2);
16952     }
16953   }
16954   function merge(arrays) {
16955     return Array.from(flatten(arrays));
16956   }
16957
16958   // node_modules/d3-array/src/pairs.js
16959   function pairs(values, pairof = pair) {
16960     const pairs2 = [];
16961     let previous;
16962     let first = false;
16963     for (const value of values) {
16964       if (first)
16965         pairs2.push(pairof(previous, value));
16966       previous = value;
16967       first = true;
16968     }
16969     return pairs2;
16970   }
16971   function pair(a2, b2) {
16972     return [a2, b2];
16973   }
16974
16975   // node_modules/d3-array/src/range.js
16976   function range(start2, stop, step) {
16977     start2 = +start2, stop = +stop, step = (n3 = arguments.length) < 2 ? (stop = start2, start2 = 0, 1) : n3 < 3 ? 1 : +step;
16978     var i3 = -1, n3 = Math.max(0, Math.ceil((stop - start2) / step)) | 0, range3 = new Array(n3);
16979     while (++i3 < n3) {
16980       range3[i3] = start2 + i3 * step;
16981     }
16982     return range3;
16983   }
16984
16985   // node_modules/d3-geo/src/math.js
16986   var epsilon = 1e-6;
16987   var epsilon2 = 1e-12;
16988   var pi = Math.PI;
16989   var halfPi = pi / 2;
16990   var quarterPi = pi / 4;
16991   var tau = pi * 2;
16992   var degrees = 180 / pi;
16993   var radians = pi / 180;
16994   var abs = Math.abs;
16995   var atan = Math.atan;
16996   var atan2 = Math.atan2;
16997   var cos = Math.cos;
16998   var exp = Math.exp;
16999   var log = Math.log;
17000   var sin = Math.sin;
17001   var sign = Math.sign || function(x2) {
17002     return x2 > 0 ? 1 : x2 < 0 ? -1 : 0;
17003   };
17004   var sqrt = Math.sqrt;
17005   var tan = Math.tan;
17006   function acos(x2) {
17007     return x2 > 1 ? 0 : x2 < -1 ? pi : Math.acos(x2);
17008   }
17009   function asin(x2) {
17010     return x2 > 1 ? halfPi : x2 < -1 ? -halfPi : Math.asin(x2);
17011   }
17012
17013   // node_modules/d3-geo/src/noop.js
17014   function noop() {
17015   }
17016
17017   // node_modules/d3-geo/src/stream.js
17018   function streamGeometry(geometry, stream) {
17019     if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {
17020       streamGeometryType[geometry.type](geometry, stream);
17021     }
17022   }
17023   var streamObjectType = {
17024     Feature: function(object, stream) {
17025       streamGeometry(object.geometry, stream);
17026     },
17027     FeatureCollection: function(object, stream) {
17028       var features = object.features, i3 = -1, n3 = features.length;
17029       while (++i3 < n3)
17030         streamGeometry(features[i3].geometry, stream);
17031     }
17032   };
17033   var streamGeometryType = {
17034     Sphere: function(object, stream) {
17035       stream.sphere();
17036     },
17037     Point: function(object, stream) {
17038       object = object.coordinates;
17039       stream.point(object[0], object[1], object[2]);
17040     },
17041     MultiPoint: function(object, stream) {
17042       var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
17043       while (++i3 < n3)
17044         object = coordinates[i3], stream.point(object[0], object[1], object[2]);
17045     },
17046     LineString: function(object, stream) {
17047       streamLine(object.coordinates, stream, 0);
17048     },
17049     MultiLineString: function(object, stream) {
17050       var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
17051       while (++i3 < n3)
17052         streamLine(coordinates[i3], stream, 0);
17053     },
17054     Polygon: function(object, stream) {
17055       streamPolygon(object.coordinates, stream);
17056     },
17057     MultiPolygon: function(object, stream) {
17058       var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
17059       while (++i3 < n3)
17060         streamPolygon(coordinates[i3], stream);
17061     },
17062     GeometryCollection: function(object, stream) {
17063       var geometries = object.geometries, i3 = -1, n3 = geometries.length;
17064       while (++i3 < n3)
17065         streamGeometry(geometries[i3], stream);
17066     }
17067   };
17068   function streamLine(coordinates, stream, closed) {
17069     var i3 = -1, n3 = coordinates.length - closed, coordinate;
17070     stream.lineStart();
17071     while (++i3 < n3)
17072       coordinate = coordinates[i3], stream.point(coordinate[0], coordinate[1], coordinate[2]);
17073     stream.lineEnd();
17074   }
17075   function streamPolygon(coordinates, stream) {
17076     var i3 = -1, n3 = coordinates.length;
17077     stream.polygonStart();
17078     while (++i3 < n3)
17079       streamLine(coordinates[i3], stream, 1);
17080     stream.polygonEnd();
17081   }
17082   function stream_default(object, stream) {
17083     if (object && streamObjectType.hasOwnProperty(object.type)) {
17084       streamObjectType[object.type](object, stream);
17085     } else {
17086       streamGeometry(object, stream);
17087     }
17088   }
17089
17090   // node_modules/d3-geo/src/area.js
17091   var areaRingSum = new Adder();
17092   var areaSum = new Adder();
17093   var lambda00;
17094   var phi00;
17095   var lambda0;
17096   var cosPhi0;
17097   var sinPhi0;
17098   var areaStream = {
17099     point: noop,
17100     lineStart: noop,
17101     lineEnd: noop,
17102     polygonStart: function() {
17103       areaRingSum = new Adder();
17104       areaStream.lineStart = areaRingStart;
17105       areaStream.lineEnd = areaRingEnd;
17106     },
17107     polygonEnd: function() {
17108       var areaRing = +areaRingSum;
17109       areaSum.add(areaRing < 0 ? tau + areaRing : areaRing);
17110       this.lineStart = this.lineEnd = this.point = noop;
17111     },
17112     sphere: function() {
17113       areaSum.add(tau);
17114     }
17115   };
17116   function areaRingStart() {
17117     areaStream.point = areaPointFirst;
17118   }
17119   function areaRingEnd() {
17120     areaPoint(lambda00, phi00);
17121   }
17122   function areaPointFirst(lambda, phi) {
17123     areaStream.point = areaPoint;
17124     lambda00 = lambda, phi00 = phi;
17125     lambda *= radians, phi *= radians;
17126     lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi);
17127   }
17128   function areaPoint(lambda, phi) {
17129     lambda *= radians, phi *= radians;
17130     phi = phi / 2 + quarterPi;
17131     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);
17132     areaRingSum.add(atan2(v2, u2));
17133     lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
17134   }
17135   function area_default(object) {
17136     areaSum = new Adder();
17137     stream_default(object, areaStream);
17138     return areaSum * 2;
17139   }
17140
17141   // node_modules/d3-geo/src/cartesian.js
17142   function spherical(cartesian2) {
17143     return [atan2(cartesian2[1], cartesian2[0]), asin(cartesian2[2])];
17144   }
17145   function cartesian(spherical2) {
17146     var lambda = spherical2[0], phi = spherical2[1], cosPhi = cos(phi);
17147     return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];
17148   }
17149   function cartesianDot(a2, b2) {
17150     return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2];
17151   }
17152   function cartesianCross(a2, b2) {
17153     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]];
17154   }
17155   function cartesianAddInPlace(a2, b2) {
17156     a2[0] += b2[0], a2[1] += b2[1], a2[2] += b2[2];
17157   }
17158   function cartesianScale(vector, k2) {
17159     return [vector[0] * k2, vector[1] * k2, vector[2] * k2];
17160   }
17161   function cartesianNormalizeInPlace(d2) {
17162     var l2 = sqrt(d2[0] * d2[0] + d2[1] * d2[1] + d2[2] * d2[2]);
17163     d2[0] /= l2, d2[1] /= l2, d2[2] /= l2;
17164   }
17165
17166   // node_modules/d3-geo/src/bounds.js
17167   var lambda02;
17168   var phi0;
17169   var lambda1;
17170   var phi1;
17171   var lambda2;
17172   var lambda002;
17173   var phi002;
17174   var p0;
17175   var deltaSum;
17176   var ranges;
17177   var range2;
17178   var boundsStream = {
17179     point: boundsPoint,
17180     lineStart: boundsLineStart,
17181     lineEnd: boundsLineEnd,
17182     polygonStart: function() {
17183       boundsStream.point = boundsRingPoint;
17184       boundsStream.lineStart = boundsRingStart;
17185       boundsStream.lineEnd = boundsRingEnd;
17186       deltaSum = new Adder();
17187       areaStream.polygonStart();
17188     },
17189     polygonEnd: function() {
17190       areaStream.polygonEnd();
17191       boundsStream.point = boundsPoint;
17192       boundsStream.lineStart = boundsLineStart;
17193       boundsStream.lineEnd = boundsLineEnd;
17194       if (areaRingSum < 0)
17195         lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
17196       else if (deltaSum > epsilon)
17197         phi1 = 90;
17198       else if (deltaSum < -epsilon)
17199         phi0 = -90;
17200       range2[0] = lambda02, range2[1] = lambda1;
17201     },
17202     sphere: function() {
17203       lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
17204     }
17205   };
17206   function boundsPoint(lambda, phi) {
17207     ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
17208     if (phi < phi0)
17209       phi0 = phi;
17210     if (phi > phi1)
17211       phi1 = phi;
17212   }
17213   function linePoint(lambda, phi) {
17214     var p2 = cartesian([lambda * radians, phi * radians]);
17215     if (p0) {
17216       var normal = cartesianCross(p0, p2), equatorial = [normal[1], -normal[0], 0], inflection = cartesianCross(equatorial, normal);
17217       cartesianNormalizeInPlace(inflection);
17218       inflection = spherical(inflection);
17219       var delta = lambda - lambda2, sign2 = delta > 0 ? 1 : -1, lambdai = inflection[0] * degrees * sign2, phii, antimeridian = abs(delta) > 180;
17220       if (antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
17221         phii = inflection[1] * degrees;
17222         if (phii > phi1)
17223           phi1 = phii;
17224       } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
17225         phii = -inflection[1] * degrees;
17226         if (phii < phi0)
17227           phi0 = phii;
17228       } else {
17229         if (phi < phi0)
17230           phi0 = phi;
17231         if (phi > phi1)
17232           phi1 = phi;
17233       }
17234       if (antimeridian) {
17235         if (lambda < lambda2) {
17236           if (angle(lambda02, lambda) > angle(lambda02, lambda1))
17237             lambda1 = lambda;
17238         } else {
17239           if (angle(lambda, lambda1) > angle(lambda02, lambda1))
17240             lambda02 = lambda;
17241         }
17242       } else {
17243         if (lambda1 >= lambda02) {
17244           if (lambda < lambda02)
17245             lambda02 = lambda;
17246           if (lambda > lambda1)
17247             lambda1 = lambda;
17248         } else {
17249           if (lambda > lambda2) {
17250             if (angle(lambda02, lambda) > angle(lambda02, lambda1))
17251               lambda1 = lambda;
17252           } else {
17253             if (angle(lambda, lambda1) > angle(lambda02, lambda1))
17254               lambda02 = lambda;
17255           }
17256         }
17257       }
17258     } else {
17259       ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
17260     }
17261     if (phi < phi0)
17262       phi0 = phi;
17263     if (phi > phi1)
17264       phi1 = phi;
17265     p0 = p2, lambda2 = lambda;
17266   }
17267   function boundsLineStart() {
17268     boundsStream.point = linePoint;
17269   }
17270   function boundsLineEnd() {
17271     range2[0] = lambda02, range2[1] = lambda1;
17272     boundsStream.point = boundsPoint;
17273     p0 = null;
17274   }
17275   function boundsRingPoint(lambda, phi) {
17276     if (p0) {
17277       var delta = lambda - lambda2;
17278       deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);
17279     } else {
17280       lambda002 = lambda, phi002 = phi;
17281     }
17282     areaStream.point(lambda, phi);
17283     linePoint(lambda, phi);
17284   }
17285   function boundsRingStart() {
17286     areaStream.lineStart();
17287   }
17288   function boundsRingEnd() {
17289     boundsRingPoint(lambda002, phi002);
17290     areaStream.lineEnd();
17291     if (abs(deltaSum) > epsilon)
17292       lambda02 = -(lambda1 = 180);
17293     range2[0] = lambda02, range2[1] = lambda1;
17294     p0 = null;
17295   }
17296   function angle(lambda04, lambda12) {
17297     return (lambda12 -= lambda04) < 0 ? lambda12 + 360 : lambda12;
17298   }
17299   function rangeCompare(a2, b2) {
17300     return a2[0] - b2[0];
17301   }
17302   function rangeContains(range3, x2) {
17303     return range3[0] <= range3[1] ? range3[0] <= x2 && x2 <= range3[1] : x2 < range3[0] || range3[1] < x2;
17304   }
17305   function bounds_default(feature3) {
17306     var i3, n3, a2, b2, merged, deltaMax, delta;
17307     phi1 = lambda1 = -(lambda02 = phi0 = Infinity);
17308     ranges = [];
17309     stream_default(feature3, boundsStream);
17310     if (n3 = ranges.length) {
17311       ranges.sort(rangeCompare);
17312       for (i3 = 1, a2 = ranges[0], merged = [a2]; i3 < n3; ++i3) {
17313         b2 = ranges[i3];
17314         if (rangeContains(a2, b2[0]) || rangeContains(a2, b2[1])) {
17315           if (angle(a2[0], b2[1]) > angle(a2[0], a2[1]))
17316             a2[1] = b2[1];
17317           if (angle(b2[0], a2[1]) > angle(a2[0], a2[1]))
17318             a2[0] = b2[0];
17319         } else {
17320           merged.push(a2 = b2);
17321         }
17322       }
17323       for (deltaMax = -Infinity, n3 = merged.length - 1, i3 = 0, a2 = merged[n3]; i3 <= n3; a2 = b2, ++i3) {
17324         b2 = merged[i3];
17325         if ((delta = angle(a2[1], b2[0])) > deltaMax)
17326           deltaMax = delta, lambda02 = b2[0], lambda1 = a2[1];
17327       }
17328     }
17329     ranges = range2 = null;
17330     return lambda02 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda02, phi0], [lambda1, phi1]];
17331   }
17332
17333   // node_modules/d3-geo/src/compose.js
17334   function compose_default(a2, b2) {
17335     function compose(x2, y2) {
17336       return x2 = a2(x2, y2), b2(x2[0], x2[1]);
17337     }
17338     if (a2.invert && b2.invert)
17339       compose.invert = function(x2, y2) {
17340         return x2 = b2.invert(x2, y2), x2 && a2.invert(x2[0], x2[1]);
17341       };
17342     return compose;
17343   }
17344
17345   // node_modules/d3-geo/src/rotation.js
17346   function rotationIdentity(lambda, phi) {
17347     return [abs(lambda) > pi ? lambda + Math.round(-lambda / tau) * tau : lambda, phi];
17348   }
17349   rotationIdentity.invert = rotationIdentity;
17350   function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
17351     return (deltaLambda %= tau) ? deltaPhi || deltaGamma ? compose_default(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;
17352   }
17353   function forwardRotationLambda(deltaLambda) {
17354     return function(lambda, phi) {
17355       return lambda += deltaLambda, [lambda > pi ? lambda - tau : lambda < -pi ? lambda + tau : lambda, phi];
17356     };
17357   }
17358   function rotationLambda(deltaLambda) {
17359     var rotation = forwardRotationLambda(deltaLambda);
17360     rotation.invert = forwardRotationLambda(-deltaLambda);
17361     return rotation;
17362   }
17363   function rotationPhiGamma(deltaPhi, deltaGamma) {
17364     var cosDeltaPhi = cos(deltaPhi), sinDeltaPhi = sin(deltaPhi), cosDeltaGamma = cos(deltaGamma), sinDeltaGamma = sin(deltaGamma);
17365     function rotation(lambda, phi) {
17366       var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z2 = sin(phi), k2 = z2 * cosDeltaPhi + x2 * sinDeltaPhi;
17367       return [
17368         atan2(y2 * cosDeltaGamma - k2 * sinDeltaGamma, x2 * cosDeltaPhi - z2 * sinDeltaPhi),
17369         asin(k2 * cosDeltaGamma + y2 * sinDeltaGamma)
17370       ];
17371     }
17372     rotation.invert = function(lambda, phi) {
17373       var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z2 = sin(phi), k2 = z2 * cosDeltaGamma - y2 * sinDeltaGamma;
17374       return [
17375         atan2(y2 * cosDeltaGamma + z2 * sinDeltaGamma, x2 * cosDeltaPhi + k2 * sinDeltaPhi),
17376         asin(k2 * cosDeltaPhi - x2 * sinDeltaPhi)
17377       ];
17378     };
17379     return rotation;
17380   }
17381   function rotation_default(rotate) {
17382     rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);
17383     function forward(coordinates) {
17384       coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);
17385       return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
17386     }
17387     forward.invert = function(coordinates) {
17388       coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);
17389       return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
17390     };
17391     return forward;
17392   }
17393
17394   // node_modules/d3-geo/src/circle.js
17395   function circleStream(stream, radius, delta, direction, t0, t1) {
17396     if (!delta)
17397       return;
17398     var cosRadius = cos(radius), sinRadius = sin(radius), step = direction * delta;
17399     if (t0 == null) {
17400       t0 = radius + direction * tau;
17401       t1 = radius - step / 2;
17402     } else {
17403       t0 = circleRadius(cosRadius, t0);
17404       t1 = circleRadius(cosRadius, t1);
17405       if (direction > 0 ? t0 < t1 : t0 > t1)
17406         t0 += direction * tau;
17407     }
17408     for (var point2, t2 = t0; direction > 0 ? t2 > t1 : t2 < t1; t2 -= step) {
17409       point2 = spherical([cosRadius, -sinRadius * cos(t2), -sinRadius * sin(t2)]);
17410       stream.point(point2[0], point2[1]);
17411     }
17412   }
17413   function circleRadius(cosRadius, point2) {
17414     point2 = cartesian(point2), point2[0] -= cosRadius;
17415     cartesianNormalizeInPlace(point2);
17416     var radius = acos(-point2[1]);
17417     return ((-point2[2] < 0 ? -radius : radius) + tau - epsilon) % tau;
17418   }
17419
17420   // node_modules/d3-geo/src/clip/buffer.js
17421   function buffer_default() {
17422     var lines = [], line;
17423     return {
17424       point: function(x2, y2, m2) {
17425         line.push([x2, y2, m2]);
17426       },
17427       lineStart: function() {
17428         lines.push(line = []);
17429       },
17430       lineEnd: noop,
17431       rejoin: function() {
17432         if (lines.length > 1)
17433           lines.push(lines.pop().concat(lines.shift()));
17434       },
17435       result: function() {
17436         var result = lines;
17437         lines = [];
17438         line = null;
17439         return result;
17440       }
17441     };
17442   }
17443
17444   // node_modules/d3-geo/src/pointEqual.js
17445   function pointEqual_default(a2, b2) {
17446     return abs(a2[0] - b2[0]) < epsilon && abs(a2[1] - b2[1]) < epsilon;
17447   }
17448
17449   // node_modules/d3-geo/src/clip/rejoin.js
17450   function Intersection(point2, points, other, entry) {
17451     this.x = point2;
17452     this.z = points;
17453     this.o = other;
17454     this.e = entry;
17455     this.v = false;
17456     this.n = this.p = null;
17457   }
17458   function rejoin_default(segments, compareIntersection2, startInside, interpolate, stream) {
17459     var subject = [], clip = [], i3, n3;
17460     segments.forEach(function(segment) {
17461       if ((n4 = segment.length - 1) <= 0)
17462         return;
17463       var n4, p02 = segment[0], p1 = segment[n4], x2;
17464       if (pointEqual_default(p02, p1)) {
17465         if (!p02[2] && !p1[2]) {
17466           stream.lineStart();
17467           for (i3 = 0; i3 < n4; ++i3)
17468             stream.point((p02 = segment[i3])[0], p02[1]);
17469           stream.lineEnd();
17470           return;
17471         }
17472         p1[0] += 2 * epsilon;
17473       }
17474       subject.push(x2 = new Intersection(p02, segment, null, true));
17475       clip.push(x2.o = new Intersection(p02, null, x2, false));
17476       subject.push(x2 = new Intersection(p1, segment, null, false));
17477       clip.push(x2.o = new Intersection(p1, null, x2, true));
17478     });
17479     if (!subject.length)
17480       return;
17481     clip.sort(compareIntersection2);
17482     link(subject);
17483     link(clip);
17484     for (i3 = 0, n3 = clip.length; i3 < n3; ++i3) {
17485       clip[i3].e = startInside = !startInside;
17486     }
17487     var start2 = subject[0], points, point2;
17488     while (1) {
17489       var current = start2, isSubject = true;
17490       while (current.v)
17491         if ((current = current.n) === start2)
17492           return;
17493       points = current.z;
17494       stream.lineStart();
17495       do {
17496         current.v = current.o.v = true;
17497         if (current.e) {
17498           if (isSubject) {
17499             for (i3 = 0, n3 = points.length; i3 < n3; ++i3)
17500               stream.point((point2 = points[i3])[0], point2[1]);
17501           } else {
17502             interpolate(current.x, current.n.x, 1, stream);
17503           }
17504           current = current.n;
17505         } else {
17506           if (isSubject) {
17507             points = current.p.z;
17508             for (i3 = points.length - 1; i3 >= 0; --i3)
17509               stream.point((point2 = points[i3])[0], point2[1]);
17510           } else {
17511             interpolate(current.x, current.p.x, -1, stream);
17512           }
17513           current = current.p;
17514         }
17515         current = current.o;
17516         points = current.z;
17517         isSubject = !isSubject;
17518       } while (!current.v);
17519       stream.lineEnd();
17520     }
17521   }
17522   function link(array2) {
17523     if (!(n3 = array2.length))
17524       return;
17525     var n3, i3 = 0, a2 = array2[0], b2;
17526     while (++i3 < n3) {
17527       a2.n = b2 = array2[i3];
17528       b2.p = a2;
17529       a2 = b2;
17530     }
17531     a2.n = b2 = array2[0];
17532     b2.p = a2;
17533   }
17534
17535   // node_modules/d3-geo/src/polygonContains.js
17536   function longitude(point2) {
17537     return abs(point2[0]) <= pi ? point2[0] : sign(point2[0]) * ((abs(point2[0]) + pi) % tau - pi);
17538   }
17539   function polygonContains_default(polygon2, point2) {
17540     var lambda = longitude(point2), phi = point2[1], sinPhi = sin(phi), normal = [sin(lambda), -cos(lambda), 0], angle2 = 0, winding = 0;
17541     var sum = new Adder();
17542     if (sinPhi === 1)
17543       phi = halfPi + epsilon;
17544     else if (sinPhi === -1)
17545       phi = -halfPi - epsilon;
17546     for (var i3 = 0, n3 = polygon2.length; i3 < n3; ++i3) {
17547       if (!(m2 = (ring = polygon2[i3]).length))
17548         continue;
17549       var ring, m2, point0 = ring[m2 - 1], lambda04 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi03 = sin(phi02), cosPhi03 = cos(phi02);
17550       for (var j3 = 0; j3 < m2; ++j3, lambda04 = lambda12, sinPhi03 = sinPhi1, cosPhi03 = cosPhi1, point0 = point1) {
17551         var point1 = ring[j3], lambda12 = longitude(point1), phi12 = point1[1] / 2 + quarterPi, sinPhi1 = sin(phi12), cosPhi1 = cos(phi12), delta = lambda12 - lambda04, sign2 = delta >= 0 ? 1 : -1, absDelta = sign2 * delta, antimeridian = absDelta > pi, k2 = sinPhi03 * sinPhi1;
17552         sum.add(atan2(k2 * sign2 * sin(absDelta), cosPhi03 * cosPhi1 + k2 * cos(absDelta)));
17553         angle2 += antimeridian ? delta + sign2 * tau : delta;
17554         if (antimeridian ^ lambda04 >= lambda ^ lambda12 >= lambda) {
17555           var arc = cartesianCross(cartesian(point0), cartesian(point1));
17556           cartesianNormalizeInPlace(arc);
17557           var intersection = cartesianCross(normal, arc);
17558           cartesianNormalizeInPlace(intersection);
17559           var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]);
17560           if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {
17561             winding += antimeridian ^ delta >= 0 ? 1 : -1;
17562           }
17563         }
17564       }
17565     }
17566     return (angle2 < -epsilon || angle2 < epsilon && sum < -epsilon2) ^ winding & 1;
17567   }
17568
17569   // node_modules/d3-geo/src/clip/index.js
17570   function clip_default(pointVisible, clipLine, interpolate, start2) {
17571     return function(sink) {
17572       var line = clipLine(sink), ringBuffer = buffer_default(), ringSink = clipLine(ringBuffer), polygonStarted = false, polygon2, segments, ring;
17573       var clip = {
17574         point: point2,
17575         lineStart,
17576         lineEnd,
17577         polygonStart: function() {
17578           clip.point = pointRing;
17579           clip.lineStart = ringStart;
17580           clip.lineEnd = ringEnd;
17581           segments = [];
17582           polygon2 = [];
17583         },
17584         polygonEnd: function() {
17585           clip.point = point2;
17586           clip.lineStart = lineStart;
17587           clip.lineEnd = lineEnd;
17588           segments = merge(segments);
17589           var startInside = polygonContains_default(polygon2, start2);
17590           if (segments.length) {
17591             if (!polygonStarted)
17592               sink.polygonStart(), polygonStarted = true;
17593             rejoin_default(segments, compareIntersection, startInside, interpolate, sink);
17594           } else if (startInside) {
17595             if (!polygonStarted)
17596               sink.polygonStart(), polygonStarted = true;
17597             sink.lineStart();
17598             interpolate(null, null, 1, sink);
17599             sink.lineEnd();
17600           }
17601           if (polygonStarted)
17602             sink.polygonEnd(), polygonStarted = false;
17603           segments = polygon2 = null;
17604         },
17605         sphere: function() {
17606           sink.polygonStart();
17607           sink.lineStart();
17608           interpolate(null, null, 1, sink);
17609           sink.lineEnd();
17610           sink.polygonEnd();
17611         }
17612       };
17613       function point2(lambda, phi) {
17614         if (pointVisible(lambda, phi))
17615           sink.point(lambda, phi);
17616       }
17617       function pointLine(lambda, phi) {
17618         line.point(lambda, phi);
17619       }
17620       function lineStart() {
17621         clip.point = pointLine;
17622         line.lineStart();
17623       }
17624       function lineEnd() {
17625         clip.point = point2;
17626         line.lineEnd();
17627       }
17628       function pointRing(lambda, phi) {
17629         ring.push([lambda, phi]);
17630         ringSink.point(lambda, phi);
17631       }
17632       function ringStart() {
17633         ringSink.lineStart();
17634         ring = [];
17635       }
17636       function ringEnd() {
17637         pointRing(ring[0][0], ring[0][1]);
17638         ringSink.lineEnd();
17639         var clean2 = ringSink.clean(), ringSegments = ringBuffer.result(), i3, n3 = ringSegments.length, m2, segment, point3;
17640         ring.pop();
17641         polygon2.push(ring);
17642         ring = null;
17643         if (!n3)
17644           return;
17645         if (clean2 & 1) {
17646           segment = ringSegments[0];
17647           if ((m2 = segment.length - 1) > 0) {
17648             if (!polygonStarted)
17649               sink.polygonStart(), polygonStarted = true;
17650             sink.lineStart();
17651             for (i3 = 0; i3 < m2; ++i3)
17652               sink.point((point3 = segment[i3])[0], point3[1]);
17653             sink.lineEnd();
17654           }
17655           return;
17656         }
17657         if (n3 > 1 && clean2 & 2)
17658           ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
17659         segments.push(ringSegments.filter(validSegment));
17660       }
17661       return clip;
17662     };
17663   }
17664   function validSegment(segment) {
17665     return segment.length > 1;
17666   }
17667   function compareIntersection(a2, b2) {
17668     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]);
17669   }
17670
17671   // node_modules/d3-geo/src/clip/antimeridian.js
17672   var antimeridian_default = clip_default(
17673     function() {
17674       return true;
17675     },
17676     clipAntimeridianLine,
17677     clipAntimeridianInterpolate,
17678     [-pi, -halfPi]
17679   );
17680   function clipAntimeridianLine(stream) {
17681     var lambda04 = NaN, phi02 = NaN, sign0 = NaN, clean2;
17682     return {
17683       lineStart: function() {
17684         stream.lineStart();
17685         clean2 = 1;
17686       },
17687       point: function(lambda12, phi12) {
17688         var sign1 = lambda12 > 0 ? pi : -pi, delta = abs(lambda12 - lambda04);
17689         if (abs(delta - pi) < epsilon) {
17690           stream.point(lambda04, phi02 = (phi02 + phi12) / 2 > 0 ? halfPi : -halfPi);
17691           stream.point(sign0, phi02);
17692           stream.lineEnd();
17693           stream.lineStart();
17694           stream.point(sign1, phi02);
17695           stream.point(lambda12, phi02);
17696           clean2 = 0;
17697         } else if (sign0 !== sign1 && delta >= pi) {
17698           if (abs(lambda04 - sign0) < epsilon)
17699             lambda04 -= sign0 * epsilon;
17700           if (abs(lambda12 - sign1) < epsilon)
17701             lambda12 -= sign1 * epsilon;
17702           phi02 = clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12);
17703           stream.point(sign0, phi02);
17704           stream.lineEnd();
17705           stream.lineStart();
17706           stream.point(sign1, phi02);
17707           clean2 = 0;
17708         }
17709         stream.point(lambda04 = lambda12, phi02 = phi12);
17710         sign0 = sign1;
17711       },
17712       lineEnd: function() {
17713         stream.lineEnd();
17714         lambda04 = phi02 = NaN;
17715       },
17716       clean: function() {
17717         return 2 - clean2;
17718       }
17719     };
17720   }
17721   function clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12) {
17722     var cosPhi03, cosPhi1, sinLambda0Lambda1 = sin(lambda04 - lambda12);
17723     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;
17724   }
17725   function clipAntimeridianInterpolate(from, to, direction, stream) {
17726     var phi;
17727     if (from == null) {
17728       phi = direction * halfPi;
17729       stream.point(-pi, phi);
17730       stream.point(0, phi);
17731       stream.point(pi, phi);
17732       stream.point(pi, 0);
17733       stream.point(pi, -phi);
17734       stream.point(0, -phi);
17735       stream.point(-pi, -phi);
17736       stream.point(-pi, 0);
17737       stream.point(-pi, phi);
17738     } else if (abs(from[0] - to[0]) > epsilon) {
17739       var lambda = from[0] < to[0] ? pi : -pi;
17740       phi = direction * lambda / 2;
17741       stream.point(-lambda, phi);
17742       stream.point(0, phi);
17743       stream.point(lambda, phi);
17744     } else {
17745       stream.point(to[0], to[1]);
17746     }
17747   }
17748
17749   // node_modules/d3-geo/src/clip/circle.js
17750   function circle_default(radius) {
17751     var cr = cos(radius), delta = 6 * radians, smallRadius = cr > 0, notHemisphere = abs(cr) > epsilon;
17752     function interpolate(from, to, direction, stream) {
17753       circleStream(stream, radius, delta, direction, from, to);
17754     }
17755     function visible(lambda, phi) {
17756       return cos(lambda) * cos(phi) > cr;
17757     }
17758     function clipLine(stream) {
17759       var point0, c0, v0, v00, clean2;
17760       return {
17761         lineStart: function() {
17762           v00 = v0 = false;
17763           clean2 = 1;
17764         },
17765         point: function(lambda, phi) {
17766           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;
17767           if (!point0 && (v00 = v0 = v2))
17768             stream.lineStart();
17769           if (v2 !== v0) {
17770             point2 = intersect2(point0, point1);
17771             if (!point2 || pointEqual_default(point0, point2) || pointEqual_default(point1, point2))
17772               point1[2] = 1;
17773           }
17774           if (v2 !== v0) {
17775             clean2 = 0;
17776             if (v2) {
17777               stream.lineStart();
17778               point2 = intersect2(point1, point0);
17779               stream.point(point2[0], point2[1]);
17780             } else {
17781               point2 = intersect2(point0, point1);
17782               stream.point(point2[0], point2[1], 2);
17783               stream.lineEnd();
17784             }
17785             point0 = point2;
17786           } else if (notHemisphere && point0 && smallRadius ^ v2) {
17787             var t2;
17788             if (!(c2 & c0) && (t2 = intersect2(point1, point0, true))) {
17789               clean2 = 0;
17790               if (smallRadius) {
17791                 stream.lineStart();
17792                 stream.point(t2[0][0], t2[0][1]);
17793                 stream.point(t2[1][0], t2[1][1]);
17794                 stream.lineEnd();
17795               } else {
17796                 stream.point(t2[1][0], t2[1][1]);
17797                 stream.lineEnd();
17798                 stream.lineStart();
17799                 stream.point(t2[0][0], t2[0][1], 3);
17800               }
17801             }
17802           }
17803           if (v2 && (!point0 || !pointEqual_default(point0, point1))) {
17804             stream.point(point1[0], point1[1]);
17805           }
17806           point0 = point1, v0 = v2, c0 = c2;
17807         },
17808         lineEnd: function() {
17809           if (v0)
17810             stream.lineEnd();
17811           point0 = null;
17812         },
17813         // Rejoin first and last segments if there were intersections and the first
17814         // and last points were visible.
17815         clean: function() {
17816           return clean2 | (v00 && v0) << 1;
17817         }
17818       };
17819     }
17820     function intersect2(a2, b2, two) {
17821       var pa = cartesian(a2), pb = cartesian(b2);
17822       var n1 = [1, 0, 0], n22 = cartesianCross(pa, pb), n2n2 = cartesianDot(n22, n22), n1n2 = n22[0], determinant = n2n2 - n1n2 * n1n2;
17823       if (!determinant)
17824         return !two && a2;
17825       var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n22), A2 = cartesianScale(n1, c1), B2 = cartesianScale(n22, c2);
17826       cartesianAddInPlace(A2, B2);
17827       var u2 = n1xn2, w2 = cartesianDot(A2, u2), uu = cartesianDot(u2, u2), t2 = w2 * w2 - uu * (cartesianDot(A2, A2) - 1);
17828       if (t2 < 0)
17829         return;
17830       var t3 = sqrt(t2), q2 = cartesianScale(u2, (-w2 - t3) / uu);
17831       cartesianAddInPlace(q2, A2);
17832       q2 = spherical(q2);
17833       if (!two)
17834         return q2;
17835       var lambda04 = a2[0], lambda12 = b2[0], phi02 = a2[1], phi12 = b2[1], z2;
17836       if (lambda12 < lambda04)
17837         z2 = lambda04, lambda04 = lambda12, lambda12 = z2;
17838       var delta2 = lambda12 - lambda04, polar = abs(delta2 - pi) < epsilon, meridian = polar || delta2 < epsilon;
17839       if (!polar && phi12 < phi02)
17840         z2 = phi02, phi02 = phi12, phi12 = z2;
17841       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)) {
17842         var q1 = cartesianScale(u2, (-w2 + t3) / uu);
17843         cartesianAddInPlace(q1, A2);
17844         return [q2, spherical(q1)];
17845       }
17846     }
17847     function code(lambda, phi) {
17848       var r2 = smallRadius ? radius : pi - radius, code2 = 0;
17849       if (lambda < -r2)
17850         code2 |= 1;
17851       else if (lambda > r2)
17852         code2 |= 2;
17853       if (phi < -r2)
17854         code2 |= 4;
17855       else if (phi > r2)
17856         code2 |= 8;
17857       return code2;
17858     }
17859     return clip_default(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);
17860   }
17861
17862   // node_modules/d3-geo/src/clip/line.js
17863   function line_default(a2, b2, x05, y05, x12, y12) {
17864     var ax = a2[0], ay = a2[1], bx = b2[0], by = b2[1], t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r2;
17865     r2 = x05 - ax;
17866     if (!dx && r2 > 0)
17867       return;
17868     r2 /= dx;
17869     if (dx < 0) {
17870       if (r2 < t0)
17871         return;
17872       if (r2 < t1)
17873         t1 = r2;
17874     } else if (dx > 0) {
17875       if (r2 > t1)
17876         return;
17877       if (r2 > t0)
17878         t0 = r2;
17879     }
17880     r2 = x12 - ax;
17881     if (!dx && r2 < 0)
17882       return;
17883     r2 /= dx;
17884     if (dx < 0) {
17885       if (r2 > t1)
17886         return;
17887       if (r2 > t0)
17888         t0 = r2;
17889     } else if (dx > 0) {
17890       if (r2 < t0)
17891         return;
17892       if (r2 < t1)
17893         t1 = r2;
17894     }
17895     r2 = y05 - ay;
17896     if (!dy && r2 > 0)
17897       return;
17898     r2 /= dy;
17899     if (dy < 0) {
17900       if (r2 < t0)
17901         return;
17902       if (r2 < t1)
17903         t1 = r2;
17904     } else if (dy > 0) {
17905       if (r2 > t1)
17906         return;
17907       if (r2 > t0)
17908         t0 = r2;
17909     }
17910     r2 = y12 - ay;
17911     if (!dy && r2 < 0)
17912       return;
17913     r2 /= dy;
17914     if (dy < 0) {
17915       if (r2 > t1)
17916         return;
17917       if (r2 > t0)
17918         t0 = r2;
17919     } else if (dy > 0) {
17920       if (r2 < t0)
17921         return;
17922       if (r2 < t1)
17923         t1 = r2;
17924     }
17925     if (t0 > 0)
17926       a2[0] = ax + t0 * dx, a2[1] = ay + t0 * dy;
17927     if (t1 < 1)
17928       b2[0] = ax + t1 * dx, b2[1] = ay + t1 * dy;
17929     return true;
17930   }
17931
17932   // node_modules/d3-geo/src/clip/rectangle.js
17933   var clipMax = 1e9;
17934   var clipMin = -clipMax;
17935   function clipRectangle(x05, y05, x12, y12) {
17936     function visible(x2, y2) {
17937       return x05 <= x2 && x2 <= x12 && y05 <= y2 && y2 <= y12;
17938     }
17939     function interpolate(from, to, direction, stream) {
17940       var a2 = 0, a1 = 0;
17941       if (from == null || (a2 = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) {
17942         do
17943           stream.point(a2 === 0 || a2 === 3 ? x05 : x12, a2 > 1 ? y12 : y05);
17944         while ((a2 = (a2 + direction + 4) % 4) !== a1);
17945       } else {
17946         stream.point(to[0], to[1]);
17947       }
17948     }
17949     function corner(p2, direction) {
17950       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;
17951     }
17952     function compareIntersection2(a2, b2) {
17953       return comparePoint(a2.x, b2.x);
17954     }
17955     function comparePoint(a2, b2) {
17956       var ca = corner(a2, 1), cb = corner(b2, 1);
17957       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];
17958     }
17959     return function(stream) {
17960       var activeStream = stream, bufferStream = buffer_default(), segments, polygon2, ring, x__, y__, v__, x_, y_, v_, first, clean2;
17961       var clipStream = {
17962         point: point2,
17963         lineStart,
17964         lineEnd,
17965         polygonStart,
17966         polygonEnd
17967       };
17968       function point2(x2, y2) {
17969         if (visible(x2, y2))
17970           activeStream.point(x2, y2);
17971       }
17972       function polygonInside() {
17973         var winding = 0;
17974         for (var i3 = 0, n3 = polygon2.length; i3 < n3; ++i3) {
17975           for (var ring2 = polygon2[i3], j3 = 1, m2 = ring2.length, point3 = ring2[0], a0, a1, b0 = point3[0], b1 = point3[1]; j3 < m2; ++j3) {
17976             a0 = b0, a1 = b1, point3 = ring2[j3], b0 = point3[0], b1 = point3[1];
17977             if (a1 <= y12) {
17978               if (b1 > y12 && (b0 - a0) * (y12 - a1) > (b1 - a1) * (x05 - a0))
17979                 ++winding;
17980             } else {
17981               if (b1 <= y12 && (b0 - a0) * (y12 - a1) < (b1 - a1) * (x05 - a0))
17982                 --winding;
17983             }
17984           }
17985         }
17986         return winding;
17987       }
17988       function polygonStart() {
17989         activeStream = bufferStream, segments = [], polygon2 = [], clean2 = true;
17990       }
17991       function polygonEnd() {
17992         var startInside = polygonInside(), cleanInside = clean2 && startInside, visible2 = (segments = merge(segments)).length;
17993         if (cleanInside || visible2) {
17994           stream.polygonStart();
17995           if (cleanInside) {
17996             stream.lineStart();
17997             interpolate(null, null, 1, stream);
17998             stream.lineEnd();
17999           }
18000           if (visible2) {
18001             rejoin_default(segments, compareIntersection2, startInside, interpolate, stream);
18002           }
18003           stream.polygonEnd();
18004         }
18005         activeStream = stream, segments = polygon2 = ring = null;
18006       }
18007       function lineStart() {
18008         clipStream.point = linePoint2;
18009         if (polygon2)
18010           polygon2.push(ring = []);
18011         first = true;
18012         v_ = false;
18013         x_ = y_ = NaN;
18014       }
18015       function lineEnd() {
18016         if (segments) {
18017           linePoint2(x__, y__);
18018           if (v__ && v_)
18019             bufferStream.rejoin();
18020           segments.push(bufferStream.result());
18021         }
18022         clipStream.point = point2;
18023         if (v_)
18024           activeStream.lineEnd();
18025       }
18026       function linePoint2(x2, y2) {
18027         var v2 = visible(x2, y2);
18028         if (polygon2)
18029           ring.push([x2, y2]);
18030         if (first) {
18031           x__ = x2, y__ = y2, v__ = v2;
18032           first = false;
18033           if (v2) {
18034             activeStream.lineStart();
18035             activeStream.point(x2, y2);
18036           }
18037         } else {
18038           if (v2 && v_)
18039             activeStream.point(x2, y2);
18040           else {
18041             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))];
18042             if (line_default(a2, b2, x05, y05, x12, y12)) {
18043               if (!v_) {
18044                 activeStream.lineStart();
18045                 activeStream.point(a2[0], a2[1]);
18046               }
18047               activeStream.point(b2[0], b2[1]);
18048               if (!v2)
18049                 activeStream.lineEnd();
18050               clean2 = false;
18051             } else if (v2) {
18052               activeStream.lineStart();
18053               activeStream.point(x2, y2);
18054               clean2 = false;
18055             }
18056           }
18057         }
18058         x_ = x2, y_ = y2, v_ = v2;
18059       }
18060       return clipStream;
18061     };
18062   }
18063
18064   // node_modules/d3-geo/src/length.js
18065   var lengthSum;
18066   var lambda03;
18067   var sinPhi02;
18068   var cosPhi02;
18069   var lengthStream = {
18070     sphere: noop,
18071     point: noop,
18072     lineStart: lengthLineStart,
18073     lineEnd: noop,
18074     polygonStart: noop,
18075     polygonEnd: noop
18076   };
18077   function lengthLineStart() {
18078     lengthStream.point = lengthPointFirst;
18079     lengthStream.lineEnd = lengthLineEnd;
18080   }
18081   function lengthLineEnd() {
18082     lengthStream.point = lengthStream.lineEnd = noop;
18083   }
18084   function lengthPointFirst(lambda, phi) {
18085     lambda *= radians, phi *= radians;
18086     lambda03 = lambda, sinPhi02 = sin(phi), cosPhi02 = cos(phi);
18087     lengthStream.point = lengthPoint;
18088   }
18089   function lengthPoint(lambda, phi) {
18090     lambda *= radians, phi *= radians;
18091     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;
18092     lengthSum.add(atan2(sqrt(x2 * x2 + y2 * y2), z2));
18093     lambda03 = lambda, sinPhi02 = sinPhi, cosPhi02 = cosPhi;
18094   }
18095   function length_default(object) {
18096     lengthSum = new Adder();
18097     stream_default(object, lengthStream);
18098     return +lengthSum;
18099   }
18100
18101   // node_modules/d3-geo/src/identity.js
18102   var identity_default = (x2) => x2;
18103
18104   // node_modules/d3-geo/src/path/area.js
18105   var areaSum2 = new Adder();
18106   var areaRingSum2 = new Adder();
18107   var x00;
18108   var y00;
18109   var x0;
18110   var y0;
18111   var areaStream2 = {
18112     point: noop,
18113     lineStart: noop,
18114     lineEnd: noop,
18115     polygonStart: function() {
18116       areaStream2.lineStart = areaRingStart2;
18117       areaStream2.lineEnd = areaRingEnd2;
18118     },
18119     polygonEnd: function() {
18120       areaStream2.lineStart = areaStream2.lineEnd = areaStream2.point = noop;
18121       areaSum2.add(abs(areaRingSum2));
18122       areaRingSum2 = new Adder();
18123     },
18124     result: function() {
18125       var area = areaSum2 / 2;
18126       areaSum2 = new Adder();
18127       return area;
18128     }
18129   };
18130   function areaRingStart2() {
18131     areaStream2.point = areaPointFirst2;
18132   }
18133   function areaPointFirst2(x2, y2) {
18134     areaStream2.point = areaPoint2;
18135     x00 = x0 = x2, y00 = y0 = y2;
18136   }
18137   function areaPoint2(x2, y2) {
18138     areaRingSum2.add(y0 * x2 - x0 * y2);
18139     x0 = x2, y0 = y2;
18140   }
18141   function areaRingEnd2() {
18142     areaPoint2(x00, y00);
18143   }
18144   var area_default2 = areaStream2;
18145
18146   // node_modules/d3-geo/src/path/bounds.js
18147   var x02 = Infinity;
18148   var y02 = x02;
18149   var x1 = -x02;
18150   var y1 = x1;
18151   var boundsStream2 = {
18152     point: boundsPoint2,
18153     lineStart: noop,
18154     lineEnd: noop,
18155     polygonStart: noop,
18156     polygonEnd: noop,
18157     result: function() {
18158       var bounds = [[x02, y02], [x1, y1]];
18159       x1 = y1 = -(y02 = x02 = Infinity);
18160       return bounds;
18161     }
18162   };
18163   function boundsPoint2(x2, y2) {
18164     if (x2 < x02)
18165       x02 = x2;
18166     if (x2 > x1)
18167       x1 = x2;
18168     if (y2 < y02)
18169       y02 = y2;
18170     if (y2 > y1)
18171       y1 = y2;
18172   }
18173   var bounds_default2 = boundsStream2;
18174
18175   // node_modules/d3-geo/src/path/centroid.js
18176   var X0 = 0;
18177   var Y0 = 0;
18178   var Z0 = 0;
18179   var X1 = 0;
18180   var Y1 = 0;
18181   var Z1 = 0;
18182   var X2 = 0;
18183   var Y2 = 0;
18184   var Z2 = 0;
18185   var x002;
18186   var y002;
18187   var x03;
18188   var y03;
18189   var centroidStream = {
18190     point: centroidPoint,
18191     lineStart: centroidLineStart,
18192     lineEnd: centroidLineEnd,
18193     polygonStart: function() {
18194       centroidStream.lineStart = centroidRingStart;
18195       centroidStream.lineEnd = centroidRingEnd;
18196     },
18197     polygonEnd: function() {
18198       centroidStream.point = centroidPoint;
18199       centroidStream.lineStart = centroidLineStart;
18200       centroidStream.lineEnd = centroidLineEnd;
18201     },
18202     result: function() {
18203       var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];
18204       X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;
18205       return centroid;
18206     }
18207   };
18208   function centroidPoint(x2, y2) {
18209     X0 += x2;
18210     Y0 += y2;
18211     ++Z0;
18212   }
18213   function centroidLineStart() {
18214     centroidStream.point = centroidPointFirstLine;
18215   }
18216   function centroidPointFirstLine(x2, y2) {
18217     centroidStream.point = centroidPointLine;
18218     centroidPoint(x03 = x2, y03 = y2);
18219   }
18220   function centroidPointLine(x2, y2) {
18221     var dx = x2 - x03, dy = y2 - y03, z2 = sqrt(dx * dx + dy * dy);
18222     X1 += z2 * (x03 + x2) / 2;
18223     Y1 += z2 * (y03 + y2) / 2;
18224     Z1 += z2;
18225     centroidPoint(x03 = x2, y03 = y2);
18226   }
18227   function centroidLineEnd() {
18228     centroidStream.point = centroidPoint;
18229   }
18230   function centroidRingStart() {
18231     centroidStream.point = centroidPointFirstRing;
18232   }
18233   function centroidRingEnd() {
18234     centroidPointRing(x002, y002);
18235   }
18236   function centroidPointFirstRing(x2, y2) {
18237     centroidStream.point = centroidPointRing;
18238     centroidPoint(x002 = x03 = x2, y002 = y03 = y2);
18239   }
18240   function centroidPointRing(x2, y2) {
18241     var dx = x2 - x03, dy = y2 - y03, z2 = sqrt(dx * dx + dy * dy);
18242     X1 += z2 * (x03 + x2) / 2;
18243     Y1 += z2 * (y03 + y2) / 2;
18244     Z1 += z2;
18245     z2 = y03 * x2 - x03 * y2;
18246     X2 += z2 * (x03 + x2);
18247     Y2 += z2 * (y03 + y2);
18248     Z2 += z2 * 3;
18249     centroidPoint(x03 = x2, y03 = y2);
18250   }
18251   var centroid_default = centroidStream;
18252
18253   // node_modules/d3-geo/src/path/context.js
18254   function PathContext(context) {
18255     this._context = context;
18256   }
18257   PathContext.prototype = {
18258     _radius: 4.5,
18259     pointRadius: function(_2) {
18260       return this._radius = _2, this;
18261     },
18262     polygonStart: function() {
18263       this._line = 0;
18264     },
18265     polygonEnd: function() {
18266       this._line = NaN;
18267     },
18268     lineStart: function() {
18269       this._point = 0;
18270     },
18271     lineEnd: function() {
18272       if (this._line === 0)
18273         this._context.closePath();
18274       this._point = NaN;
18275     },
18276     point: function(x2, y2) {
18277       switch (this._point) {
18278         case 0: {
18279           this._context.moveTo(x2, y2);
18280           this._point = 1;
18281           break;
18282         }
18283         case 1: {
18284           this._context.lineTo(x2, y2);
18285           break;
18286         }
18287         default: {
18288           this._context.moveTo(x2 + this._radius, y2);
18289           this._context.arc(x2, y2, this._radius, 0, tau);
18290           break;
18291         }
18292       }
18293     },
18294     result: noop
18295   };
18296
18297   // node_modules/d3-geo/src/path/measure.js
18298   var lengthSum2 = new Adder();
18299   var lengthRing;
18300   var x003;
18301   var y003;
18302   var x04;
18303   var y04;
18304   var lengthStream2 = {
18305     point: noop,
18306     lineStart: function() {
18307       lengthStream2.point = lengthPointFirst2;
18308     },
18309     lineEnd: function() {
18310       if (lengthRing)
18311         lengthPoint2(x003, y003);
18312       lengthStream2.point = noop;
18313     },
18314     polygonStart: function() {
18315       lengthRing = true;
18316     },
18317     polygonEnd: function() {
18318       lengthRing = null;
18319     },
18320     result: function() {
18321       var length = +lengthSum2;
18322       lengthSum2 = new Adder();
18323       return length;
18324     }
18325   };
18326   function lengthPointFirst2(x2, y2) {
18327     lengthStream2.point = lengthPoint2;
18328     x003 = x04 = x2, y003 = y04 = y2;
18329   }
18330   function lengthPoint2(x2, y2) {
18331     x04 -= x2, y04 -= y2;
18332     lengthSum2.add(sqrt(x04 * x04 + y04 * y04));
18333     x04 = x2, y04 = y2;
18334   }
18335   var measure_default = lengthStream2;
18336
18337   // node_modules/d3-geo/src/path/string.js
18338   function PathString() {
18339     this._string = [];
18340   }
18341   PathString.prototype = {
18342     _radius: 4.5,
18343     _circle: circle(4.5),
18344     pointRadius: function(_2) {
18345       if ((_2 = +_2) !== this._radius)
18346         this._radius = _2, this._circle = null;
18347       return this;
18348     },
18349     polygonStart: function() {
18350       this._line = 0;
18351     },
18352     polygonEnd: function() {
18353       this._line = NaN;
18354     },
18355     lineStart: function() {
18356       this._point = 0;
18357     },
18358     lineEnd: function() {
18359       if (this._line === 0)
18360         this._string.push("Z");
18361       this._point = NaN;
18362     },
18363     point: function(x2, y2) {
18364       switch (this._point) {
18365         case 0: {
18366           this._string.push("M", x2, ",", y2);
18367           this._point = 1;
18368           break;
18369         }
18370         case 1: {
18371           this._string.push("L", x2, ",", y2);
18372           break;
18373         }
18374         default: {
18375           if (this._circle == null)
18376             this._circle = circle(this._radius);
18377           this._string.push("M", x2, ",", y2, this._circle);
18378           break;
18379         }
18380       }
18381     },
18382     result: function() {
18383       if (this._string.length) {
18384         var result = this._string.join("");
18385         this._string = [];
18386         return result;
18387       } else {
18388         return null;
18389       }
18390     }
18391   };
18392   function circle(radius) {
18393     return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z";
18394   }
18395
18396   // node_modules/d3-geo/src/path/index.js
18397   function path_default(projection2, context) {
18398     var pointRadius = 4.5, projectionStream, contextStream;
18399     function path(object) {
18400       if (object) {
18401         if (typeof pointRadius === "function")
18402           contextStream.pointRadius(+pointRadius.apply(this, arguments));
18403         stream_default(object, projectionStream(contextStream));
18404       }
18405       return contextStream.result();
18406     }
18407     path.area = function(object) {
18408       stream_default(object, projectionStream(area_default2));
18409       return area_default2.result();
18410     };
18411     path.measure = function(object) {
18412       stream_default(object, projectionStream(measure_default));
18413       return measure_default.result();
18414     };
18415     path.bounds = function(object) {
18416       stream_default(object, projectionStream(bounds_default2));
18417       return bounds_default2.result();
18418     };
18419     path.centroid = function(object) {
18420       stream_default(object, projectionStream(centroid_default));
18421       return centroid_default.result();
18422     };
18423     path.projection = function(_2) {
18424       return arguments.length ? (projectionStream = _2 == null ? (projection2 = null, identity_default) : (projection2 = _2).stream, path) : projection2;
18425     };
18426     path.context = function(_2) {
18427       if (!arguments.length)
18428         return context;
18429       contextStream = _2 == null ? (context = null, new PathString()) : new PathContext(context = _2);
18430       if (typeof pointRadius !== "function")
18431         contextStream.pointRadius(pointRadius);
18432       return path;
18433     };
18434     path.pointRadius = function(_2) {
18435       if (!arguments.length)
18436         return pointRadius;
18437       pointRadius = typeof _2 === "function" ? _2 : (contextStream.pointRadius(+_2), +_2);
18438       return path;
18439     };
18440     return path.projection(projection2).context(context);
18441   }
18442
18443   // node_modules/d3-geo/src/transform.js
18444   function transform_default(methods2) {
18445     return {
18446       stream: transformer(methods2)
18447     };
18448   }
18449   function transformer(methods2) {
18450     return function(stream) {
18451       var s2 = new TransformStream();
18452       for (var key in methods2)
18453         s2[key] = methods2[key];
18454       s2.stream = stream;
18455       return s2;
18456     };
18457   }
18458   function TransformStream() {
18459   }
18460   TransformStream.prototype = {
18461     constructor: TransformStream,
18462     point: function(x2, y2) {
18463       this.stream.point(x2, y2);
18464     },
18465     sphere: function() {
18466       this.stream.sphere();
18467     },
18468     lineStart: function() {
18469       this.stream.lineStart();
18470     },
18471     lineEnd: function() {
18472       this.stream.lineEnd();
18473     },
18474     polygonStart: function() {
18475       this.stream.polygonStart();
18476     },
18477     polygonEnd: function() {
18478       this.stream.polygonEnd();
18479     }
18480   };
18481
18482   // node_modules/d3-geo/src/projection/fit.js
18483   function fit(projection2, fitBounds, object) {
18484     var clip = projection2.clipExtent && projection2.clipExtent();
18485     projection2.scale(150).translate([0, 0]);
18486     if (clip != null)
18487       projection2.clipExtent(null);
18488     stream_default(object, projection2.stream(bounds_default2));
18489     fitBounds(bounds_default2.result());
18490     if (clip != null)
18491       projection2.clipExtent(clip);
18492     return projection2;
18493   }
18494   function fitExtent(projection2, extent, object) {
18495     return fit(projection2, function(b2) {
18496       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;
18497       projection2.scale(150 * k2).translate([x2, y2]);
18498     }, object);
18499   }
18500   function fitSize(projection2, size, object) {
18501     return fitExtent(projection2, [[0, 0], size], object);
18502   }
18503   function fitWidth(projection2, width, object) {
18504     return fit(projection2, function(b2) {
18505       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];
18506       projection2.scale(150 * k2).translate([x2, y2]);
18507     }, object);
18508   }
18509   function fitHeight(projection2, height, object) {
18510     return fit(projection2, function(b2) {
18511       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;
18512       projection2.scale(150 * k2).translate([x2, y2]);
18513     }, object);
18514   }
18515
18516   // node_modules/d3-geo/src/projection/resample.js
18517   var maxDepth = 16;
18518   var cosMinDistance = cos(30 * radians);
18519   function resample_default(project, delta2) {
18520     return +delta2 ? resample(project, delta2) : resampleNone(project);
18521   }
18522   function resampleNone(project) {
18523     return transformer({
18524       point: function(x2, y2) {
18525         x2 = project(x2, y2);
18526         this.stream.point(x2[0], x2[1]);
18527       }
18528     });
18529   }
18530   function resample(project, delta2) {
18531     function resampleLineTo(x05, y05, lambda04, a0, b0, c0, x12, y12, lambda12, a1, b1, c1, depth, stream) {
18532       var dx = x12 - x05, dy = y12 - y05, d2 = dx * dx + dy * dy;
18533       if (d2 > 4 * delta2 && depth--) {
18534         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;
18535         if (dz * dz / d2 > delta2 || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
18536           resampleLineTo(x05, y05, lambda04, a0, b0, c0, x2, y2, lambda22, a2 /= m2, b2 /= m2, c2, depth, stream);
18537           stream.point(x2, y2);
18538           resampleLineTo(x2, y2, lambda22, a2, b2, c2, x12, y12, lambda12, a1, b1, c1, depth, stream);
18539         }
18540       }
18541     }
18542     return function(stream) {
18543       var lambda003, x004, y004, a00, b00, c00, lambda04, x05, y05, a0, b0, c0;
18544       var resampleStream = {
18545         point: point2,
18546         lineStart,
18547         lineEnd,
18548         polygonStart: function() {
18549           stream.polygonStart();
18550           resampleStream.lineStart = ringStart;
18551         },
18552         polygonEnd: function() {
18553           stream.polygonEnd();
18554           resampleStream.lineStart = lineStart;
18555         }
18556       };
18557       function point2(x2, y2) {
18558         x2 = project(x2, y2);
18559         stream.point(x2[0], x2[1]);
18560       }
18561       function lineStart() {
18562         x05 = NaN;
18563         resampleStream.point = linePoint2;
18564         stream.lineStart();
18565       }
18566       function linePoint2(lambda, phi) {
18567         var c2 = cartesian([lambda, phi]), p2 = project(lambda, phi);
18568         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);
18569         stream.point(x05, y05);
18570       }
18571       function lineEnd() {
18572         resampleStream.point = point2;
18573         stream.lineEnd();
18574       }
18575       function ringStart() {
18576         lineStart();
18577         resampleStream.point = ringPoint;
18578         resampleStream.lineEnd = ringEnd;
18579       }
18580       function ringPoint(lambda, phi) {
18581         linePoint2(lambda003 = lambda, phi), x004 = x05, y004 = y05, a00 = a0, b00 = b0, c00 = c0;
18582         resampleStream.point = linePoint2;
18583       }
18584       function ringEnd() {
18585         resampleLineTo(x05, y05, lambda04, a0, b0, c0, x004, y004, lambda003, a00, b00, c00, maxDepth, stream);
18586         resampleStream.lineEnd = lineEnd;
18587         lineEnd();
18588       }
18589       return resampleStream;
18590     };
18591   }
18592
18593   // node_modules/d3-geo/src/projection/index.js
18594   var transformRadians = transformer({
18595     point: function(x2, y2) {
18596       this.stream.point(x2 * radians, y2 * radians);
18597     }
18598   });
18599   function transformRotate(rotate) {
18600     return transformer({
18601       point: function(x2, y2) {
18602         var r2 = rotate(x2, y2);
18603         return this.stream.point(r2[0], r2[1]);
18604       }
18605     });
18606   }
18607   function scaleTranslate(k2, dx, dy, sx, sy) {
18608     function transform2(x2, y2) {
18609       x2 *= sx;
18610       y2 *= sy;
18611       return [dx + k2 * x2, dy - k2 * y2];
18612     }
18613     transform2.invert = function(x2, y2) {
18614       return [(x2 - dx) / k2 * sx, (dy - y2) / k2 * sy];
18615     };
18616     return transform2;
18617   }
18618   function scaleTranslateRotate(k2, dx, dy, sx, sy, alpha) {
18619     if (!alpha)
18620       return scaleTranslate(k2, dx, dy, sx, sy);
18621     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;
18622     function transform2(x2, y2) {
18623       x2 *= sx;
18624       y2 *= sy;
18625       return [a2 * x2 - b2 * y2 + dx, dy - b2 * x2 - a2 * y2];
18626     }
18627     transform2.invert = function(x2, y2) {
18628       return [sx * (ai * x2 - bi * y2 + ci), sy * (fi - bi * x2 - ai * y2)];
18629     };
18630     return transform2;
18631   }
18632   function projection(project) {
18633     return projectionMutator(function() {
18634       return project;
18635     })();
18636   }
18637   function projectionMutator(projectAt) {
18638     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;
18639     function projection2(point2) {
18640       return projectRotateTransform(point2[0] * radians, point2[1] * radians);
18641     }
18642     function invert(point2) {
18643       point2 = projectRotateTransform.invert(point2[0], point2[1]);
18644       return point2 && [point2[0] * degrees, point2[1] * degrees];
18645     }
18646     projection2.stream = function(stream) {
18647       return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
18648     };
18649     projection2.preclip = function(_2) {
18650       return arguments.length ? (preclip = _2, theta = void 0, reset()) : preclip;
18651     };
18652     projection2.postclip = function(_2) {
18653       return arguments.length ? (postclip = _2, x05 = y05 = x12 = y12 = null, reset()) : postclip;
18654     };
18655     projection2.clipAngle = function(_2) {
18656       return arguments.length ? (preclip = +_2 ? circle_default(theta = _2 * radians) : (theta = null, antimeridian_default), reset()) : theta * degrees;
18657     };
18658     projection2.clipExtent = function(_2) {
18659       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]];
18660     };
18661     projection2.scale = function(_2) {
18662       return arguments.length ? (k2 = +_2, recenter()) : k2;
18663     };
18664     projection2.translate = function(_2) {
18665       return arguments.length ? (x2 = +_2[0], y2 = +_2[1], recenter()) : [x2, y2];
18666     };
18667     projection2.center = function(_2) {
18668       return arguments.length ? (lambda = _2[0] % 360 * radians, phi = _2[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
18669     };
18670     projection2.rotate = function(_2) {
18671       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];
18672     };
18673     projection2.angle = function(_2) {
18674       return arguments.length ? (alpha = _2 % 360 * radians, recenter()) : alpha * degrees;
18675     };
18676     projection2.reflectX = function(_2) {
18677       return arguments.length ? (sx = _2 ? -1 : 1, recenter()) : sx < 0;
18678     };
18679     projection2.reflectY = function(_2) {
18680       return arguments.length ? (sy = _2 ? -1 : 1, recenter()) : sy < 0;
18681     };
18682     projection2.precision = function(_2) {
18683       return arguments.length ? (projectResample = resample_default(projectTransform, delta2 = _2 * _2), reset()) : sqrt(delta2);
18684     };
18685     projection2.fitExtent = function(extent, object) {
18686       return fitExtent(projection2, extent, object);
18687     };
18688     projection2.fitSize = function(size, object) {
18689       return fitSize(projection2, size, object);
18690     };
18691     projection2.fitWidth = function(width, object) {
18692       return fitWidth(projection2, width, object);
18693     };
18694     projection2.fitHeight = function(height, object) {
18695       return fitHeight(projection2, height, object);
18696     };
18697     function recenter() {
18698       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);
18699       rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);
18700       projectTransform = compose_default(project, transform2);
18701       projectRotateTransform = compose_default(rotate, projectTransform);
18702       projectResample = resample_default(projectTransform, delta2);
18703       return reset();
18704     }
18705     function reset() {
18706       cache = cacheStream = null;
18707       return projection2;
18708     }
18709     return function() {
18710       project = projectAt.apply(this, arguments);
18711       projection2.invert = project.invert && invert;
18712       return recenter();
18713     };
18714   }
18715
18716   // node_modules/d3-geo/src/projection/mercator.js
18717   function mercatorRaw(lambda, phi) {
18718     return [lambda, log(tan((halfPi + phi) / 2))];
18719   }
18720   mercatorRaw.invert = function(x2, y2) {
18721     return [x2, 2 * atan(exp(y2)) - halfPi];
18722   };
18723   function mercator_default() {
18724     return mercatorProjection(mercatorRaw).scale(961 / tau);
18725   }
18726   function mercatorProjection(project) {
18727     var m2 = projection(project), center = m2.center, scale = m2.scale, translate = m2.translate, clipExtent = m2.clipExtent, x05 = null, y05, x12, y12;
18728     m2.scale = function(_2) {
18729       return arguments.length ? (scale(_2), reclip()) : scale();
18730     };
18731     m2.translate = function(_2) {
18732       return arguments.length ? (translate(_2), reclip()) : translate();
18733     };
18734     m2.center = function(_2) {
18735       return arguments.length ? (center(_2), reclip()) : center();
18736     };
18737     m2.clipExtent = function(_2) {
18738       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]];
18739     };
18740     function reclip() {
18741       var k2 = pi * scale(), t2 = m2(rotation_default(m2.rotate()).invert([0, 0]));
18742       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)]]);
18743     }
18744     return reclip();
18745   }
18746
18747   // node_modules/d3-geo/src/projection/identity.js
18748   function identity_default2() {
18749     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({
18750       point: function(x2, y2) {
18751         var p2 = projection2([x2, y2]);
18752         this.stream.point(p2[0], p2[1]);
18753       }
18754     }), postclip = identity_default, cache, cacheStream;
18755     function reset() {
18756       kx = k2 * sx;
18757       ky = k2 * sy;
18758       cache = cacheStream = null;
18759       return projection2;
18760     }
18761     function projection2(p2) {
18762       var x2 = p2[0] * kx, y2 = p2[1] * ky;
18763       if (alpha) {
18764         var t2 = y2 * ca - x2 * sa;
18765         x2 = x2 * ca + y2 * sa;
18766         y2 = t2;
18767       }
18768       return [x2 + tx, y2 + ty];
18769     }
18770     projection2.invert = function(p2) {
18771       var x2 = p2[0] - tx, y2 = p2[1] - ty;
18772       if (alpha) {
18773         var t2 = y2 * ca + x2 * sa;
18774         x2 = x2 * ca - y2 * sa;
18775         y2 = t2;
18776       }
18777       return [x2 / kx, y2 / ky];
18778     };
18779     projection2.stream = function(stream) {
18780       return cache && cacheStream === stream ? cache : cache = transform2(postclip(cacheStream = stream));
18781     };
18782     projection2.postclip = function(_2) {
18783       return arguments.length ? (postclip = _2, x05 = y05 = x12 = y12 = null, reset()) : postclip;
18784     };
18785     projection2.clipExtent = function(_2) {
18786       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]];
18787     };
18788     projection2.scale = function(_2) {
18789       return arguments.length ? (k2 = +_2, reset()) : k2;
18790     };
18791     projection2.translate = function(_2) {
18792       return arguments.length ? (tx = +_2[0], ty = +_2[1], reset()) : [tx, ty];
18793     };
18794     projection2.angle = function(_2) {
18795       return arguments.length ? (alpha = _2 % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees;
18796     };
18797     projection2.reflectX = function(_2) {
18798       return arguments.length ? (sx = _2 ? -1 : 1, reset()) : sx < 0;
18799     };
18800     projection2.reflectY = function(_2) {
18801       return arguments.length ? (sy = _2 ? -1 : 1, reset()) : sy < 0;
18802     };
18803     projection2.fitExtent = function(extent, object) {
18804       return fitExtent(projection2, extent, object);
18805     };
18806     projection2.fitSize = function(size, object) {
18807       return fitSize(projection2, size, object);
18808     };
18809     projection2.fitWidth = function(width, object) {
18810       return fitWidth(projection2, width, object);
18811     };
18812     projection2.fitHeight = function(height, object) {
18813       return fitHeight(projection2, height, object);
18814     };
18815     return projection2;
18816   }
18817
18818   // modules/geo/geo.js
18819   var TAU = 2 * Math.PI;
18820   var EQUATORIAL_RADIUS = 6378137;
18821   var POLAR_RADIUS = 63567523e-1;
18822   function geoLatToMeters(dLat) {
18823     return dLat * (TAU * POLAR_RADIUS / 360);
18824   }
18825   function geoLonToMeters(dLon, atLat) {
18826     return Math.abs(atLat) >= 90 ? 0 : dLon * (TAU * EQUATORIAL_RADIUS / 360) * Math.abs(Math.cos(atLat * (Math.PI / 180)));
18827   }
18828   function geoMetersToLat(m2) {
18829     return m2 / (TAU * POLAR_RADIUS / 360);
18830   }
18831   function geoMetersToLon(m2, atLat) {
18832     return Math.abs(atLat) >= 90 ? 0 : m2 / (TAU * EQUATORIAL_RADIUS / 360) / Math.abs(Math.cos(atLat * (Math.PI / 180)));
18833   }
18834   function geoMetersToOffset(meters, tileSize) {
18835     tileSize = tileSize || 256;
18836     return [
18837       meters[0] * tileSize / (TAU * EQUATORIAL_RADIUS),
18838       -meters[1] * tileSize / (TAU * POLAR_RADIUS)
18839     ];
18840   }
18841   function geoOffsetToMeters(offset, tileSize) {
18842     tileSize = tileSize || 256;
18843     return [
18844       offset[0] * TAU * EQUATORIAL_RADIUS / tileSize,
18845       -offset[1] * TAU * POLAR_RADIUS / tileSize
18846     ];
18847   }
18848   function geoSphericalDistance(a2, b2) {
18849     var x2 = geoLonToMeters(a2[0] - b2[0], (a2[1] + b2[1]) / 2);
18850     var y2 = geoLatToMeters(a2[1] - b2[1]);
18851     return Math.sqrt(x2 * x2 + y2 * y2);
18852   }
18853   function geoScaleToZoom(k2, tileSize) {
18854     tileSize = tileSize || 256;
18855     var log2ts = Math.log(tileSize) * Math.LOG2E;
18856     return Math.log(k2 * TAU) / Math.LN2 - log2ts;
18857   }
18858   function geoZoomToScale(z2, tileSize) {
18859     tileSize = tileSize || 256;
18860     return tileSize * Math.pow(2, z2) / TAU;
18861   }
18862   function geoSphericalClosestNode(nodes, point2) {
18863     var minDistance = Infinity, distance;
18864     var indexOfMin;
18865     for (var i3 in nodes) {
18866       distance = geoSphericalDistance(nodes[i3].loc, point2);
18867       if (distance < minDistance) {
18868         minDistance = distance;
18869         indexOfMin = i3;
18870       }
18871     }
18872     if (indexOfMin !== void 0) {
18873       return { index: indexOfMin, distance: minDistance, node: nodes[indexOfMin] };
18874     } else {
18875       return null;
18876     }
18877   }
18878
18879   // modules/geo/extent.js
18880   function geoExtent(min3, max3) {
18881     if (!(this instanceof geoExtent)) {
18882       return new geoExtent(min3, max3);
18883     } else if (min3 instanceof geoExtent) {
18884       return min3;
18885     } else if (min3 && min3.length === 2 && min3[0].length === 2 && min3[1].length === 2) {
18886       this[0] = min3[0];
18887       this[1] = min3[1];
18888     } else {
18889       this[0] = min3 || [Infinity, Infinity];
18890       this[1] = max3 || min3 || [-Infinity, -Infinity];
18891     }
18892   }
18893   geoExtent.prototype = new Array(2);
18894   Object.assign(geoExtent.prototype, {
18895     equals: function(obj) {
18896       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];
18897     },
18898     extend: function(obj) {
18899       if (!(obj instanceof geoExtent))
18900         obj = new geoExtent(obj);
18901       return geoExtent(
18902         [Math.min(obj[0][0], this[0][0]), Math.min(obj[0][1], this[0][1])],
18903         [Math.max(obj[1][0], this[1][0]), Math.max(obj[1][1], this[1][1])]
18904       );
18905     },
18906     _extend: function(extent) {
18907       this[0][0] = Math.min(extent[0][0], this[0][0]);
18908       this[0][1] = Math.min(extent[0][1], this[0][1]);
18909       this[1][0] = Math.max(extent[1][0], this[1][0]);
18910       this[1][1] = Math.max(extent[1][1], this[1][1]);
18911     },
18912     area: function() {
18913       return Math.abs((this[1][0] - this[0][0]) * (this[1][1] - this[0][1]));
18914     },
18915     center: function() {
18916       return [(this[0][0] + this[1][0]) / 2, (this[0][1] + this[1][1]) / 2];
18917     },
18918     rectangle: function() {
18919       return [this[0][0], this[0][1], this[1][0], this[1][1]];
18920     },
18921     bbox: function() {
18922       return { minX: this[0][0], minY: this[0][1], maxX: this[1][0], maxY: this[1][1] };
18923     },
18924     polygon: function() {
18925       return [
18926         [this[0][0], this[0][1]],
18927         [this[0][0], this[1][1]],
18928         [this[1][0], this[1][1]],
18929         [this[1][0], this[0][1]],
18930         [this[0][0], this[0][1]]
18931       ];
18932     },
18933     contains: function(obj) {
18934       if (!(obj instanceof geoExtent))
18935         obj = new geoExtent(obj);
18936       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];
18937     },
18938     intersects: function(obj) {
18939       if (!(obj instanceof geoExtent))
18940         obj = new geoExtent(obj);
18941       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];
18942     },
18943     intersection: function(obj) {
18944       if (!this.intersects(obj))
18945         return new geoExtent();
18946       return new geoExtent(
18947         [Math.max(obj[0][0], this[0][0]), Math.max(obj[0][1], this[0][1])],
18948         [Math.min(obj[1][0], this[1][0]), Math.min(obj[1][1], this[1][1])]
18949       );
18950     },
18951     percentContainedIn: function(obj) {
18952       if (!(obj instanceof geoExtent))
18953         obj = new geoExtent(obj);
18954       var a1 = this.intersection(obj).area();
18955       var a2 = this.area();
18956       if (a1 === Infinity || a2 === Infinity) {
18957         return 0;
18958       } else if (a1 === 0 || a2 === 0) {
18959         if (obj.contains(this)) {
18960           return 1;
18961         }
18962         return 0;
18963       } else {
18964         return a1 / a2;
18965       }
18966     },
18967     padByMeters: function(meters) {
18968       var dLat = geoMetersToLat(meters);
18969       var dLon = geoMetersToLon(meters, this.center()[1]);
18970       return geoExtent(
18971         [this[0][0] - dLon, this[0][1] - dLat],
18972         [this[1][0] + dLon, this[1][1] + dLat]
18973       );
18974     },
18975     toParam: function() {
18976       return this.rectangle().join(",");
18977     }
18978   });
18979
18980   // node_modules/d3-polygon/src/area.js
18981   function area_default3(polygon2) {
18982     var i3 = -1, n3 = polygon2.length, a2, b2 = polygon2[n3 - 1], area = 0;
18983     while (++i3 < n3) {
18984       a2 = b2;
18985       b2 = polygon2[i3];
18986       area += a2[1] * b2[0] - a2[0] * b2[1];
18987     }
18988     return area / 2;
18989   }
18990
18991   // node_modules/d3-polygon/src/centroid.js
18992   function centroid_default2(polygon2) {
18993     var i3 = -1, n3 = polygon2.length, x2 = 0, y2 = 0, a2, b2 = polygon2[n3 - 1], c2, k2 = 0;
18994     while (++i3 < n3) {
18995       a2 = b2;
18996       b2 = polygon2[i3];
18997       k2 += c2 = a2[0] * b2[1] - b2[0] * a2[1];
18998       x2 += (a2[0] + b2[0]) * c2;
18999       y2 += (a2[1] + b2[1]) * c2;
19000     }
19001     return k2 *= 3, [x2 / k2, y2 / k2];
19002   }
19003
19004   // node_modules/d3-polygon/src/cross.js
19005   function cross_default(a2, b2, c2) {
19006     return (b2[0] - a2[0]) * (c2[1] - a2[1]) - (b2[1] - a2[1]) * (c2[0] - a2[0]);
19007   }
19008
19009   // node_modules/d3-polygon/src/hull.js
19010   function lexicographicOrder(a2, b2) {
19011     return a2[0] - b2[0] || a2[1] - b2[1];
19012   }
19013   function computeUpperHullIndexes(points) {
19014     const n3 = points.length, indexes = [0, 1];
19015     let size = 2, i3;
19016     for (i3 = 2; i3 < n3; ++i3) {
19017       while (size > 1 && cross_default(points[indexes[size - 2]], points[indexes[size - 1]], points[i3]) <= 0)
19018         --size;
19019       indexes[size++] = i3;
19020     }
19021     return indexes.slice(0, size);
19022   }
19023   function hull_default(points) {
19024     if ((n3 = points.length) < 3)
19025       return null;
19026     var i3, n3, sortedPoints = new Array(n3), flippedPoints = new Array(n3);
19027     for (i3 = 0; i3 < n3; ++i3)
19028       sortedPoints[i3] = [+points[i3][0], +points[i3][1], i3];
19029     sortedPoints.sort(lexicographicOrder);
19030     for (i3 = 0; i3 < n3; ++i3)
19031       flippedPoints[i3] = [sortedPoints[i3][0], -sortedPoints[i3][1]];
19032     var upperIndexes = computeUpperHullIndexes(sortedPoints), lowerIndexes = computeUpperHullIndexes(flippedPoints);
19033     var skipLeft = lowerIndexes[0] === upperIndexes[0], skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1], hull = [];
19034     for (i3 = upperIndexes.length - 1; i3 >= 0; --i3)
19035       hull.push(points[sortedPoints[upperIndexes[i3]][2]]);
19036     for (i3 = +skipLeft; i3 < lowerIndexes.length - skipRight; ++i3)
19037       hull.push(points[sortedPoints[lowerIndexes[i3]][2]]);
19038     return hull;
19039   }
19040
19041   // modules/geo/vector.js
19042   function geoVecEqual(a2, b2, epsilon3) {
19043     if (epsilon3) {
19044       return Math.abs(a2[0] - b2[0]) <= epsilon3 && Math.abs(a2[1] - b2[1]) <= epsilon3;
19045     } else {
19046       return a2[0] === b2[0] && a2[1] === b2[1];
19047     }
19048   }
19049   function geoVecAdd(a2, b2) {
19050     return [a2[0] + b2[0], a2[1] + b2[1]];
19051   }
19052   function geoVecSubtract(a2, b2) {
19053     return [a2[0] - b2[0], a2[1] - b2[1]];
19054   }
19055   function geoVecScale(a2, mag) {
19056     return [a2[0] * mag, a2[1] * mag];
19057   }
19058   function geoVecFloor(a2) {
19059     return [Math.floor(a2[0]), Math.floor(a2[1])];
19060   }
19061   function geoVecInterp(a2, b2, t2) {
19062     return [
19063       a2[0] + (b2[0] - a2[0]) * t2,
19064       a2[1] + (b2[1] - a2[1]) * t2
19065     ];
19066   }
19067   function geoVecLength(a2, b2) {
19068     return Math.sqrt(geoVecLengthSquare(a2, b2));
19069   }
19070   function geoVecLengthSquare(a2, b2) {
19071     b2 = b2 || [0, 0];
19072     var x2 = a2[0] - b2[0];
19073     var y2 = a2[1] - b2[1];
19074     return x2 * x2 + y2 * y2;
19075   }
19076   function geoVecNormalize(a2) {
19077     var length = Math.sqrt(a2[0] * a2[0] + a2[1] * a2[1]);
19078     if (length !== 0) {
19079       return geoVecScale(a2, 1 / length);
19080     }
19081     return [0, 0];
19082   }
19083   function geoVecAngle(a2, b2) {
19084     return Math.atan2(b2[1] - a2[1], b2[0] - a2[0]);
19085   }
19086   function geoVecDot(a2, b2, origin) {
19087     origin = origin || [0, 0];
19088     var p2 = geoVecSubtract(a2, origin);
19089     var q2 = geoVecSubtract(b2, origin);
19090     return p2[0] * q2[0] + p2[1] * q2[1];
19091   }
19092   function geoVecNormalizedDot(a2, b2, origin) {
19093     origin = origin || [0, 0];
19094     var p2 = geoVecNormalize(geoVecSubtract(a2, origin));
19095     var q2 = geoVecNormalize(geoVecSubtract(b2, origin));
19096     return geoVecDot(p2, q2);
19097   }
19098   function geoVecCross(a2, b2, origin) {
19099     origin = origin || [0, 0];
19100     var p2 = geoVecSubtract(a2, origin);
19101     var q2 = geoVecSubtract(b2, origin);
19102     return p2[0] * q2[1] - p2[1] * q2[0];
19103   }
19104   function geoVecProject(a2, points) {
19105     var min3 = Infinity;
19106     var idx;
19107     var target;
19108     for (var i3 = 0; i3 < points.length - 1; i3++) {
19109       var o2 = points[i3];
19110       var s2 = geoVecSubtract(points[i3 + 1], o2);
19111       var v2 = geoVecSubtract(a2, o2);
19112       var proj = geoVecDot(v2, s2) / geoVecDot(s2, s2);
19113       var p2;
19114       if (proj < 0) {
19115         p2 = o2;
19116       } else if (proj > 1) {
19117         p2 = points[i3 + 1];
19118       } else {
19119         p2 = [o2[0] + proj * s2[0], o2[1] + proj * s2[1]];
19120       }
19121       var dist = geoVecLength(p2, a2);
19122       if (dist < min3) {
19123         min3 = dist;
19124         idx = i3 + 1;
19125         target = p2;
19126       }
19127     }
19128     if (idx !== void 0) {
19129       return { index: idx, distance: min3, target };
19130     } else {
19131       return null;
19132     }
19133   }
19134
19135   // modules/geo/geom.js
19136   function geoAngle(a2, b2, projection2) {
19137     return geoVecAngle(projection2(a2.loc), projection2(b2.loc));
19138   }
19139   function geoEdgeEqual(a2, b2) {
19140     return a2[0] === b2[0] && a2[1] === b2[1] || a2[0] === b2[1] && a2[1] === b2[0];
19141   }
19142   function geoRotate(points, angle2, around) {
19143     return points.map(function(point2) {
19144       var radial = geoVecSubtract(point2, around);
19145       return [
19146         radial[0] * Math.cos(angle2) - radial[1] * Math.sin(angle2) + around[0],
19147         radial[0] * Math.sin(angle2) + radial[1] * Math.cos(angle2) + around[1]
19148       ];
19149     });
19150   }
19151   function geoChooseEdge(nodes, point2, projection2, activeID) {
19152     var dist = geoVecLength;
19153     var points = nodes.map(function(n3) {
19154       return projection2(n3.loc);
19155     });
19156     var ids = nodes.map(function(n3) {
19157       return n3.id;
19158     });
19159     var min3 = Infinity;
19160     var idx;
19161     var loc;
19162     for (var i3 = 0; i3 < points.length - 1; i3++) {
19163       if (ids[i3] === activeID || ids[i3 + 1] === activeID)
19164         continue;
19165       var o2 = points[i3];
19166       var s2 = geoVecSubtract(points[i3 + 1], o2);
19167       var v2 = geoVecSubtract(point2, o2);
19168       var proj = geoVecDot(v2, s2) / geoVecDot(s2, s2);
19169       var p2;
19170       if (proj < 0) {
19171         p2 = o2;
19172       } else if (proj > 1) {
19173         p2 = points[i3 + 1];
19174       } else {
19175         p2 = [o2[0] + proj * s2[0], o2[1] + proj * s2[1]];
19176       }
19177       var d2 = dist(p2, point2);
19178       if (d2 < min3) {
19179         min3 = d2;
19180         idx = i3 + 1;
19181         loc = projection2.invert(p2);
19182       }
19183     }
19184     if (idx !== void 0) {
19185       return { index: idx, distance: min3, loc };
19186     } else {
19187       return null;
19188     }
19189   }
19190   function geoHasLineIntersections(activeNodes, inactiveNodes, activeID) {
19191     var actives = [];
19192     var inactives = [];
19193     var j3, k2, n1, n22, segment;
19194     for (j3 = 0; j3 < activeNodes.length - 1; j3++) {
19195       n1 = activeNodes[j3];
19196       n22 = activeNodes[j3 + 1];
19197       segment = [n1.loc, n22.loc];
19198       if (n1.id === activeID || n22.id === activeID) {
19199         actives.push(segment);
19200       }
19201     }
19202     for (j3 = 0; j3 < inactiveNodes.length - 1; j3++) {
19203       n1 = inactiveNodes[j3];
19204       n22 = inactiveNodes[j3 + 1];
19205       segment = [n1.loc, n22.loc];
19206       inactives.push(segment);
19207     }
19208     for (j3 = 0; j3 < actives.length; j3++) {
19209       for (k2 = 0; k2 < inactives.length; k2++) {
19210         var p2 = actives[j3];
19211         var q2 = inactives[k2];
19212         var hit = geoLineIntersection(p2, q2);
19213         if (hit) {
19214           return true;
19215         }
19216       }
19217     }
19218     return false;
19219   }
19220   function geoHasSelfIntersections(nodes, activeID) {
19221     var actives = [];
19222     var inactives = [];
19223     var j3, k2;
19224     for (j3 = 0; j3 < nodes.length - 1; j3++) {
19225       var n1 = nodes[j3];
19226       var n22 = nodes[j3 + 1];
19227       var segment = [n1.loc, n22.loc];
19228       if (n1.id === activeID || n22.id === activeID) {
19229         actives.push(segment);
19230       } else {
19231         inactives.push(segment);
19232       }
19233     }
19234     for (j3 = 0; j3 < actives.length; j3++) {
19235       for (k2 = 0; k2 < inactives.length; k2++) {
19236         var p2 = actives[j3];
19237         var q2 = inactives[k2];
19238         if (geoVecEqual(p2[1], q2[0]) || geoVecEqual(p2[0], q2[1]) || geoVecEqual(p2[0], q2[0]) || geoVecEqual(p2[1], q2[1])) {
19239           continue;
19240         }
19241         var hit = geoLineIntersection(p2, q2);
19242         if (hit) {
19243           var epsilon3 = 1e-8;
19244           if (geoVecEqual(p2[1], hit, epsilon3) || geoVecEqual(p2[0], hit, epsilon3) || geoVecEqual(q2[1], hit, epsilon3) || geoVecEqual(q2[0], hit, epsilon3)) {
19245             continue;
19246           } else {
19247             return true;
19248           }
19249         }
19250       }
19251     }
19252     return false;
19253   }
19254   function geoLineIntersection(a2, b2) {
19255     var p2 = [a2[0][0], a2[0][1]];
19256     var p22 = [a2[1][0], a2[1][1]];
19257     var q2 = [b2[0][0], b2[0][1]];
19258     var q22 = [b2[1][0], b2[1][1]];
19259     var r2 = geoVecSubtract(p22, p2);
19260     var s2 = geoVecSubtract(q22, q2);
19261     var uNumerator = geoVecCross(geoVecSubtract(q2, p2), r2);
19262     var denominator = geoVecCross(r2, s2);
19263     if (uNumerator && denominator) {
19264       var u2 = uNumerator / denominator;
19265       var t2 = geoVecCross(geoVecSubtract(q2, p2), s2) / denominator;
19266       if (t2 >= 0 && t2 <= 1 && u2 >= 0 && u2 <= 1) {
19267         return geoVecInterp(p2, p22, t2);
19268       }
19269     }
19270     return null;
19271   }
19272   function geoPathIntersections(path1, path2) {
19273     var intersections = [];
19274     for (var i3 = 0; i3 < path1.length - 1; i3++) {
19275       for (var j3 = 0; j3 < path2.length - 1; j3++) {
19276         var a2 = [path1[i3], path1[i3 + 1]];
19277         var b2 = [path2[j3], path2[j3 + 1]];
19278         var hit = geoLineIntersection(a2, b2);
19279         if (hit) {
19280           intersections.push(hit);
19281         }
19282       }
19283     }
19284     return intersections;
19285   }
19286   function geoPathHasIntersections(path1, path2) {
19287     for (var i3 = 0; i3 < path1.length - 1; i3++) {
19288       for (var j3 = 0; j3 < path2.length - 1; j3++) {
19289         var a2 = [path1[i3], path1[i3 + 1]];
19290         var b2 = [path2[j3], path2[j3 + 1]];
19291         var hit = geoLineIntersection(a2, b2);
19292         if (hit) {
19293           return true;
19294         }
19295       }
19296     }
19297     return false;
19298   }
19299   function geoPointInPolygon(point2, polygon2) {
19300     var x2 = point2[0];
19301     var y2 = point2[1];
19302     var inside = false;
19303     for (var i3 = 0, j3 = polygon2.length - 1; i3 < polygon2.length; j3 = i3++) {
19304       var xi = polygon2[i3][0];
19305       var yi = polygon2[i3][1];
19306       var xj = polygon2[j3][0];
19307       var yj = polygon2[j3][1];
19308       var intersect2 = yi > y2 !== yj > y2 && x2 < (xj - xi) * (y2 - yi) / (yj - yi) + xi;
19309       if (intersect2)
19310         inside = !inside;
19311     }
19312     return inside;
19313   }
19314   function geoPolygonContainsPolygon(outer, inner) {
19315     return inner.every(function(point2) {
19316       return geoPointInPolygon(point2, outer);
19317     });
19318   }
19319   function geoPolygonIntersectsPolygon(outer, inner, checkSegments) {
19320     function testPoints(outer2, inner2) {
19321       return inner2.some(function(point2) {
19322         return geoPointInPolygon(point2, outer2);
19323       });
19324     }
19325     return testPoints(outer, inner) || !!checkSegments && geoPathHasIntersections(outer, inner);
19326   }
19327   function geoGetSmallestSurroundingRectangle(points) {
19328     var hull = hull_default(points);
19329     var centroid = centroid_default2(hull);
19330     var minArea = Infinity;
19331     var ssrExtent = [];
19332     var ssrAngle = 0;
19333     var c1 = hull[0];
19334     for (var i3 = 0; i3 <= hull.length - 1; i3++) {
19335       var c2 = i3 === hull.length - 1 ? hull[0] : hull[i3 + 1];
19336       var angle2 = Math.atan2(c2[1] - c1[1], c2[0] - c1[0]);
19337       var poly = geoRotate(hull, -angle2, centroid);
19338       var extent = poly.reduce(function(extent2, point2) {
19339         return extent2.extend(geoExtent(point2));
19340       }, geoExtent());
19341       var area = extent.area();
19342       if (area < minArea) {
19343         minArea = area;
19344         ssrExtent = extent;
19345         ssrAngle = angle2;
19346       }
19347       c1 = c2;
19348     }
19349     return {
19350       poly: geoRotate(ssrExtent.polygon(), ssrAngle, centroid),
19351       angle: ssrAngle
19352     };
19353   }
19354   function geoPathLength(path) {
19355     var length = 0;
19356     for (var i3 = 0; i3 < path.length - 1; i3++) {
19357       length += geoVecLength(path[i3], path[i3 + 1]);
19358     }
19359     return length;
19360   }
19361   function geoViewportEdge(point2, dimensions) {
19362     var pad2 = [80, 20, 50, 20];
19363     var x2 = 0;
19364     var y2 = 0;
19365     if (point2[0] > dimensions[0] - pad2[1]) {
19366       x2 = -10;
19367     }
19368     if (point2[0] < pad2[3]) {
19369       x2 = 10;
19370     }
19371     if (point2[1] > dimensions[1] - pad2[2]) {
19372       y2 = -10;
19373     }
19374     if (point2[1] < pad2[0]) {
19375       y2 = 10;
19376     }
19377     if (x2 || y2) {
19378       return [x2, y2];
19379     } else {
19380       return null;
19381     }
19382   }
19383
19384   // node_modules/d3-dispatch/src/dispatch.js
19385   var noop2 = { value: () => {
19386   } };
19387   function dispatch() {
19388     for (var i3 = 0, n3 = arguments.length, _2 = {}, t2; i3 < n3; ++i3) {
19389       if (!(t2 = arguments[i3] + "") || t2 in _2 || /[\s.]/.test(t2))
19390         throw new Error("illegal type: " + t2);
19391       _2[t2] = [];
19392     }
19393     return new Dispatch(_2);
19394   }
19395   function Dispatch(_2) {
19396     this._ = _2;
19397   }
19398   function parseTypenames(typenames, types) {
19399     return typenames.trim().split(/^|\s+/).map(function(t2) {
19400       var name = "", i3 = t2.indexOf(".");
19401       if (i3 >= 0)
19402         name = t2.slice(i3 + 1), t2 = t2.slice(0, i3);
19403       if (t2 && !types.hasOwnProperty(t2))
19404         throw new Error("unknown type: " + t2);
19405       return { type: t2, name };
19406     });
19407   }
19408   Dispatch.prototype = dispatch.prototype = {
19409     constructor: Dispatch,
19410     on: function(typename, callback) {
19411       var _2 = this._, T2 = parseTypenames(typename + "", _2), t2, i3 = -1, n3 = T2.length;
19412       if (arguments.length < 2) {
19413         while (++i3 < n3)
19414           if ((t2 = (typename = T2[i3]).type) && (t2 = get(_2[t2], typename.name)))
19415             return t2;
19416         return;
19417       }
19418       if (callback != null && typeof callback !== "function")
19419         throw new Error("invalid callback: " + callback);
19420       while (++i3 < n3) {
19421         if (t2 = (typename = T2[i3]).type)
19422           _2[t2] = set(_2[t2], typename.name, callback);
19423         else if (callback == null)
19424           for (t2 in _2)
19425             _2[t2] = set(_2[t2], typename.name, null);
19426       }
19427       return this;
19428     },
19429     copy: function() {
19430       var copy2 = {}, _2 = this._;
19431       for (var t2 in _2)
19432         copy2[t2] = _2[t2].slice();
19433       return new Dispatch(copy2);
19434     },
19435     call: function(type2, that) {
19436       if ((n3 = arguments.length - 2) > 0)
19437         for (var args = new Array(n3), i3 = 0, n3, t2; i3 < n3; ++i3)
19438           args[i3] = arguments[i3 + 2];
19439       if (!this._.hasOwnProperty(type2))
19440         throw new Error("unknown type: " + type2);
19441       for (t2 = this._[type2], i3 = 0, n3 = t2.length; i3 < n3; ++i3)
19442         t2[i3].value.apply(that, args);
19443     },
19444     apply: function(type2, that, args) {
19445       if (!this._.hasOwnProperty(type2))
19446         throw new Error("unknown type: " + type2);
19447       for (var t2 = this._[type2], i3 = 0, n3 = t2.length; i3 < n3; ++i3)
19448         t2[i3].value.apply(that, args);
19449     }
19450   };
19451   function get(type2, name) {
19452     for (var i3 = 0, n3 = type2.length, c2; i3 < n3; ++i3) {
19453       if ((c2 = type2[i3]).name === name) {
19454         return c2.value;
19455       }
19456     }
19457   }
19458   function set(type2, name, callback) {
19459     for (var i3 = 0, n3 = type2.length; i3 < n3; ++i3) {
19460       if (type2[i3].name === name) {
19461         type2[i3] = noop2, type2 = type2.slice(0, i3).concat(type2.slice(i3 + 1));
19462         break;
19463       }
19464     }
19465     if (callback != null)
19466       type2.push({ name, value: callback });
19467     return type2;
19468   }
19469   var dispatch_default = dispatch;
19470
19471   // node_modules/d3-selection/src/namespaces.js
19472   var xhtml = "http://www.w3.org/1999/xhtml";
19473   var namespaces_default = {
19474     svg: "http://www.w3.org/2000/svg",
19475     xhtml,
19476     xlink: "http://www.w3.org/1999/xlink",
19477     xml: "http://www.w3.org/XML/1998/namespace",
19478     xmlns: "http://www.w3.org/2000/xmlns/"
19479   };
19480
19481   // node_modules/d3-selection/src/namespace.js
19482   function namespace_default(name) {
19483     var prefix = name += "", i3 = prefix.indexOf(":");
19484     if (i3 >= 0 && (prefix = name.slice(0, i3)) !== "xmlns")
19485       name = name.slice(i3 + 1);
19486     return namespaces_default.hasOwnProperty(prefix) ? { space: namespaces_default[prefix], local: name } : name;
19487   }
19488
19489   // node_modules/d3-selection/src/creator.js
19490   function creatorInherit(name) {
19491     return function() {
19492       var document2 = this.ownerDocument, uri = this.namespaceURI;
19493       return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name);
19494     };
19495   }
19496   function creatorFixed(fullname) {
19497     return function() {
19498       return this.ownerDocument.createElementNS(fullname.space, fullname.local);
19499     };
19500   }
19501   function creator_default(name) {
19502     var fullname = namespace_default(name);
19503     return (fullname.local ? creatorFixed : creatorInherit)(fullname);
19504   }
19505
19506   // node_modules/d3-selection/src/selector.js
19507   function none() {
19508   }
19509   function selector_default(selector) {
19510     return selector == null ? none : function() {
19511       return this.querySelector(selector);
19512     };
19513   }
19514
19515   // node_modules/d3-selection/src/selection/select.js
19516   function select_default(select) {
19517     if (typeof select !== "function")
19518       select = selector_default(select);
19519     for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j3 = 0; j3 < m2; ++j3) {
19520       for (var group = groups[j3], n3 = group.length, subgroup = subgroups[j3] = new Array(n3), node, subnode, i3 = 0; i3 < n3; ++i3) {
19521         if ((node = group[i3]) && (subnode = select.call(node, node.__data__, i3, group))) {
19522           if ("__data__" in node)
19523             subnode.__data__ = node.__data__;
19524           subgroup[i3] = subnode;
19525         }
19526       }
19527     }
19528     return new Selection(subgroups, this._parents);
19529   }
19530
19531   // node_modules/d3-selection/src/array.js
19532   function array(x2) {
19533     return x2 == null ? [] : Array.isArray(x2) ? x2 : Array.from(x2);
19534   }
19535
19536   // node_modules/d3-selection/src/selectorAll.js
19537   function empty() {
19538     return [];
19539   }
19540   function selectorAll_default(selector) {
19541     return selector == null ? empty : function() {
19542       return this.querySelectorAll(selector);
19543     };
19544   }
19545
19546   // node_modules/d3-selection/src/selection/selectAll.js
19547   function arrayAll(select) {
19548     return function() {
19549       return array(select.apply(this, arguments));
19550     };
19551   }
19552   function selectAll_default(select) {
19553     if (typeof select === "function")
19554       select = arrayAll(select);
19555     else
19556       select = selectorAll_default(select);
19557     for (var groups = this._groups, m2 = groups.length, subgroups = [], parents = [], j3 = 0; j3 < m2; ++j3) {
19558       for (var group = groups[j3], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
19559         if (node = group[i3]) {
19560           subgroups.push(select.call(node, node.__data__, i3, group));
19561           parents.push(node);
19562         }
19563       }
19564     }
19565     return new Selection(subgroups, parents);
19566   }
19567
19568   // node_modules/d3-selection/src/matcher.js
19569   function matcher_default(selector) {
19570     return function() {
19571       return this.matches(selector);
19572     };
19573   }
19574   function childMatcher(selector) {
19575     return function(node) {
19576       return node.matches(selector);
19577     };
19578   }
19579
19580   // node_modules/d3-selection/src/selection/selectChild.js
19581   var find = Array.prototype.find;
19582   function childFind(match) {
19583     return function() {
19584       return find.call(this.children, match);
19585     };
19586   }
19587   function childFirst() {
19588     return this.firstElementChild;
19589   }
19590   function selectChild_default(match) {
19591     return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
19592   }
19593
19594   // node_modules/d3-selection/src/selection/selectChildren.js
19595   var filter = Array.prototype.filter;
19596   function children() {
19597     return Array.from(this.children);
19598   }
19599   function childrenFilter(match) {
19600     return function() {
19601       return filter.call(this.children, match);
19602     };
19603   }
19604   function selectChildren_default(match) {
19605     return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
19606   }
19607
19608   // node_modules/d3-selection/src/selection/filter.js
19609   function filter_default(match) {
19610     if (typeof match !== "function")
19611       match = matcher_default(match);
19612     for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j3 = 0; j3 < m2; ++j3) {
19613       for (var group = groups[j3], n3 = group.length, subgroup = subgroups[j3] = [], node, i3 = 0; i3 < n3; ++i3) {
19614         if ((node = group[i3]) && match.call(node, node.__data__, i3, group)) {
19615           subgroup.push(node);
19616         }
19617       }
19618     }
19619     return new Selection(subgroups, this._parents);
19620   }
19621
19622   // node_modules/d3-selection/src/selection/sparse.js
19623   function sparse_default(update) {
19624     return new Array(update.length);
19625   }
19626
19627   // node_modules/d3-selection/src/selection/enter.js
19628   function enter_default() {
19629     return new Selection(this._enter || this._groups.map(sparse_default), this._parents);
19630   }
19631   function EnterNode(parent, datum2) {
19632     this.ownerDocument = parent.ownerDocument;
19633     this.namespaceURI = parent.namespaceURI;
19634     this._next = null;
19635     this._parent = parent;
19636     this.__data__ = datum2;
19637   }
19638   EnterNode.prototype = {
19639     constructor: EnterNode,
19640     appendChild: function(child) {
19641       return this._parent.insertBefore(child, this._next);
19642     },
19643     insertBefore: function(child, next) {
19644       return this._parent.insertBefore(child, next);
19645     },
19646     querySelector: function(selector) {
19647       return this._parent.querySelector(selector);
19648     },
19649     querySelectorAll: function(selector) {
19650       return this._parent.querySelectorAll(selector);
19651     }
19652   };
19653
19654   // node_modules/d3-selection/src/constant.js
19655   function constant_default(x2) {
19656     return function() {
19657       return x2;
19658     };
19659   }
19660
19661   // node_modules/d3-selection/src/selection/data.js
19662   function bindIndex(parent, group, enter, update, exit, data) {
19663     var i3 = 0, node, groupLength = group.length, dataLength = data.length;
19664     for (; i3 < dataLength; ++i3) {
19665       if (node = group[i3]) {
19666         node.__data__ = data[i3];
19667         update[i3] = node;
19668       } else {
19669         enter[i3] = new EnterNode(parent, data[i3]);
19670       }
19671     }
19672     for (; i3 < groupLength; ++i3) {
19673       if (node = group[i3]) {
19674         exit[i3] = node;
19675       }
19676     }
19677   }
19678   function bindKey(parent, group, enter, update, exit, data, key) {
19679     var i3, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
19680     for (i3 = 0; i3 < groupLength; ++i3) {
19681       if (node = group[i3]) {
19682         keyValues[i3] = keyValue = key.call(node, node.__data__, i3, group) + "";
19683         if (nodeByKeyValue.has(keyValue)) {
19684           exit[i3] = node;
19685         } else {
19686           nodeByKeyValue.set(keyValue, node);
19687         }
19688       }
19689     }
19690     for (i3 = 0; i3 < dataLength; ++i3) {
19691       keyValue = key.call(parent, data[i3], i3, data) + "";
19692       if (node = nodeByKeyValue.get(keyValue)) {
19693         update[i3] = node;
19694         node.__data__ = data[i3];
19695         nodeByKeyValue.delete(keyValue);
19696       } else {
19697         enter[i3] = new EnterNode(parent, data[i3]);
19698       }
19699     }
19700     for (i3 = 0; i3 < groupLength; ++i3) {
19701       if ((node = group[i3]) && nodeByKeyValue.get(keyValues[i3]) === node) {
19702         exit[i3] = node;
19703       }
19704     }
19705   }
19706   function datum(node) {
19707     return node.__data__;
19708   }
19709   function data_default(value, key) {
19710     if (!arguments.length)
19711       return Array.from(this, datum);
19712     var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
19713     if (typeof value !== "function")
19714       value = constant_default(value);
19715     for (var m2 = groups.length, update = new Array(m2), enter = new Array(m2), exit = new Array(m2), j3 = 0; j3 < m2; ++j3) {
19716       var parent = parents[j3], group = groups[j3], groupLength = group.length, data = arraylike(value.call(parent, parent && parent.__data__, j3, parents)), dataLength = data.length, enterGroup = enter[j3] = new Array(dataLength), updateGroup = update[j3] = new Array(dataLength), exitGroup = exit[j3] = new Array(groupLength);
19717       bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
19718       for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
19719         if (previous = enterGroup[i0]) {
19720           if (i0 >= i1)
19721             i1 = i0 + 1;
19722           while (!(next = updateGroup[i1]) && ++i1 < dataLength)
19723             ;
19724           previous._next = next || null;
19725         }
19726       }
19727     }
19728     update = new Selection(update, parents);
19729     update._enter = enter;
19730     update._exit = exit;
19731     return update;
19732   }
19733   function arraylike(data) {
19734     return typeof data === "object" && "length" in data ? data : Array.from(data);
19735   }
19736
19737   // node_modules/d3-selection/src/selection/exit.js
19738   function exit_default() {
19739     return new Selection(this._exit || this._groups.map(sparse_default), this._parents);
19740   }
19741
19742   // node_modules/d3-selection/src/selection/join.js
19743   function join_default(onenter, onupdate, onexit) {
19744     var enter = this.enter(), update = this, exit = this.exit();
19745     if (typeof onenter === "function") {
19746       enter = onenter(enter);
19747       if (enter)
19748         enter = enter.selection();
19749     } else {
19750       enter = enter.append(onenter + "");
19751     }
19752     if (onupdate != null) {
19753       update = onupdate(update);
19754       if (update)
19755         update = update.selection();
19756     }
19757     if (onexit == null)
19758       exit.remove();
19759     else
19760       onexit(exit);
19761     return enter && update ? enter.merge(update).order() : update;
19762   }
19763
19764   // node_modules/d3-selection/src/selection/merge.js
19765   function merge_default(context) {
19766     var selection2 = context.selection ? context.selection() : context;
19767     for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m2 = Math.min(m0, m1), merges = new Array(m0), j3 = 0; j3 < m2; ++j3) {
19768       for (var group0 = groups0[j3], group1 = groups1[j3], n3 = group0.length, merge2 = merges[j3] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
19769         if (node = group0[i3] || group1[i3]) {
19770           merge2[i3] = node;
19771         }
19772       }
19773     }
19774     for (; j3 < m0; ++j3) {
19775       merges[j3] = groups0[j3];
19776     }
19777     return new Selection(merges, this._parents);
19778   }
19779
19780   // node_modules/d3-selection/src/selection/order.js
19781   function order_default() {
19782     for (var groups = this._groups, j3 = -1, m2 = groups.length; ++j3 < m2; ) {
19783       for (var group = groups[j3], i3 = group.length - 1, next = group[i3], node; --i3 >= 0; ) {
19784         if (node = group[i3]) {
19785           if (next && node.compareDocumentPosition(next) ^ 4)
19786             next.parentNode.insertBefore(node, next);
19787           next = node;
19788         }
19789       }
19790     }
19791     return this;
19792   }
19793
19794   // node_modules/d3-selection/src/selection/sort.js
19795   function sort_default(compare) {
19796     if (!compare)
19797       compare = ascending2;
19798     function compareNode(a2, b2) {
19799       return a2 && b2 ? compare(a2.__data__, b2.__data__) : !a2 - !b2;
19800     }
19801     for (var groups = this._groups, m2 = groups.length, sortgroups = new Array(m2), j3 = 0; j3 < m2; ++j3) {
19802       for (var group = groups[j3], n3 = group.length, sortgroup = sortgroups[j3] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
19803         if (node = group[i3]) {
19804           sortgroup[i3] = node;
19805         }
19806       }
19807       sortgroup.sort(compareNode);
19808     }
19809     return new Selection(sortgroups, this._parents).order();
19810   }
19811   function ascending2(a2, b2) {
19812     return a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 0 : NaN;
19813   }
19814
19815   // node_modules/d3-selection/src/selection/call.js
19816   function call_default() {
19817     var callback = arguments[0];
19818     arguments[0] = this;
19819     callback.apply(null, arguments);
19820     return this;
19821   }
19822
19823   // node_modules/d3-selection/src/selection/nodes.js
19824   function nodes_default() {
19825     return Array.from(this);
19826   }
19827
19828   // node_modules/d3-selection/src/selection/node.js
19829   function node_default() {
19830     for (var groups = this._groups, j3 = 0, m2 = groups.length; j3 < m2; ++j3) {
19831       for (var group = groups[j3], i3 = 0, n3 = group.length; i3 < n3; ++i3) {
19832         var node = group[i3];
19833         if (node)
19834           return node;
19835       }
19836     }
19837     return null;
19838   }
19839
19840   // node_modules/d3-selection/src/selection/size.js
19841   function size_default() {
19842     let size = 0;
19843     for (const node of this)
19844       ++size;
19845     return size;
19846   }
19847
19848   // node_modules/d3-selection/src/selection/empty.js
19849   function empty_default() {
19850     return !this.node();
19851   }
19852
19853   // node_modules/d3-selection/src/selection/each.js
19854   function each_default(callback) {
19855     for (var groups = this._groups, j3 = 0, m2 = groups.length; j3 < m2; ++j3) {
19856       for (var group = groups[j3], i3 = 0, n3 = group.length, node; i3 < n3; ++i3) {
19857         if (node = group[i3])
19858           callback.call(node, node.__data__, i3, group);
19859       }
19860     }
19861     return this;
19862   }
19863
19864   // node_modules/d3-selection/src/selection/attr.js
19865   function attrRemove(name) {
19866     return function() {
19867       this.removeAttribute(name);
19868     };
19869   }
19870   function attrRemoveNS(fullname) {
19871     return function() {
19872       this.removeAttributeNS(fullname.space, fullname.local);
19873     };
19874   }
19875   function attrConstant(name, value) {
19876     return function() {
19877       this.setAttribute(name, value);
19878     };
19879   }
19880   function attrConstantNS(fullname, value) {
19881     return function() {
19882       this.setAttributeNS(fullname.space, fullname.local, value);
19883     };
19884   }
19885   function attrFunction(name, value) {
19886     return function() {
19887       var v2 = value.apply(this, arguments);
19888       if (v2 == null)
19889         this.removeAttribute(name);
19890       else
19891         this.setAttribute(name, v2);
19892     };
19893   }
19894   function attrFunctionNS(fullname, value) {
19895     return function() {
19896       var v2 = value.apply(this, arguments);
19897       if (v2 == null)
19898         this.removeAttributeNS(fullname.space, fullname.local);
19899       else
19900         this.setAttributeNS(fullname.space, fullname.local, v2);
19901     };
19902   }
19903   function attr_default(name, value) {
19904     var fullname = namespace_default(name);
19905     if (arguments.length < 2) {
19906       var node = this.node();
19907       return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
19908     }
19909     return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
19910   }
19911
19912   // node_modules/d3-selection/src/window.js
19913   function window_default(node) {
19914     return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
19915   }
19916
19917   // node_modules/d3-selection/src/selection/style.js
19918   function styleRemove(name) {
19919     return function() {
19920       this.style.removeProperty(name);
19921     };
19922   }
19923   function styleConstant(name, value, priority) {
19924     return function() {
19925       this.style.setProperty(name, value, priority);
19926     };
19927   }
19928   function styleFunction(name, value, priority) {
19929     return function() {
19930       var v2 = value.apply(this, arguments);
19931       if (v2 == null)
19932         this.style.removeProperty(name);
19933       else
19934         this.style.setProperty(name, v2, priority);
19935     };
19936   }
19937   function style_default(name, value, priority) {
19938     return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
19939   }
19940   function styleValue(node, name) {
19941     return node.style.getPropertyValue(name) || window_default(node).getComputedStyle(node, null).getPropertyValue(name);
19942   }
19943
19944   // node_modules/d3-selection/src/selection/property.js
19945   function propertyRemove(name) {
19946     return function() {
19947       delete this[name];
19948     };
19949   }
19950   function propertyConstant(name, value) {
19951     return function() {
19952       this[name] = value;
19953     };
19954   }
19955   function propertyFunction(name, value) {
19956     return function() {
19957       var v2 = value.apply(this, arguments);
19958       if (v2 == null)
19959         delete this[name];
19960       else
19961         this[name] = v2;
19962     };
19963   }
19964   function property_default(name, value) {
19965     return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name];
19966   }
19967
19968   // node_modules/d3-selection/src/selection/classed.js
19969   function classArray(string) {
19970     return string.trim().split(/^|\s+/);
19971   }
19972   function classList(node) {
19973     return node.classList || new ClassList(node);
19974   }
19975   function ClassList(node) {
19976     this._node = node;
19977     this._names = classArray(node.getAttribute("class") || "");
19978   }
19979   ClassList.prototype = {
19980     add: function(name) {
19981       var i3 = this._names.indexOf(name);
19982       if (i3 < 0) {
19983         this._names.push(name);
19984         this._node.setAttribute("class", this._names.join(" "));
19985       }
19986     },
19987     remove: function(name) {
19988       var i3 = this._names.indexOf(name);
19989       if (i3 >= 0) {
19990         this._names.splice(i3, 1);
19991         this._node.setAttribute("class", this._names.join(" "));
19992       }
19993     },
19994     contains: function(name) {
19995       return this._names.indexOf(name) >= 0;
19996     }
19997   };
19998   function classedAdd(node, names) {
19999     var list = classList(node), i3 = -1, n3 = names.length;
20000     while (++i3 < n3)
20001       list.add(names[i3]);
20002   }
20003   function classedRemove(node, names) {
20004     var list = classList(node), i3 = -1, n3 = names.length;
20005     while (++i3 < n3)
20006       list.remove(names[i3]);
20007   }
20008   function classedTrue(names) {
20009     return function() {
20010       classedAdd(this, names);
20011     };
20012   }
20013   function classedFalse(names) {
20014     return function() {
20015       classedRemove(this, names);
20016     };
20017   }
20018   function classedFunction(names, value) {
20019     return function() {
20020       (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
20021     };
20022   }
20023   function classed_default(name, value) {
20024     var names = classArray(name + "");
20025     if (arguments.length < 2) {
20026       var list = classList(this.node()), i3 = -1, n3 = names.length;
20027       while (++i3 < n3)
20028         if (!list.contains(names[i3]))
20029           return false;
20030       return true;
20031     }
20032     return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
20033   }
20034
20035   // node_modules/d3-selection/src/selection/text.js
20036   function textRemove() {
20037     this.textContent = "";
20038   }
20039   function textConstant(value) {
20040     return function() {
20041       this.textContent = value;
20042     };
20043   }
20044   function textFunction(value) {
20045     return function() {
20046       var v2 = value.apply(this, arguments);
20047       this.textContent = v2 == null ? "" : v2;
20048     };
20049   }
20050   function text_default(value) {
20051     return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
20052   }
20053
20054   // node_modules/d3-selection/src/selection/html.js
20055   function htmlRemove() {
20056     this.innerHTML = "";
20057   }
20058   function htmlConstant(value) {
20059     return function() {
20060       this.innerHTML = value;
20061     };
20062   }
20063   function htmlFunction(value) {
20064     return function() {
20065       var v2 = value.apply(this, arguments);
20066       this.innerHTML = v2 == null ? "" : v2;
20067     };
20068   }
20069   function html_default(value) {
20070     return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
20071   }
20072
20073   // node_modules/d3-selection/src/selection/raise.js
20074   function raise() {
20075     if (this.nextSibling)
20076       this.parentNode.appendChild(this);
20077   }
20078   function raise_default() {
20079     return this.each(raise);
20080   }
20081
20082   // node_modules/d3-selection/src/selection/lower.js
20083   function lower() {
20084     if (this.previousSibling)
20085       this.parentNode.insertBefore(this, this.parentNode.firstChild);
20086   }
20087   function lower_default() {
20088     return this.each(lower);
20089   }
20090
20091   // node_modules/d3-selection/src/selection/append.js
20092   function append_default(name) {
20093     var create2 = typeof name === "function" ? name : creator_default(name);
20094     return this.select(function() {
20095       return this.appendChild(create2.apply(this, arguments));
20096     });
20097   }
20098
20099   // node_modules/d3-selection/src/selection/insert.js
20100   function constantNull() {
20101     return null;
20102   }
20103   function insert_default(name, before) {
20104     var create2 = typeof name === "function" ? name : creator_default(name), select = before == null ? constantNull : typeof before === "function" ? before : selector_default(before);
20105     return this.select(function() {
20106       return this.insertBefore(create2.apply(this, arguments), select.apply(this, arguments) || null);
20107     });
20108   }
20109
20110   // node_modules/d3-selection/src/selection/remove.js
20111   function remove() {
20112     var parent = this.parentNode;
20113     if (parent)
20114       parent.removeChild(this);
20115   }
20116   function remove_default() {
20117     return this.each(remove);
20118   }
20119
20120   // node_modules/d3-selection/src/selection/clone.js
20121   function selection_cloneShallow() {
20122     var clone = this.cloneNode(false), parent = this.parentNode;
20123     return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
20124   }
20125   function selection_cloneDeep() {
20126     var clone = this.cloneNode(true), parent = this.parentNode;
20127     return parent ? parent.insertBefore(clone, this.nextSibling) : clone;
20128   }
20129   function clone_default(deep) {
20130     return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
20131   }
20132
20133   // node_modules/d3-selection/src/selection/datum.js
20134   function datum_default(value) {
20135     return arguments.length ? this.property("__data__", value) : this.node().__data__;
20136   }
20137
20138   // node_modules/d3-selection/src/selection/on.js
20139   function contextListener(listener) {
20140     return function(event) {
20141       listener.call(this, event, this.__data__);
20142     };
20143   }
20144   function parseTypenames2(typenames) {
20145     return typenames.trim().split(/^|\s+/).map(function(t2) {
20146       var name = "", i3 = t2.indexOf(".");
20147       if (i3 >= 0)
20148         name = t2.slice(i3 + 1), t2 = t2.slice(0, i3);
20149       return { type: t2, name };
20150     });
20151   }
20152   function onRemove(typename) {
20153     return function() {
20154       var on = this.__on;
20155       if (!on)
20156         return;
20157       for (var j3 = 0, i3 = -1, m2 = on.length, o2; j3 < m2; ++j3) {
20158         if (o2 = on[j3], (!typename.type || o2.type === typename.type) && o2.name === typename.name) {
20159           this.removeEventListener(o2.type, o2.listener, o2.options);
20160         } else {
20161           on[++i3] = o2;
20162         }
20163       }
20164       if (++i3)
20165         on.length = i3;
20166       else
20167         delete this.__on;
20168     };
20169   }
20170   function onAdd(typename, value, options2) {
20171     return function() {
20172       var on = this.__on, o2, listener = contextListener(value);
20173       if (on)
20174         for (var j3 = 0, m2 = on.length; j3 < m2; ++j3) {
20175           if ((o2 = on[j3]).type === typename.type && o2.name === typename.name) {
20176             this.removeEventListener(o2.type, o2.listener, o2.options);
20177             this.addEventListener(o2.type, o2.listener = listener, o2.options = options2);
20178             o2.value = value;
20179             return;
20180           }
20181         }
20182       this.addEventListener(typename.type, listener, options2);
20183       o2 = { type: typename.type, name: typename.name, value, listener, options: options2 };
20184       if (!on)
20185         this.__on = [o2];
20186       else
20187         on.push(o2);
20188     };
20189   }
20190   function on_default(typename, value, options2) {
20191     var typenames = parseTypenames2(typename + ""), i3, n3 = typenames.length, t2;
20192     if (arguments.length < 2) {
20193       var on = this.node().__on;
20194       if (on)
20195         for (var j3 = 0, m2 = on.length, o2; j3 < m2; ++j3) {
20196           for (i3 = 0, o2 = on[j3]; i3 < n3; ++i3) {
20197             if ((t2 = typenames[i3]).type === o2.type && t2.name === o2.name) {
20198               return o2.value;
20199             }
20200           }
20201         }
20202       return;
20203     }
20204     on = value ? onAdd : onRemove;
20205     for (i3 = 0; i3 < n3; ++i3)
20206       this.each(on(typenames[i3], value, options2));
20207     return this;
20208   }
20209
20210   // node_modules/d3-selection/src/selection/dispatch.js
20211   function dispatchEvent(node, type2, params) {
20212     var window2 = window_default(node), event = window2.CustomEvent;
20213     if (typeof event === "function") {
20214       event = new event(type2, params);
20215     } else {
20216       event = window2.document.createEvent("Event");
20217       if (params)
20218         event.initEvent(type2, params.bubbles, params.cancelable), event.detail = params.detail;
20219       else
20220         event.initEvent(type2, false, false);
20221     }
20222     node.dispatchEvent(event);
20223   }
20224   function dispatchConstant(type2, params) {
20225     return function() {
20226       return dispatchEvent(this, type2, params);
20227     };
20228   }
20229   function dispatchFunction(type2, params) {
20230     return function() {
20231       return dispatchEvent(this, type2, params.apply(this, arguments));
20232     };
20233   }
20234   function dispatch_default2(type2, params) {
20235     return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type2, params));
20236   }
20237
20238   // node_modules/d3-selection/src/selection/iterator.js
20239   function* iterator_default() {
20240     for (var groups = this._groups, j3 = 0, m2 = groups.length; j3 < m2; ++j3) {
20241       for (var group = groups[j3], i3 = 0, n3 = group.length, node; i3 < n3; ++i3) {
20242         if (node = group[i3])
20243           yield node;
20244       }
20245     }
20246   }
20247
20248   // node_modules/d3-selection/src/selection/index.js
20249   var root = [null];
20250   function Selection(groups, parents) {
20251     this._groups = groups;
20252     this._parents = parents;
20253   }
20254   function selection() {
20255     return new Selection([[document.documentElement]], root);
20256   }
20257   function selection_selection() {
20258     return this;
20259   }
20260   Selection.prototype = selection.prototype = {
20261     constructor: Selection,
20262     select: select_default,
20263     selectAll: selectAll_default,
20264     selectChild: selectChild_default,
20265     selectChildren: selectChildren_default,
20266     filter: filter_default,
20267     data: data_default,
20268     enter: enter_default,
20269     exit: exit_default,
20270     join: join_default,
20271     merge: merge_default,
20272     selection: selection_selection,
20273     order: order_default,
20274     sort: sort_default,
20275     call: call_default,
20276     nodes: nodes_default,
20277     node: node_default,
20278     size: size_default,
20279     empty: empty_default,
20280     each: each_default,
20281     attr: attr_default,
20282     style: style_default,
20283     property: property_default,
20284     classed: classed_default,
20285     text: text_default,
20286     html: html_default,
20287     raise: raise_default,
20288     lower: lower_default,
20289     append: append_default,
20290     insert: insert_default,
20291     remove: remove_default,
20292     clone: clone_default,
20293     datum: datum_default,
20294     on: on_default,
20295     dispatch: dispatch_default2,
20296     [Symbol.iterator]: iterator_default
20297   };
20298   var selection_default = selection;
20299
20300   // node_modules/d3-selection/src/select.js
20301   function select_default2(selector) {
20302     return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root);
20303   }
20304
20305   // node_modules/d3-selection/src/sourceEvent.js
20306   function sourceEvent_default(event) {
20307     let sourceEvent;
20308     while (sourceEvent = event.sourceEvent)
20309       event = sourceEvent;
20310     return event;
20311   }
20312
20313   // node_modules/d3-selection/src/pointer.js
20314   function pointer_default(event, node) {
20315     event = sourceEvent_default(event);
20316     if (node === void 0)
20317       node = event.currentTarget;
20318     if (node) {
20319       var svg2 = node.ownerSVGElement || node;
20320       if (svg2.createSVGPoint) {
20321         var point2 = svg2.createSVGPoint();
20322         point2.x = event.clientX, point2.y = event.clientY;
20323         point2 = point2.matrixTransform(node.getScreenCTM().inverse());
20324         return [point2.x, point2.y];
20325       }
20326       if (node.getBoundingClientRect) {
20327         var rect = node.getBoundingClientRect();
20328         return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
20329       }
20330     }
20331     return [event.pageX, event.pageY];
20332   }
20333
20334   // node_modules/d3-selection/src/selectAll.js
20335   function selectAll_default2(selector) {
20336     return typeof selector === "string" ? new Selection([document.querySelectorAll(selector)], [document.documentElement]) : new Selection([array(selector)], root);
20337   }
20338
20339   // node_modules/d3-drag/src/noevent.js
20340   var nonpassive = { passive: false };
20341   var nonpassivecapture = { capture: true, passive: false };
20342   function nopropagation(event) {
20343     event.stopImmediatePropagation();
20344   }
20345   function noevent_default(event) {
20346     event.preventDefault();
20347     event.stopImmediatePropagation();
20348   }
20349
20350   // node_modules/d3-drag/src/nodrag.js
20351   function nodrag_default(view) {
20352     var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", noevent_default, nonpassivecapture);
20353     if ("onselectstart" in root3) {
20354       selection2.on("selectstart.drag", noevent_default, nonpassivecapture);
20355     } else {
20356       root3.__noselect = root3.style.MozUserSelect;
20357       root3.style.MozUserSelect = "none";
20358     }
20359   }
20360   function yesdrag(view, noclick) {
20361     var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", null);
20362     if (noclick) {
20363       selection2.on("click.drag", noevent_default, nonpassivecapture);
20364       setTimeout(function() {
20365         selection2.on("click.drag", null);
20366       }, 0);
20367     }
20368     if ("onselectstart" in root3) {
20369       selection2.on("selectstart.drag", null);
20370     } else {
20371       root3.style.MozUserSelect = root3.__noselect;
20372       delete root3.__noselect;
20373     }
20374   }
20375
20376   // node_modules/d3-drag/src/constant.js
20377   var constant_default2 = (x2) => () => x2;
20378
20379   // node_modules/d3-drag/src/event.js
20380   function DragEvent(type2, {
20381     sourceEvent,
20382     subject,
20383     target,
20384     identifier,
20385     active,
20386     x: x2,
20387     y: y2,
20388     dx,
20389     dy,
20390     dispatch: dispatch14
20391   }) {
20392     Object.defineProperties(this, {
20393       type: { value: type2, enumerable: true, configurable: true },
20394       sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
20395       subject: { value: subject, enumerable: true, configurable: true },
20396       target: { value: target, enumerable: true, configurable: true },
20397       identifier: { value: identifier, enumerable: true, configurable: true },
20398       active: { value: active, enumerable: true, configurable: true },
20399       x: { value: x2, enumerable: true, configurable: true },
20400       y: { value: y2, enumerable: true, configurable: true },
20401       dx: { value: dx, enumerable: true, configurable: true },
20402       dy: { value: dy, enumerable: true, configurable: true },
20403       _: { value: dispatch14 }
20404     });
20405   }
20406   DragEvent.prototype.on = function() {
20407     var value = this._.on.apply(this._, arguments);
20408     return value === this._ ? this : value;
20409   };
20410
20411   // node_modules/d3-drag/src/drag.js
20412   function defaultFilter(event) {
20413     return !event.ctrlKey && !event.button;
20414   }
20415   function defaultContainer() {
20416     return this.parentNode;
20417   }
20418   function defaultSubject(event, d2) {
20419     return d2 == null ? { x: event.x, y: event.y } : d2;
20420   }
20421   function defaultTouchable() {
20422     return navigator.maxTouchPoints || "ontouchstart" in this;
20423   }
20424   function drag_default() {
20425     var filter2 = defaultFilter, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable, gestures = {}, listeners = dispatch_default("start", "drag", "end"), active = 0, mousedownx, mousedowny, mousemoving, touchending, clickDistance2 = 0;
20426     function drag(selection2) {
20427       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)");
20428     }
20429     function mousedowned(event, d2) {
20430       if (touchending || !filter2.call(this, event, d2))
20431         return;
20432       var gesture = beforestart(this, container.call(this, event, d2), event, d2, "mouse");
20433       if (!gesture)
20434         return;
20435       select_default2(event.view).on("mousemove.drag", mousemoved, nonpassivecapture).on("mouseup.drag", mouseupped, nonpassivecapture);
20436       nodrag_default(event.view);
20437       nopropagation(event);
20438       mousemoving = false;
20439       mousedownx = event.clientX;
20440       mousedowny = event.clientY;
20441       gesture("start", event);
20442     }
20443     function mousemoved(event) {
20444       noevent_default(event);
20445       if (!mousemoving) {
20446         var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
20447         mousemoving = dx * dx + dy * dy > clickDistance2;
20448       }
20449       gestures.mouse("drag", event);
20450     }
20451     function mouseupped(event) {
20452       select_default2(event.view).on("mousemove.drag mouseup.drag", null);
20453       yesdrag(event.view, mousemoving);
20454       noevent_default(event);
20455       gestures.mouse("end", event);
20456     }
20457     function touchstarted(event, d2) {
20458       if (!filter2.call(this, event, d2))
20459         return;
20460       var touches = event.changedTouches, c2 = container.call(this, event, d2), n3 = touches.length, i3, gesture;
20461       for (i3 = 0; i3 < n3; ++i3) {
20462         if (gesture = beforestart(this, c2, event, d2, touches[i3].identifier, touches[i3])) {
20463           nopropagation(event);
20464           gesture("start", event, touches[i3]);
20465         }
20466       }
20467     }
20468     function touchmoved(event) {
20469       var touches = event.changedTouches, n3 = touches.length, i3, gesture;
20470       for (i3 = 0; i3 < n3; ++i3) {
20471         if (gesture = gestures[touches[i3].identifier]) {
20472           noevent_default(event);
20473           gesture("drag", event, touches[i3]);
20474         }
20475       }
20476     }
20477     function touchended(event) {
20478       var touches = event.changedTouches, n3 = touches.length, i3, gesture;
20479       if (touchending)
20480         clearTimeout(touchending);
20481       touchending = setTimeout(function() {
20482         touchending = null;
20483       }, 500);
20484       for (i3 = 0; i3 < n3; ++i3) {
20485         if (gesture = gestures[touches[i3].identifier]) {
20486           nopropagation(event);
20487           gesture("end", event, touches[i3]);
20488         }
20489       }
20490     }
20491     function beforestart(that, container2, event, d2, identifier, touch) {
20492       var dispatch14 = listeners.copy(), p2 = pointer_default(touch || event, container2), dx, dy, s2;
20493       if ((s2 = subject.call(that, new DragEvent("beforestart", {
20494         sourceEvent: event,
20495         target: drag,
20496         identifier,
20497         active,
20498         x: p2[0],
20499         y: p2[1],
20500         dx: 0,
20501         dy: 0,
20502         dispatch: dispatch14
20503       }), d2)) == null)
20504         return;
20505       dx = s2.x - p2[0] || 0;
20506       dy = s2.y - p2[1] || 0;
20507       return function gesture(type2, event2, touch2) {
20508         var p02 = p2, n3;
20509         switch (type2) {
20510           case "start":
20511             gestures[identifier] = gesture, n3 = active++;
20512             break;
20513           case "end":
20514             delete gestures[identifier], --active;
20515           case "drag":
20516             p2 = pointer_default(touch2 || event2, container2), n3 = active;
20517             break;
20518         }
20519         dispatch14.call(
20520           type2,
20521           that,
20522           new DragEvent(type2, {
20523             sourceEvent: event2,
20524             subject: s2,
20525             target: drag,
20526             identifier,
20527             active: n3,
20528             x: p2[0] + dx,
20529             y: p2[1] + dy,
20530             dx: p2[0] - p02[0],
20531             dy: p2[1] - p02[1],
20532             dispatch: dispatch14
20533           }),
20534           d2
20535         );
20536       };
20537     }
20538     drag.filter = function(_2) {
20539       return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant_default2(!!_2), drag) : filter2;
20540     };
20541     drag.container = function(_2) {
20542       return arguments.length ? (container = typeof _2 === "function" ? _2 : constant_default2(_2), drag) : container;
20543     };
20544     drag.subject = function(_2) {
20545       return arguments.length ? (subject = typeof _2 === "function" ? _2 : constant_default2(_2), drag) : subject;
20546     };
20547     drag.touchable = function(_2) {
20548       return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant_default2(!!_2), drag) : touchable;
20549     };
20550     drag.on = function() {
20551       var value = listeners.on.apply(listeners, arguments);
20552       return value === listeners ? drag : value;
20553     };
20554     drag.clickDistance = function(_2) {
20555       return arguments.length ? (clickDistance2 = (_2 = +_2) * _2, drag) : Math.sqrt(clickDistance2);
20556     };
20557     return drag;
20558   }
20559
20560   // node_modules/d3-color/src/define.js
20561   function define_default(constructor, factory, prototype) {
20562     constructor.prototype = factory.prototype = prototype;
20563     prototype.constructor = constructor;
20564   }
20565   function extend(parent, definition) {
20566     var prototype = Object.create(parent.prototype);
20567     for (var key in definition)
20568       prototype[key] = definition[key];
20569     return prototype;
20570   }
20571
20572   // node_modules/d3-color/src/color.js
20573   function Color() {
20574   }
20575   var darker = 0.7;
20576   var brighter = 1 / darker;
20577   var reI = "\\s*([+-]?\\d+)\\s*";
20578   var reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
20579   var reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
20580   var reHex = /^#([0-9a-f]{3,8})$/;
20581   var reRgbInteger = new RegExp("^rgb\\(".concat(reI, ",").concat(reI, ",").concat(reI, "\\)$"));
20582   var reRgbPercent = new RegExp("^rgb\\(".concat(reP, ",").concat(reP, ",").concat(reP, "\\)$"));
20583   var reRgbaInteger = new RegExp("^rgba\\(".concat(reI, ",").concat(reI, ",").concat(reI, ",").concat(reN, "\\)$"));
20584   var reRgbaPercent = new RegExp("^rgba\\(".concat(reP, ",").concat(reP, ",").concat(reP, ",").concat(reN, "\\)$"));
20585   var reHslPercent = new RegExp("^hsl\\(".concat(reN, ",").concat(reP, ",").concat(reP, "\\)$"));
20586   var reHslaPercent = new RegExp("^hsla\\(".concat(reN, ",").concat(reP, ",").concat(reP, ",").concat(reN, "\\)$"));
20587   var named = {
20588     aliceblue: 15792383,
20589     antiquewhite: 16444375,
20590     aqua: 65535,
20591     aquamarine: 8388564,
20592     azure: 15794175,
20593     beige: 16119260,
20594     bisque: 16770244,
20595     black: 0,
20596     blanchedalmond: 16772045,
20597     blue: 255,
20598     blueviolet: 9055202,
20599     brown: 10824234,
20600     burlywood: 14596231,
20601     cadetblue: 6266528,
20602     chartreuse: 8388352,
20603     chocolate: 13789470,
20604     coral: 16744272,
20605     cornflowerblue: 6591981,
20606     cornsilk: 16775388,
20607     crimson: 14423100,
20608     cyan: 65535,
20609     darkblue: 139,
20610     darkcyan: 35723,
20611     darkgoldenrod: 12092939,
20612     darkgray: 11119017,
20613     darkgreen: 25600,
20614     darkgrey: 11119017,
20615     darkkhaki: 12433259,
20616     darkmagenta: 9109643,
20617     darkolivegreen: 5597999,
20618     darkorange: 16747520,
20619     darkorchid: 10040012,
20620     darkred: 9109504,
20621     darksalmon: 15308410,
20622     darkseagreen: 9419919,
20623     darkslateblue: 4734347,
20624     darkslategray: 3100495,
20625     darkslategrey: 3100495,
20626     darkturquoise: 52945,
20627     darkviolet: 9699539,
20628     deeppink: 16716947,
20629     deepskyblue: 49151,
20630     dimgray: 6908265,
20631     dimgrey: 6908265,
20632     dodgerblue: 2003199,
20633     firebrick: 11674146,
20634     floralwhite: 16775920,
20635     forestgreen: 2263842,
20636     fuchsia: 16711935,
20637     gainsboro: 14474460,
20638     ghostwhite: 16316671,
20639     gold: 16766720,
20640     goldenrod: 14329120,
20641     gray: 8421504,
20642     green: 32768,
20643     greenyellow: 11403055,
20644     grey: 8421504,
20645     honeydew: 15794160,
20646     hotpink: 16738740,
20647     indianred: 13458524,
20648     indigo: 4915330,
20649     ivory: 16777200,
20650     khaki: 15787660,
20651     lavender: 15132410,
20652     lavenderblush: 16773365,
20653     lawngreen: 8190976,
20654     lemonchiffon: 16775885,
20655     lightblue: 11393254,
20656     lightcoral: 15761536,
20657     lightcyan: 14745599,
20658     lightgoldenrodyellow: 16448210,
20659     lightgray: 13882323,
20660     lightgreen: 9498256,
20661     lightgrey: 13882323,
20662     lightpink: 16758465,
20663     lightsalmon: 16752762,
20664     lightseagreen: 2142890,
20665     lightskyblue: 8900346,
20666     lightslategray: 7833753,
20667     lightslategrey: 7833753,
20668     lightsteelblue: 11584734,
20669     lightyellow: 16777184,
20670     lime: 65280,
20671     limegreen: 3329330,
20672     linen: 16445670,
20673     magenta: 16711935,
20674     maroon: 8388608,
20675     mediumaquamarine: 6737322,
20676     mediumblue: 205,
20677     mediumorchid: 12211667,
20678     mediumpurple: 9662683,
20679     mediumseagreen: 3978097,
20680     mediumslateblue: 8087790,
20681     mediumspringgreen: 64154,
20682     mediumturquoise: 4772300,
20683     mediumvioletred: 13047173,
20684     midnightblue: 1644912,
20685     mintcream: 16121850,
20686     mistyrose: 16770273,
20687     moccasin: 16770229,
20688     navajowhite: 16768685,
20689     navy: 128,
20690     oldlace: 16643558,
20691     olive: 8421376,
20692     olivedrab: 7048739,
20693     orange: 16753920,
20694     orangered: 16729344,
20695     orchid: 14315734,
20696     palegoldenrod: 15657130,
20697     palegreen: 10025880,
20698     paleturquoise: 11529966,
20699     palevioletred: 14381203,
20700     papayawhip: 16773077,
20701     peachpuff: 16767673,
20702     peru: 13468991,
20703     pink: 16761035,
20704     plum: 14524637,
20705     powderblue: 11591910,
20706     purple: 8388736,
20707     rebeccapurple: 6697881,
20708     red: 16711680,
20709     rosybrown: 12357519,
20710     royalblue: 4286945,
20711     saddlebrown: 9127187,
20712     salmon: 16416882,
20713     sandybrown: 16032864,
20714     seagreen: 3050327,
20715     seashell: 16774638,
20716     sienna: 10506797,
20717     silver: 12632256,
20718     skyblue: 8900331,
20719     slateblue: 6970061,
20720     slategray: 7372944,
20721     slategrey: 7372944,
20722     snow: 16775930,
20723     springgreen: 65407,
20724     steelblue: 4620980,
20725     tan: 13808780,
20726     teal: 32896,
20727     thistle: 14204888,
20728     tomato: 16737095,
20729     turquoise: 4251856,
20730     violet: 15631086,
20731     wheat: 16113331,
20732     white: 16777215,
20733     whitesmoke: 16119285,
20734     yellow: 16776960,
20735     yellowgreen: 10145074
20736   };
20737   define_default(Color, color, {
20738     copy(channels) {
20739       return Object.assign(new this.constructor(), this, channels);
20740     },
20741     displayable() {
20742       return this.rgb().displayable();
20743     },
20744     hex: color_formatHex,
20745     // Deprecated! Use color.formatHex.
20746     formatHex: color_formatHex,
20747     formatHex8: color_formatHex8,
20748     formatHsl: color_formatHsl,
20749     formatRgb: color_formatRgb,
20750     toString: color_formatRgb
20751   });
20752   function color_formatHex() {
20753     return this.rgb().formatHex();
20754   }
20755   function color_formatHex8() {
20756     return this.rgb().formatHex8();
20757   }
20758   function color_formatHsl() {
20759     return hslConvert(this).formatHsl();
20760   }
20761   function color_formatRgb() {
20762     return this.rgb().formatRgb();
20763   }
20764   function color(format2) {
20765     var m2, l2;
20766     format2 = (format2 + "").trim().toLowerCase();
20767     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;
20768   }
20769   function rgbn(n3) {
20770     return new Rgb(n3 >> 16 & 255, n3 >> 8 & 255, n3 & 255, 1);
20771   }
20772   function rgba(r2, g3, b2, a2) {
20773     if (a2 <= 0)
20774       r2 = g3 = b2 = NaN;
20775     return new Rgb(r2, g3, b2, a2);
20776   }
20777   function rgbConvert(o2) {
20778     if (!(o2 instanceof Color))
20779       o2 = color(o2);
20780     if (!o2)
20781       return new Rgb();
20782     o2 = o2.rgb();
20783     return new Rgb(o2.r, o2.g, o2.b, o2.opacity);
20784   }
20785   function rgb(r2, g3, b2, opacity) {
20786     return arguments.length === 1 ? rgbConvert(r2) : new Rgb(r2, g3, b2, opacity == null ? 1 : opacity);
20787   }
20788   function Rgb(r2, g3, b2, opacity) {
20789     this.r = +r2;
20790     this.g = +g3;
20791     this.b = +b2;
20792     this.opacity = +opacity;
20793   }
20794   define_default(Rgb, rgb, extend(Color, {
20795     brighter(k2) {
20796       k2 = k2 == null ? brighter : Math.pow(brighter, k2);
20797       return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity);
20798     },
20799     darker(k2) {
20800       k2 = k2 == null ? darker : Math.pow(darker, k2);
20801       return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity);
20802     },
20803     rgb() {
20804       return this;
20805     },
20806     clamp() {
20807       return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
20808     },
20809     displayable() {
20810       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);
20811     },
20812     hex: rgb_formatHex,
20813     // Deprecated! Use color.formatHex.
20814     formatHex: rgb_formatHex,
20815     formatHex8: rgb_formatHex8,
20816     formatRgb: rgb_formatRgb,
20817     toString: rgb_formatRgb
20818   }));
20819   function rgb_formatHex() {
20820     return "#".concat(hex(this.r)).concat(hex(this.g)).concat(hex(this.b));
20821   }
20822   function rgb_formatHex8() {
20823     return "#".concat(hex(this.r)).concat(hex(this.g)).concat(hex(this.b)).concat(hex((isNaN(this.opacity) ? 1 : this.opacity) * 255));
20824   }
20825   function rgb_formatRgb() {
20826     const a2 = clampa(this.opacity);
20827     return "".concat(a2 === 1 ? "rgb(" : "rgba(").concat(clampi(this.r), ", ").concat(clampi(this.g), ", ").concat(clampi(this.b)).concat(a2 === 1 ? ")" : ", ".concat(a2, ")"));
20828   }
20829   function clampa(opacity) {
20830     return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
20831   }
20832   function clampi(value) {
20833     return Math.max(0, Math.min(255, Math.round(value) || 0));
20834   }
20835   function hex(value) {
20836     value = clampi(value);
20837     return (value < 16 ? "0" : "") + value.toString(16);
20838   }
20839   function hsla(h2, s2, l2, a2) {
20840     if (a2 <= 0)
20841       h2 = s2 = l2 = NaN;
20842     else if (l2 <= 0 || l2 >= 1)
20843       h2 = s2 = NaN;
20844     else if (s2 <= 0)
20845       h2 = NaN;
20846     return new Hsl(h2, s2, l2, a2);
20847   }
20848   function hslConvert(o2) {
20849     if (o2 instanceof Hsl)
20850       return new Hsl(o2.h, o2.s, o2.l, o2.opacity);
20851     if (!(o2 instanceof Color))
20852       o2 = color(o2);
20853     if (!o2)
20854       return new Hsl();
20855     if (o2 instanceof Hsl)
20856       return o2;
20857     o2 = o2.rgb();
20858     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;
20859     if (s2) {
20860       if (r2 === max3)
20861         h2 = (g3 - b2) / s2 + (g3 < b2) * 6;
20862       else if (g3 === max3)
20863         h2 = (b2 - r2) / s2 + 2;
20864       else
20865         h2 = (r2 - g3) / s2 + 4;
20866       s2 /= l2 < 0.5 ? max3 + min3 : 2 - max3 - min3;
20867       h2 *= 60;
20868     } else {
20869       s2 = l2 > 0 && l2 < 1 ? 0 : h2;
20870     }
20871     return new Hsl(h2, s2, l2, o2.opacity);
20872   }
20873   function hsl(h2, s2, l2, opacity) {
20874     return arguments.length === 1 ? hslConvert(h2) : new Hsl(h2, s2, l2, opacity == null ? 1 : opacity);
20875   }
20876   function Hsl(h2, s2, l2, opacity) {
20877     this.h = +h2;
20878     this.s = +s2;
20879     this.l = +l2;
20880     this.opacity = +opacity;
20881   }
20882   define_default(Hsl, hsl, extend(Color, {
20883     brighter(k2) {
20884       k2 = k2 == null ? brighter : Math.pow(brighter, k2);
20885       return new Hsl(this.h, this.s, this.l * k2, this.opacity);
20886     },
20887     darker(k2) {
20888       k2 = k2 == null ? darker : Math.pow(darker, k2);
20889       return new Hsl(this.h, this.s, this.l * k2, this.opacity);
20890     },
20891     rgb() {
20892       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;
20893       return new Rgb(
20894         hsl2rgb(h2 >= 240 ? h2 - 240 : h2 + 120, m1, m2),
20895         hsl2rgb(h2, m1, m2),
20896         hsl2rgb(h2 < 120 ? h2 + 240 : h2 - 120, m1, m2),
20897         this.opacity
20898       );
20899     },
20900     clamp() {
20901       return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
20902     },
20903     displayable() {
20904       return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
20905     },
20906     formatHsl() {
20907       const a2 = clampa(this.opacity);
20908       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, ")"));
20909     }
20910   }));
20911   function clamph(value) {
20912     value = (value || 0) % 360;
20913     return value < 0 ? value + 360 : value;
20914   }
20915   function clampt(value) {
20916     return Math.max(0, Math.min(1, value || 0));
20917   }
20918   function hsl2rgb(h2, m1, m2) {
20919     return (h2 < 60 ? m1 + (m2 - m1) * h2 / 60 : h2 < 180 ? m2 : h2 < 240 ? m1 + (m2 - m1) * (240 - h2) / 60 : m1) * 255;
20920   }
20921
20922   // node_modules/d3-interpolate/src/basis.js
20923   function basis(t1, v0, v1, v2, v3) {
20924     var t2 = t1 * t1, t3 = t2 * t1;
20925     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;
20926   }
20927   function basis_default(values) {
20928     var n3 = values.length - 1;
20929     return function(t2) {
20930       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;
20931       return basis((t2 - i3 / n3) * n3, v0, v1, v2, v3);
20932     };
20933   }
20934
20935   // node_modules/d3-interpolate/src/basisClosed.js
20936   function basisClosed_default(values) {
20937     var n3 = values.length;
20938     return function(t2) {
20939       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];
20940       return basis((t2 - i3 / n3) * n3, v0, v1, v2, v3);
20941     };
20942   }
20943
20944   // node_modules/d3-interpolate/src/constant.js
20945   var constant_default3 = (x2) => () => x2;
20946
20947   // node_modules/d3-interpolate/src/color.js
20948   function linear(a2, d2) {
20949     return function(t2) {
20950       return a2 + t2 * d2;
20951     };
20952   }
20953   function exponential(a2, b2, y2) {
20954     return a2 = Math.pow(a2, y2), b2 = Math.pow(b2, y2) - a2, y2 = 1 / y2, function(t2) {
20955       return Math.pow(a2 + t2 * b2, y2);
20956     };
20957   }
20958   function gamma(y2) {
20959     return (y2 = +y2) === 1 ? nogamma : function(a2, b2) {
20960       return b2 - a2 ? exponential(a2, b2, y2) : constant_default3(isNaN(a2) ? b2 : a2);
20961     };
20962   }
20963   function nogamma(a2, b2) {
20964     var d2 = b2 - a2;
20965     return d2 ? linear(a2, d2) : constant_default3(isNaN(a2) ? b2 : a2);
20966   }
20967
20968   // node_modules/d3-interpolate/src/rgb.js
20969   var rgb_default = function rgbGamma(y2) {
20970     var color2 = gamma(y2);
20971     function rgb2(start2, end) {
20972       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);
20973       return function(t2) {
20974         start2.r = r2(t2);
20975         start2.g = g3(t2);
20976         start2.b = b2(t2);
20977         start2.opacity = opacity(t2);
20978         return start2 + "";
20979       };
20980     }
20981     rgb2.gamma = rgbGamma;
20982     return rgb2;
20983   }(1);
20984   function rgbSpline(spline) {
20985     return function(colors) {
20986       var n3 = colors.length, r2 = new Array(n3), g3 = new Array(n3), b2 = new Array(n3), i3, color2;
20987       for (i3 = 0; i3 < n3; ++i3) {
20988         color2 = rgb(colors[i3]);
20989         r2[i3] = color2.r || 0;
20990         g3[i3] = color2.g || 0;
20991         b2[i3] = color2.b || 0;
20992       }
20993       r2 = spline(r2);
20994       g3 = spline(g3);
20995       b2 = spline(b2);
20996       color2.opacity = 1;
20997       return function(t2) {
20998         color2.r = r2(t2);
20999         color2.g = g3(t2);
21000         color2.b = b2(t2);
21001         return color2 + "";
21002       };
21003     };
21004   }
21005   var rgbBasis = rgbSpline(basis_default);
21006   var rgbBasisClosed = rgbSpline(basisClosed_default);
21007
21008   // node_modules/d3-interpolate/src/numberArray.js
21009   function numberArray_default(a2, b2) {
21010     if (!b2)
21011       b2 = [];
21012     var n3 = a2 ? Math.min(b2.length, a2.length) : 0, c2 = b2.slice(), i3;
21013     return function(t2) {
21014       for (i3 = 0; i3 < n3; ++i3)
21015         c2[i3] = a2[i3] * (1 - t2) + b2[i3] * t2;
21016       return c2;
21017     };
21018   }
21019   function isNumberArray(x2) {
21020     return ArrayBuffer.isView(x2) && !(x2 instanceof DataView);
21021   }
21022
21023   // node_modules/d3-interpolate/src/array.js
21024   function genericArray(a2, b2) {
21025     var nb = b2 ? b2.length : 0, na = a2 ? Math.min(nb, a2.length) : 0, x2 = new Array(na), c2 = new Array(nb), i3;
21026     for (i3 = 0; i3 < na; ++i3)
21027       x2[i3] = value_default(a2[i3], b2[i3]);
21028     for (; i3 < nb; ++i3)
21029       c2[i3] = b2[i3];
21030     return function(t2) {
21031       for (i3 = 0; i3 < na; ++i3)
21032         c2[i3] = x2[i3](t2);
21033       return c2;
21034     };
21035   }
21036
21037   // node_modules/d3-interpolate/src/date.js
21038   function date_default(a2, b2) {
21039     var d2 = /* @__PURE__ */ new Date();
21040     return a2 = +a2, b2 = +b2, function(t2) {
21041       return d2.setTime(a2 * (1 - t2) + b2 * t2), d2;
21042     };
21043   }
21044
21045   // node_modules/d3-interpolate/src/number.js
21046   function number_default(a2, b2) {
21047     return a2 = +a2, b2 = +b2, function(t2) {
21048       return a2 * (1 - t2) + b2 * t2;
21049     };
21050   }
21051
21052   // node_modules/d3-interpolate/src/object.js
21053   function object_default(a2, b2) {
21054     var i3 = {}, c2 = {}, k2;
21055     if (a2 === null || typeof a2 !== "object")
21056       a2 = {};
21057     if (b2 === null || typeof b2 !== "object")
21058       b2 = {};
21059     for (k2 in b2) {
21060       if (k2 in a2) {
21061         i3[k2] = value_default(a2[k2], b2[k2]);
21062       } else {
21063         c2[k2] = b2[k2];
21064       }
21065     }
21066     return function(t2) {
21067       for (k2 in i3)
21068         c2[k2] = i3[k2](t2);
21069       return c2;
21070     };
21071   }
21072
21073   // node_modules/d3-interpolate/src/string.js
21074   var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
21075   var reB = new RegExp(reA.source, "g");
21076   function zero2(b2) {
21077     return function() {
21078       return b2;
21079     };
21080   }
21081   function one(b2) {
21082     return function(t2) {
21083       return b2(t2) + "";
21084     };
21085   }
21086   function string_default(a2, b2) {
21087     var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i3 = -1, s2 = [], q2 = [];
21088     a2 = a2 + "", b2 = b2 + "";
21089     while ((am = reA.exec(a2)) && (bm = reB.exec(b2))) {
21090       if ((bs = bm.index) > bi) {
21091         bs = b2.slice(bi, bs);
21092         if (s2[i3])
21093           s2[i3] += bs;
21094         else
21095           s2[++i3] = bs;
21096       }
21097       if ((am = am[0]) === (bm = bm[0])) {
21098         if (s2[i3])
21099           s2[i3] += bm;
21100         else
21101           s2[++i3] = bm;
21102       } else {
21103         s2[++i3] = null;
21104         q2.push({ i: i3, x: number_default(am, bm) });
21105       }
21106       bi = reB.lastIndex;
21107     }
21108     if (bi < b2.length) {
21109       bs = b2.slice(bi);
21110       if (s2[i3])
21111         s2[i3] += bs;
21112       else
21113         s2[++i3] = bs;
21114     }
21115     return s2.length < 2 ? q2[0] ? one(q2[0].x) : zero2(b2) : (b2 = q2.length, function(t2) {
21116       for (var i4 = 0, o2; i4 < b2; ++i4)
21117         s2[(o2 = q2[i4]).i] = o2.x(t2);
21118       return s2.join("");
21119     });
21120   }
21121
21122   // node_modules/d3-interpolate/src/value.js
21123   function value_default(a2, b2) {
21124     var t2 = typeof b2, c2;
21125     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);
21126   }
21127
21128   // node_modules/d3-interpolate/src/round.js
21129   function round_default(a2, b2) {
21130     return a2 = +a2, b2 = +b2, function(t2) {
21131       return Math.round(a2 * (1 - t2) + b2 * t2);
21132     };
21133   }
21134
21135   // node_modules/d3-interpolate/src/transform/decompose.js
21136   var degrees2 = 180 / Math.PI;
21137   var identity = {
21138     translateX: 0,
21139     translateY: 0,
21140     rotate: 0,
21141     skewX: 0,
21142     scaleX: 1,
21143     scaleY: 1
21144   };
21145   function decompose_default(a2, b2, c2, d2, e3, f3) {
21146     var scaleX, scaleY, skewX;
21147     if (scaleX = Math.sqrt(a2 * a2 + b2 * b2))
21148       a2 /= scaleX, b2 /= scaleX;
21149     if (skewX = a2 * c2 + b2 * d2)
21150       c2 -= a2 * skewX, d2 -= b2 * skewX;
21151     if (scaleY = Math.sqrt(c2 * c2 + d2 * d2))
21152       c2 /= scaleY, d2 /= scaleY, skewX /= scaleY;
21153     if (a2 * d2 < b2 * c2)
21154       a2 = -a2, b2 = -b2, skewX = -skewX, scaleX = -scaleX;
21155     return {
21156       translateX: e3,
21157       translateY: f3,
21158       rotate: Math.atan2(b2, a2) * degrees2,
21159       skewX: Math.atan(skewX) * degrees2,
21160       scaleX,
21161       scaleY
21162     };
21163   }
21164
21165   // node_modules/d3-interpolate/src/transform/parse.js
21166   var svgNode;
21167   function parseCss(value) {
21168     const m2 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
21169     return m2.isIdentity ? identity : decompose_default(m2.a, m2.b, m2.c, m2.d, m2.e, m2.f);
21170   }
21171   function parseSvg(value) {
21172     if (value == null)
21173       return identity;
21174     if (!svgNode)
21175       svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
21176     svgNode.setAttribute("transform", value);
21177     if (!(value = svgNode.transform.baseVal.consolidate()))
21178       return identity;
21179     value = value.matrix;
21180     return decompose_default(value.a, value.b, value.c, value.d, value.e, value.f);
21181   }
21182
21183   // node_modules/d3-interpolate/src/transform/index.js
21184   function interpolateTransform(parse, pxComma, pxParen, degParen) {
21185     function pop(s2) {
21186       return s2.length ? s2.pop() + " " : "";
21187     }
21188     function translate(xa, ya, xb, yb, s2, q2) {
21189       if (xa !== xb || ya !== yb) {
21190         var i3 = s2.push("translate(", null, pxComma, null, pxParen);
21191         q2.push({ i: i3 - 4, x: number_default(xa, xb) }, { i: i3 - 2, x: number_default(ya, yb) });
21192       } else if (xb || yb) {
21193         s2.push("translate(" + xb + pxComma + yb + pxParen);
21194       }
21195     }
21196     function rotate(a2, b2, s2, q2) {
21197       if (a2 !== b2) {
21198         if (a2 - b2 > 180)
21199           b2 += 360;
21200         else if (b2 - a2 > 180)
21201           a2 += 360;
21202         q2.push({ i: s2.push(pop(s2) + "rotate(", null, degParen) - 2, x: number_default(a2, b2) });
21203       } else if (b2) {
21204         s2.push(pop(s2) + "rotate(" + b2 + degParen);
21205       }
21206     }
21207     function skewX(a2, b2, s2, q2) {
21208       if (a2 !== b2) {
21209         q2.push({ i: s2.push(pop(s2) + "skewX(", null, degParen) - 2, x: number_default(a2, b2) });
21210       } else if (b2) {
21211         s2.push(pop(s2) + "skewX(" + b2 + degParen);
21212       }
21213     }
21214     function scale(xa, ya, xb, yb, s2, q2) {
21215       if (xa !== xb || ya !== yb) {
21216         var i3 = s2.push(pop(s2) + "scale(", null, ",", null, ")");
21217         q2.push({ i: i3 - 4, x: number_default(xa, xb) }, { i: i3 - 2, x: number_default(ya, yb) });
21218       } else if (xb !== 1 || yb !== 1) {
21219         s2.push(pop(s2) + "scale(" + xb + "," + yb + ")");
21220       }
21221     }
21222     return function(a2, b2) {
21223       var s2 = [], q2 = [];
21224       a2 = parse(a2), b2 = parse(b2);
21225       translate(a2.translateX, a2.translateY, b2.translateX, b2.translateY, s2, q2);
21226       rotate(a2.rotate, b2.rotate, s2, q2);
21227       skewX(a2.skewX, b2.skewX, s2, q2);
21228       scale(a2.scaleX, a2.scaleY, b2.scaleX, b2.scaleY, s2, q2);
21229       a2 = b2 = null;
21230       return function(t2) {
21231         var i3 = -1, n3 = q2.length, o2;
21232         while (++i3 < n3)
21233           s2[(o2 = q2[i3]).i] = o2.x(t2);
21234         return s2.join("");
21235       };
21236     };
21237   }
21238   var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
21239   var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
21240
21241   // node_modules/d3-interpolate/src/zoom.js
21242   var epsilon22 = 1e-12;
21243   function cosh(x2) {
21244     return ((x2 = Math.exp(x2)) + 1 / x2) / 2;
21245   }
21246   function sinh(x2) {
21247     return ((x2 = Math.exp(x2)) - 1 / x2) / 2;
21248   }
21249   function tanh(x2) {
21250     return ((x2 = Math.exp(2 * x2)) - 1) / (x2 + 1);
21251   }
21252   var zoom_default = function zoomRho(rho, rho2, rho4) {
21253     function zoom(p02, p1) {
21254       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;
21255       if (d2 < epsilon22) {
21256         S2 = Math.log(w1 / w0) / rho;
21257         i3 = function(t2) {
21258           return [
21259             ux0 + t2 * dx,
21260             uy0 + t2 * dy,
21261             w0 * Math.exp(rho * t2 * S2)
21262           ];
21263         };
21264       } else {
21265         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);
21266         S2 = (r1 - r0) / rho;
21267         i3 = function(t2) {
21268           var s2 = t2 * S2, coshr0 = cosh(r0), u2 = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s2 + r0) - sinh(r0));
21269           return [
21270             ux0 + u2 * dx,
21271             uy0 + u2 * dy,
21272             w0 * coshr0 / cosh(rho * s2 + r0)
21273           ];
21274         };
21275       }
21276       i3.duration = S2 * 1e3 * rho / Math.SQRT2;
21277       return i3;
21278     }
21279     zoom.rho = function(_2) {
21280       var _1 = Math.max(1e-3, +_2), _22 = _1 * _1, _4 = _22 * _22;
21281       return zoomRho(_1, _22, _4);
21282     };
21283     return zoom;
21284   }(Math.SQRT2, 2, 4);
21285
21286   // node_modules/d3-interpolate/src/quantize.js
21287   function quantize_default(interpolator, n3) {
21288     var samples = new Array(n3);
21289     for (var i3 = 0; i3 < n3; ++i3)
21290       samples[i3] = interpolator(i3 / (n3 - 1));
21291     return samples;
21292   }
21293
21294   // node_modules/d3-timer/src/timer.js
21295   var frame = 0;
21296   var timeout = 0;
21297   var interval = 0;
21298   var pokeDelay = 1e3;
21299   var taskHead;
21300   var taskTail;
21301   var clockLast = 0;
21302   var clockNow = 0;
21303   var clockSkew = 0;
21304   var clock = typeof performance === "object" && performance.now ? performance : Date;
21305   var setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f3) {
21306     setTimeout(f3, 17);
21307   };
21308   function now() {
21309     return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
21310   }
21311   function clearNow() {
21312     clockNow = 0;
21313   }
21314   function Timer() {
21315     this._call = this._time = this._next = null;
21316   }
21317   Timer.prototype = timer.prototype = {
21318     constructor: Timer,
21319     restart: function(callback, delay, time) {
21320       if (typeof callback !== "function")
21321         throw new TypeError("callback is not a function");
21322       time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
21323       if (!this._next && taskTail !== this) {
21324         if (taskTail)
21325           taskTail._next = this;
21326         else
21327           taskHead = this;
21328         taskTail = this;
21329       }
21330       this._call = callback;
21331       this._time = time;
21332       sleep();
21333     },
21334     stop: function() {
21335       if (this._call) {
21336         this._call = null;
21337         this._time = Infinity;
21338         sleep();
21339       }
21340     }
21341   };
21342   function timer(callback, delay, time) {
21343     var t2 = new Timer();
21344     t2.restart(callback, delay, time);
21345     return t2;
21346   }
21347   function timerFlush() {
21348     now();
21349     ++frame;
21350     var t2 = taskHead, e3;
21351     while (t2) {
21352       if ((e3 = clockNow - t2._time) >= 0)
21353         t2._call.call(void 0, e3);
21354       t2 = t2._next;
21355     }
21356     --frame;
21357   }
21358   function wake() {
21359     clockNow = (clockLast = clock.now()) + clockSkew;
21360     frame = timeout = 0;
21361     try {
21362       timerFlush();
21363     } finally {
21364       frame = 0;
21365       nap();
21366       clockNow = 0;
21367     }
21368   }
21369   function poke() {
21370     var now3 = clock.now(), delay = now3 - clockLast;
21371     if (delay > pokeDelay)
21372       clockSkew -= delay, clockLast = now3;
21373   }
21374   function nap() {
21375     var t0, t1 = taskHead, t2, time = Infinity;
21376     while (t1) {
21377       if (t1._call) {
21378         if (time > t1._time)
21379           time = t1._time;
21380         t0 = t1, t1 = t1._next;
21381       } else {
21382         t2 = t1._next, t1._next = null;
21383         t1 = t0 ? t0._next = t2 : taskHead = t2;
21384       }
21385     }
21386     taskTail = t0;
21387     sleep(time);
21388   }
21389   function sleep(time) {
21390     if (frame)
21391       return;
21392     if (timeout)
21393       timeout = clearTimeout(timeout);
21394     var delay = time - clockNow;
21395     if (delay > 24) {
21396       if (time < Infinity)
21397         timeout = setTimeout(wake, time - clock.now() - clockSkew);
21398       if (interval)
21399         interval = clearInterval(interval);
21400     } else {
21401       if (!interval)
21402         clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
21403       frame = 1, setFrame(wake);
21404     }
21405   }
21406
21407   // node_modules/d3-timer/src/timeout.js
21408   function timeout_default(callback, delay, time) {
21409     var t2 = new Timer();
21410     delay = delay == null ? 0 : +delay;
21411     t2.restart((elapsed) => {
21412       t2.stop();
21413       callback(elapsed + delay);
21414     }, delay, time);
21415     return t2;
21416   }
21417
21418   // node_modules/d3-transition/src/transition/schedule.js
21419   var emptyOn = dispatch_default("start", "end", "cancel", "interrupt");
21420   var emptyTween = [];
21421   var CREATED = 0;
21422   var SCHEDULED = 1;
21423   var STARTING = 2;
21424   var STARTED = 3;
21425   var RUNNING = 4;
21426   var ENDING = 5;
21427   var ENDED = 6;
21428   function schedule_default(node, name, id2, index, group, timing) {
21429     var schedules = node.__transition;
21430     if (!schedules)
21431       node.__transition = {};
21432     else if (id2 in schedules)
21433       return;
21434     create(node, id2, {
21435       name,
21436       index,
21437       // For context during callback.
21438       group,
21439       // For context during callback.
21440       on: emptyOn,
21441       tween: emptyTween,
21442       time: timing.time,
21443       delay: timing.delay,
21444       duration: timing.duration,
21445       ease: timing.ease,
21446       timer: null,
21447       state: CREATED
21448     });
21449   }
21450   function init(node, id2) {
21451     var schedule = get2(node, id2);
21452     if (schedule.state > CREATED)
21453       throw new Error("too late; already scheduled");
21454     return schedule;
21455   }
21456   function set2(node, id2) {
21457     var schedule = get2(node, id2);
21458     if (schedule.state > STARTED)
21459       throw new Error("too late; already running");
21460     return schedule;
21461   }
21462   function get2(node, id2) {
21463     var schedule = node.__transition;
21464     if (!schedule || !(schedule = schedule[id2]))
21465       throw new Error("transition not found");
21466     return schedule;
21467   }
21468   function create(node, id2, self2) {
21469     var schedules = node.__transition, tween;
21470     schedules[id2] = self2;
21471     self2.timer = timer(schedule, 0, self2.time);
21472     function schedule(elapsed) {
21473       self2.state = SCHEDULED;
21474       self2.timer.restart(start2, self2.delay, self2.time);
21475       if (self2.delay <= elapsed)
21476         start2(elapsed - self2.delay);
21477     }
21478     function start2(elapsed) {
21479       var i3, j3, n3, o2;
21480       if (self2.state !== SCHEDULED)
21481         return stop();
21482       for (i3 in schedules) {
21483         o2 = schedules[i3];
21484         if (o2.name !== self2.name)
21485           continue;
21486         if (o2.state === STARTED)
21487           return timeout_default(start2);
21488         if (o2.state === RUNNING) {
21489           o2.state = ENDED;
21490           o2.timer.stop();
21491           o2.on.call("interrupt", node, node.__data__, o2.index, o2.group);
21492           delete schedules[i3];
21493         } else if (+i3 < id2) {
21494           o2.state = ENDED;
21495           o2.timer.stop();
21496           o2.on.call("cancel", node, node.__data__, o2.index, o2.group);
21497           delete schedules[i3];
21498         }
21499       }
21500       timeout_default(function() {
21501         if (self2.state === STARTED) {
21502           self2.state = RUNNING;
21503           self2.timer.restart(tick, self2.delay, self2.time);
21504           tick(elapsed);
21505         }
21506       });
21507       self2.state = STARTING;
21508       self2.on.call("start", node, node.__data__, self2.index, self2.group);
21509       if (self2.state !== STARTING)
21510         return;
21511       self2.state = STARTED;
21512       tween = new Array(n3 = self2.tween.length);
21513       for (i3 = 0, j3 = -1; i3 < n3; ++i3) {
21514         if (o2 = self2.tween[i3].value.call(node, node.__data__, self2.index, self2.group)) {
21515           tween[++j3] = o2;
21516         }
21517       }
21518       tween.length = j3 + 1;
21519     }
21520     function tick(elapsed) {
21521       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;
21522       while (++i3 < n3) {
21523         tween[i3].call(node, t2);
21524       }
21525       if (self2.state === ENDING) {
21526         self2.on.call("end", node, node.__data__, self2.index, self2.group);
21527         stop();
21528       }
21529     }
21530     function stop() {
21531       self2.state = ENDED;
21532       self2.timer.stop();
21533       delete schedules[id2];
21534       for (var i3 in schedules)
21535         return;
21536       delete node.__transition;
21537     }
21538   }
21539
21540   // node_modules/d3-transition/src/interrupt.js
21541   function interrupt_default(node, name) {
21542     var schedules = node.__transition, schedule, active, empty2 = true, i3;
21543     if (!schedules)
21544       return;
21545     name = name == null ? null : name + "";
21546     for (i3 in schedules) {
21547       if ((schedule = schedules[i3]).name !== name) {
21548         empty2 = false;
21549         continue;
21550       }
21551       active = schedule.state > STARTING && schedule.state < ENDING;
21552       schedule.state = ENDED;
21553       schedule.timer.stop();
21554       schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
21555       delete schedules[i3];
21556     }
21557     if (empty2)
21558       delete node.__transition;
21559   }
21560
21561   // node_modules/d3-transition/src/selection/interrupt.js
21562   function interrupt_default2(name) {
21563     return this.each(function() {
21564       interrupt_default(this, name);
21565     });
21566   }
21567
21568   // node_modules/d3-transition/src/transition/tween.js
21569   function tweenRemove(id2, name) {
21570     var tween0, tween1;
21571     return function() {
21572       var schedule = set2(this, id2), tween = schedule.tween;
21573       if (tween !== tween0) {
21574         tween1 = tween0 = tween;
21575         for (var i3 = 0, n3 = tween1.length; i3 < n3; ++i3) {
21576           if (tween1[i3].name === name) {
21577             tween1 = tween1.slice();
21578             tween1.splice(i3, 1);
21579             break;
21580           }
21581         }
21582       }
21583       schedule.tween = tween1;
21584     };
21585   }
21586   function tweenFunction(id2, name, value) {
21587     var tween0, tween1;
21588     if (typeof value !== "function")
21589       throw new Error();
21590     return function() {
21591       var schedule = set2(this, id2), tween = schedule.tween;
21592       if (tween !== tween0) {
21593         tween1 = (tween0 = tween).slice();
21594         for (var t2 = { name, value }, i3 = 0, n3 = tween1.length; i3 < n3; ++i3) {
21595           if (tween1[i3].name === name) {
21596             tween1[i3] = t2;
21597             break;
21598           }
21599         }
21600         if (i3 === n3)
21601           tween1.push(t2);
21602       }
21603       schedule.tween = tween1;
21604     };
21605   }
21606   function tween_default(name, value) {
21607     var id2 = this._id;
21608     name += "";
21609     if (arguments.length < 2) {
21610       var tween = get2(this.node(), id2).tween;
21611       for (var i3 = 0, n3 = tween.length, t2; i3 < n3; ++i3) {
21612         if ((t2 = tween[i3]).name === name) {
21613           return t2.value;
21614         }
21615       }
21616       return null;
21617     }
21618     return this.each((value == null ? tweenRemove : tweenFunction)(id2, name, value));
21619   }
21620   function tweenValue(transition2, name, value) {
21621     var id2 = transition2._id;
21622     transition2.each(function() {
21623       var schedule = set2(this, id2);
21624       (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
21625     });
21626     return function(node) {
21627       return get2(node, id2).value[name];
21628     };
21629   }
21630
21631   // node_modules/d3-transition/src/transition/interpolate.js
21632   function interpolate_default(a2, b2) {
21633     var c2;
21634     return (typeof b2 === "number" ? number_default : b2 instanceof color ? rgb_default : (c2 = color(b2)) ? (b2 = c2, rgb_default) : string_default)(a2, b2);
21635   }
21636
21637   // node_modules/d3-transition/src/transition/attr.js
21638   function attrRemove2(name) {
21639     return function() {
21640       this.removeAttribute(name);
21641     };
21642   }
21643   function attrRemoveNS2(fullname) {
21644     return function() {
21645       this.removeAttributeNS(fullname.space, fullname.local);
21646     };
21647   }
21648   function attrConstant2(name, interpolate, value1) {
21649     var string00, string1 = value1 + "", interpolate0;
21650     return function() {
21651       var string0 = this.getAttribute(name);
21652       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21653     };
21654   }
21655   function attrConstantNS2(fullname, interpolate, value1) {
21656     var string00, string1 = value1 + "", interpolate0;
21657     return function() {
21658       var string0 = this.getAttributeNS(fullname.space, fullname.local);
21659       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21660     };
21661   }
21662   function attrFunction2(name, interpolate, value) {
21663     var string00, string10, interpolate0;
21664     return function() {
21665       var string0, value1 = value(this), string1;
21666       if (value1 == null)
21667         return void this.removeAttribute(name);
21668       string0 = this.getAttribute(name);
21669       string1 = value1 + "";
21670       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21671     };
21672   }
21673   function attrFunctionNS2(fullname, interpolate, value) {
21674     var string00, string10, interpolate0;
21675     return function() {
21676       var string0, value1 = value(this), string1;
21677       if (value1 == null)
21678         return void this.removeAttributeNS(fullname.space, fullname.local);
21679       string0 = this.getAttributeNS(fullname.space, fullname.local);
21680       string1 = value1 + "";
21681       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21682     };
21683   }
21684   function attr_default2(name, value) {
21685     var fullname = namespace_default(name), i3 = fullname === "transform" ? interpolateTransformSvg : interpolate_default;
21686     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));
21687   }
21688
21689   // node_modules/d3-transition/src/transition/attrTween.js
21690   function attrInterpolate(name, i3) {
21691     return function(t2) {
21692       this.setAttribute(name, i3.call(this, t2));
21693     };
21694   }
21695   function attrInterpolateNS(fullname, i3) {
21696     return function(t2) {
21697       this.setAttributeNS(fullname.space, fullname.local, i3.call(this, t2));
21698     };
21699   }
21700   function attrTweenNS(fullname, value) {
21701     var t0, i0;
21702     function tween() {
21703       var i3 = value.apply(this, arguments);
21704       if (i3 !== i0)
21705         t0 = (i0 = i3) && attrInterpolateNS(fullname, i3);
21706       return t0;
21707     }
21708     tween._value = value;
21709     return tween;
21710   }
21711   function attrTween(name, value) {
21712     var t0, i0;
21713     function tween() {
21714       var i3 = value.apply(this, arguments);
21715       if (i3 !== i0)
21716         t0 = (i0 = i3) && attrInterpolate(name, i3);
21717       return t0;
21718     }
21719     tween._value = value;
21720     return tween;
21721   }
21722   function attrTween_default(name, value) {
21723     var key = "attr." + name;
21724     if (arguments.length < 2)
21725       return (key = this.tween(key)) && key._value;
21726     if (value == null)
21727       return this.tween(key, null);
21728     if (typeof value !== "function")
21729       throw new Error();
21730     var fullname = namespace_default(name);
21731     return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
21732   }
21733
21734   // node_modules/d3-transition/src/transition/delay.js
21735   function delayFunction(id2, value) {
21736     return function() {
21737       init(this, id2).delay = +value.apply(this, arguments);
21738     };
21739   }
21740   function delayConstant(id2, value) {
21741     return value = +value, function() {
21742       init(this, id2).delay = value;
21743     };
21744   }
21745   function delay_default(value) {
21746     var id2 = this._id;
21747     return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id2, value)) : get2(this.node(), id2).delay;
21748   }
21749
21750   // node_modules/d3-transition/src/transition/duration.js
21751   function durationFunction(id2, value) {
21752     return function() {
21753       set2(this, id2).duration = +value.apply(this, arguments);
21754     };
21755   }
21756   function durationConstant(id2, value) {
21757     return value = +value, function() {
21758       set2(this, id2).duration = value;
21759     };
21760   }
21761   function duration_default(value) {
21762     var id2 = this._id;
21763     return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id2, value)) : get2(this.node(), id2).duration;
21764   }
21765
21766   // node_modules/d3-transition/src/transition/ease.js
21767   function easeConstant(id2, value) {
21768     if (typeof value !== "function")
21769       throw new Error();
21770     return function() {
21771       set2(this, id2).ease = value;
21772     };
21773   }
21774   function ease_default(value) {
21775     var id2 = this._id;
21776     return arguments.length ? this.each(easeConstant(id2, value)) : get2(this.node(), id2).ease;
21777   }
21778
21779   // node_modules/d3-transition/src/transition/easeVarying.js
21780   function easeVarying(id2, value) {
21781     return function() {
21782       var v2 = value.apply(this, arguments);
21783       if (typeof v2 !== "function")
21784         throw new Error();
21785       set2(this, id2).ease = v2;
21786     };
21787   }
21788   function easeVarying_default(value) {
21789     if (typeof value !== "function")
21790       throw new Error();
21791     return this.each(easeVarying(this._id, value));
21792   }
21793
21794   // node_modules/d3-transition/src/transition/filter.js
21795   function filter_default2(match) {
21796     if (typeof match !== "function")
21797       match = matcher_default(match);
21798     for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j3 = 0; j3 < m2; ++j3) {
21799       for (var group = groups[j3], n3 = group.length, subgroup = subgroups[j3] = [], node, i3 = 0; i3 < n3; ++i3) {
21800         if ((node = group[i3]) && match.call(node, node.__data__, i3, group)) {
21801           subgroup.push(node);
21802         }
21803       }
21804     }
21805     return new Transition(subgroups, this._parents, this._name, this._id);
21806   }
21807
21808   // node_modules/d3-transition/src/transition/merge.js
21809   function merge_default2(transition2) {
21810     if (transition2._id !== this._id)
21811       throw new Error();
21812     for (var groups0 = this._groups, groups1 = transition2._groups, m0 = groups0.length, m1 = groups1.length, m2 = Math.min(m0, m1), merges = new Array(m0), j3 = 0; j3 < m2; ++j3) {
21813       for (var group0 = groups0[j3], group1 = groups1[j3], n3 = group0.length, merge2 = merges[j3] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
21814         if (node = group0[i3] || group1[i3]) {
21815           merge2[i3] = node;
21816         }
21817       }
21818     }
21819     for (; j3 < m0; ++j3) {
21820       merges[j3] = groups0[j3];
21821     }
21822     return new Transition(merges, this._parents, this._name, this._id);
21823   }
21824
21825   // node_modules/d3-transition/src/transition/on.js
21826   function start(name) {
21827     return (name + "").trim().split(/^|\s+/).every(function(t2) {
21828       var i3 = t2.indexOf(".");
21829       if (i3 >= 0)
21830         t2 = t2.slice(0, i3);
21831       return !t2 || t2 === "start";
21832     });
21833   }
21834   function onFunction(id2, name, listener) {
21835     var on0, on1, sit = start(name) ? init : set2;
21836     return function() {
21837       var schedule = sit(this, id2), on = schedule.on;
21838       if (on !== on0)
21839         (on1 = (on0 = on).copy()).on(name, listener);
21840       schedule.on = on1;
21841     };
21842   }
21843   function on_default2(name, listener) {
21844     var id2 = this._id;
21845     return arguments.length < 2 ? get2(this.node(), id2).on.on(name) : this.each(onFunction(id2, name, listener));
21846   }
21847
21848   // node_modules/d3-transition/src/transition/remove.js
21849   function removeFunction(id2) {
21850     return function() {
21851       var parent = this.parentNode;
21852       for (var i3 in this.__transition)
21853         if (+i3 !== id2)
21854           return;
21855       if (parent)
21856         parent.removeChild(this);
21857     };
21858   }
21859   function remove_default2() {
21860     return this.on("end.remove", removeFunction(this._id));
21861   }
21862
21863   // node_modules/d3-transition/src/transition/select.js
21864   function select_default3(select) {
21865     var name = this._name, id2 = this._id;
21866     if (typeof select !== "function")
21867       select = selector_default(select);
21868     for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j3 = 0; j3 < m2; ++j3) {
21869       for (var group = groups[j3], n3 = group.length, subgroup = subgroups[j3] = new Array(n3), node, subnode, i3 = 0; i3 < n3; ++i3) {
21870         if ((node = group[i3]) && (subnode = select.call(node, node.__data__, i3, group))) {
21871           if ("__data__" in node)
21872             subnode.__data__ = node.__data__;
21873           subgroup[i3] = subnode;
21874           schedule_default(subgroup[i3], name, id2, i3, subgroup, get2(node, id2));
21875         }
21876       }
21877     }
21878     return new Transition(subgroups, this._parents, name, id2);
21879   }
21880
21881   // node_modules/d3-transition/src/transition/selectAll.js
21882   function selectAll_default3(select) {
21883     var name = this._name, id2 = this._id;
21884     if (typeof select !== "function")
21885       select = selectorAll_default(select);
21886     for (var groups = this._groups, m2 = groups.length, subgroups = [], parents = [], j3 = 0; j3 < m2; ++j3) {
21887       for (var group = groups[j3], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
21888         if (node = group[i3]) {
21889           for (var children2 = select.call(node, node.__data__, i3, group), child, inherit2 = get2(node, id2), k2 = 0, l2 = children2.length; k2 < l2; ++k2) {
21890             if (child = children2[k2]) {
21891               schedule_default(child, name, id2, k2, children2, inherit2);
21892             }
21893           }
21894           subgroups.push(children2);
21895           parents.push(node);
21896         }
21897       }
21898     }
21899     return new Transition(subgroups, parents, name, id2);
21900   }
21901
21902   // node_modules/d3-transition/src/transition/selection.js
21903   var Selection2 = selection_default.prototype.constructor;
21904   function selection_default2() {
21905     return new Selection2(this._groups, this._parents);
21906   }
21907
21908   // node_modules/d3-transition/src/transition/style.js
21909   function styleNull(name, interpolate) {
21910     var string00, string10, interpolate0;
21911     return function() {
21912       var string0 = styleValue(this, name), string1 = (this.style.removeProperty(name), styleValue(this, name));
21913       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate(string00 = string0, string10 = string1);
21914     };
21915   }
21916   function styleRemove2(name) {
21917     return function() {
21918       this.style.removeProperty(name);
21919     };
21920   }
21921   function styleConstant2(name, interpolate, value1) {
21922     var string00, string1 = value1 + "", interpolate0;
21923     return function() {
21924       var string0 = styleValue(this, name);
21925       return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21926     };
21927   }
21928   function styleFunction2(name, interpolate, value) {
21929     var string00, string10, interpolate0;
21930     return function() {
21931       var string0 = styleValue(this, name), value1 = value(this), string1 = value1 + "";
21932       if (value1 == null)
21933         string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
21934       return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21935     };
21936   }
21937   function styleMaybeRemove(id2, name) {
21938     var on0, on1, listener0, key = "style." + name, event = "end." + key, remove2;
21939     return function() {
21940       var schedule = set2(this, id2), on = schedule.on, listener = schedule.value[key] == null ? remove2 || (remove2 = styleRemove2(name)) : void 0;
21941       if (on !== on0 || listener0 !== listener)
21942         (on1 = (on0 = on).copy()).on(event, listener0 = listener);
21943       schedule.on = on1;
21944     };
21945   }
21946   function style_default2(name, value, priority) {
21947     var i3 = (name += "") === "transform" ? interpolateTransformCss : interpolate_default;
21948     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);
21949   }
21950
21951   // node_modules/d3-transition/src/transition/styleTween.js
21952   function styleInterpolate(name, i3, priority) {
21953     return function(t2) {
21954       this.style.setProperty(name, i3.call(this, t2), priority);
21955     };
21956   }
21957   function styleTween(name, value, priority) {
21958     var t2, i0;
21959     function tween() {
21960       var i3 = value.apply(this, arguments);
21961       if (i3 !== i0)
21962         t2 = (i0 = i3) && styleInterpolate(name, i3, priority);
21963       return t2;
21964     }
21965     tween._value = value;
21966     return tween;
21967   }
21968   function styleTween_default(name, value, priority) {
21969     var key = "style." + (name += "");
21970     if (arguments.length < 2)
21971       return (key = this.tween(key)) && key._value;
21972     if (value == null)
21973       return this.tween(key, null);
21974     if (typeof value !== "function")
21975       throw new Error();
21976     return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
21977   }
21978
21979   // node_modules/d3-transition/src/transition/text.js
21980   function textConstant2(value) {
21981     return function() {
21982       this.textContent = value;
21983     };
21984   }
21985   function textFunction2(value) {
21986     return function() {
21987       var value1 = value(this);
21988       this.textContent = value1 == null ? "" : value1;
21989     };
21990   }
21991   function text_default2(value) {
21992     return this.tween("text", typeof value === "function" ? textFunction2(tweenValue(this, "text", value)) : textConstant2(value == null ? "" : value + ""));
21993   }
21994
21995   // node_modules/d3-transition/src/transition/textTween.js
21996   function textInterpolate(i3) {
21997     return function(t2) {
21998       this.textContent = i3.call(this, t2);
21999     };
22000   }
22001   function textTween(value) {
22002     var t0, i0;
22003     function tween() {
22004       var i3 = value.apply(this, arguments);
22005       if (i3 !== i0)
22006         t0 = (i0 = i3) && textInterpolate(i3);
22007       return t0;
22008     }
22009     tween._value = value;
22010     return tween;
22011   }
22012   function textTween_default(value) {
22013     var key = "text";
22014     if (arguments.length < 1)
22015       return (key = this.tween(key)) && key._value;
22016     if (value == null)
22017       return this.tween(key, null);
22018     if (typeof value !== "function")
22019       throw new Error();
22020     return this.tween(key, textTween(value));
22021   }
22022
22023   // node_modules/d3-transition/src/transition/transition.js
22024   function transition_default() {
22025     var name = this._name, id0 = this._id, id1 = newId();
22026     for (var groups = this._groups, m2 = groups.length, j3 = 0; j3 < m2; ++j3) {
22027       for (var group = groups[j3], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
22028         if (node = group[i3]) {
22029           var inherit2 = get2(node, id0);
22030           schedule_default(node, name, id1, i3, group, {
22031             time: inherit2.time + inherit2.delay + inherit2.duration,
22032             delay: 0,
22033             duration: inherit2.duration,
22034             ease: inherit2.ease
22035           });
22036         }
22037       }
22038     }
22039     return new Transition(groups, this._parents, name, id1);
22040   }
22041
22042   // node_modules/d3-transition/src/transition/end.js
22043   function end_default() {
22044     var on0, on1, that = this, id2 = that._id, size = that.size();
22045     return new Promise(function(resolve, reject) {
22046       var cancel = { value: reject }, end = { value: function() {
22047         if (--size === 0)
22048           resolve();
22049       } };
22050       that.each(function() {
22051         var schedule = set2(this, id2), on = schedule.on;
22052         if (on !== on0) {
22053           on1 = (on0 = on).copy();
22054           on1._.cancel.push(cancel);
22055           on1._.interrupt.push(cancel);
22056           on1._.end.push(end);
22057         }
22058         schedule.on = on1;
22059       });
22060       if (size === 0)
22061         resolve();
22062     });
22063   }
22064
22065   // node_modules/d3-transition/src/transition/index.js
22066   var id = 0;
22067   function Transition(groups, parents, name, id2) {
22068     this._groups = groups;
22069     this._parents = parents;
22070     this._name = name;
22071     this._id = id2;
22072   }
22073   function transition(name) {
22074     return selection_default().transition(name);
22075   }
22076   function newId() {
22077     return ++id;
22078   }
22079   var selection_prototype = selection_default.prototype;
22080   Transition.prototype = transition.prototype = {
22081     constructor: Transition,
22082     select: select_default3,
22083     selectAll: selectAll_default3,
22084     selectChild: selection_prototype.selectChild,
22085     selectChildren: selection_prototype.selectChildren,
22086     filter: filter_default2,
22087     merge: merge_default2,
22088     selection: selection_default2,
22089     transition: transition_default,
22090     call: selection_prototype.call,
22091     nodes: selection_prototype.nodes,
22092     node: selection_prototype.node,
22093     size: selection_prototype.size,
22094     empty: selection_prototype.empty,
22095     each: selection_prototype.each,
22096     on: on_default2,
22097     attr: attr_default2,
22098     attrTween: attrTween_default,
22099     style: style_default2,
22100     styleTween: styleTween_default,
22101     text: text_default2,
22102     textTween: textTween_default,
22103     remove: remove_default2,
22104     tween: tween_default,
22105     delay: delay_default,
22106     duration: duration_default,
22107     ease: ease_default,
22108     easeVarying: easeVarying_default,
22109     end: end_default,
22110     [Symbol.iterator]: selection_prototype[Symbol.iterator]
22111   };
22112
22113   // node_modules/d3-ease/src/linear.js
22114   var linear2 = (t2) => +t2;
22115
22116   // node_modules/d3-ease/src/cubic.js
22117   function cubicInOut(t2) {
22118     return ((t2 *= 2) <= 1 ? t2 * t2 * t2 : (t2 -= 2) * t2 * t2 + 2) / 2;
22119   }
22120
22121   // node_modules/d3-transition/src/selection/transition.js
22122   var defaultTiming = {
22123     time: null,
22124     // Set on use.
22125     delay: 0,
22126     duration: 250,
22127     ease: cubicInOut
22128   };
22129   function inherit(node, id2) {
22130     var timing;
22131     while (!(timing = node.__transition) || !(timing = timing[id2])) {
22132       if (!(node = node.parentNode)) {
22133         throw new Error("transition ".concat(id2, " not found"));
22134       }
22135     }
22136     return timing;
22137   }
22138   function transition_default2(name) {
22139     var id2, timing;
22140     if (name instanceof Transition) {
22141       id2 = name._id, name = name._name;
22142     } else {
22143       id2 = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
22144     }
22145     for (var groups = this._groups, m2 = groups.length, j3 = 0; j3 < m2; ++j3) {
22146       for (var group = groups[j3], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
22147         if (node = group[i3]) {
22148           schedule_default(node, name, id2, i3, group, timing || inherit(node, id2));
22149         }
22150       }
22151     }
22152     return new Transition(groups, this._parents, name, id2);
22153   }
22154
22155   // node_modules/d3-transition/src/selection/index.js
22156   selection_default.prototype.interrupt = interrupt_default2;
22157   selection_default.prototype.transition = transition_default2;
22158
22159   // node_modules/d3-zoom/src/constant.js
22160   var constant_default4 = (x2) => () => x2;
22161
22162   // node_modules/d3-zoom/src/event.js
22163   function ZoomEvent(type2, {
22164     sourceEvent,
22165     target,
22166     transform: transform2,
22167     dispatch: dispatch14
22168   }) {
22169     Object.defineProperties(this, {
22170       type: { value: type2, enumerable: true, configurable: true },
22171       sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
22172       target: { value: target, enumerable: true, configurable: true },
22173       transform: { value: transform2, enumerable: true, configurable: true },
22174       _: { value: dispatch14 }
22175     });
22176   }
22177
22178   // node_modules/d3-zoom/src/transform.js
22179   function Transform(k2, x2, y2) {
22180     this.k = k2;
22181     this.x = x2;
22182     this.y = y2;
22183   }
22184   Transform.prototype = {
22185     constructor: Transform,
22186     scale: function(k2) {
22187       return k2 === 1 ? this : new Transform(this.k * k2, this.x, this.y);
22188     },
22189     translate: function(x2, y2) {
22190       return x2 === 0 & y2 === 0 ? this : new Transform(this.k, this.x + this.k * x2, this.y + this.k * y2);
22191     },
22192     apply: function(point2) {
22193       return [point2[0] * this.k + this.x, point2[1] * this.k + this.y];
22194     },
22195     applyX: function(x2) {
22196       return x2 * this.k + this.x;
22197     },
22198     applyY: function(y2) {
22199       return y2 * this.k + this.y;
22200     },
22201     invert: function(location) {
22202       return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
22203     },
22204     invertX: function(x2) {
22205       return (x2 - this.x) / this.k;
22206     },
22207     invertY: function(y2) {
22208       return (y2 - this.y) / this.k;
22209     },
22210     rescaleX: function(x2) {
22211       return x2.copy().domain(x2.range().map(this.invertX, this).map(x2.invert, x2));
22212     },
22213     rescaleY: function(y2) {
22214       return y2.copy().domain(y2.range().map(this.invertY, this).map(y2.invert, y2));
22215     },
22216     toString: function() {
22217       return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
22218     }
22219   };
22220   var identity2 = new Transform(1, 0, 0);
22221   transform.prototype = Transform.prototype;
22222   function transform(node) {
22223     while (!node.__zoom)
22224       if (!(node = node.parentNode))
22225         return identity2;
22226     return node.__zoom;
22227   }
22228
22229   // node_modules/d3-zoom/src/noevent.js
22230   function nopropagation2(event) {
22231     event.stopImmediatePropagation();
22232   }
22233   function noevent_default2(event) {
22234     event.preventDefault();
22235     event.stopImmediatePropagation();
22236   }
22237
22238   // node_modules/d3-zoom/src/zoom.js
22239   function defaultFilter2(event) {
22240     return (!event.ctrlKey || event.type === "wheel") && !event.button;
22241   }
22242   function defaultExtent() {
22243     var e3 = this;
22244     if (e3 instanceof SVGElement) {
22245       e3 = e3.ownerSVGElement || e3;
22246       if (e3.hasAttribute("viewBox")) {
22247         e3 = e3.viewBox.baseVal;
22248         return [[e3.x, e3.y], [e3.x + e3.width, e3.y + e3.height]];
22249       }
22250       return [[0, 0], [e3.width.baseVal.value, e3.height.baseVal.value]];
22251     }
22252     return [[0, 0], [e3.clientWidth, e3.clientHeight]];
22253   }
22254   function defaultTransform() {
22255     return this.__zoom || identity2;
22256   }
22257   function defaultWheelDelta(event) {
22258     return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 2e-3) * (event.ctrlKey ? 10 : 1);
22259   }
22260   function defaultTouchable2() {
22261     return navigator.maxTouchPoints || "ontouchstart" in this;
22262   }
22263   function defaultConstrain(transform2, extent, translateExtent) {
22264     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];
22265     return transform2.translate(
22266       dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
22267       dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
22268     );
22269   }
22270   function zoom_default2() {
22271     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;
22272     function zoom(selection2) {
22273       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)");
22274     }
22275     zoom.transform = function(collection, transform2, point2, event) {
22276       var selection2 = collection.selection ? collection.selection() : collection;
22277       selection2.property("__zoom", defaultTransform);
22278       if (collection !== selection2) {
22279         schedule(collection, transform2, point2, event);
22280       } else {
22281         selection2.interrupt().each(function() {
22282           gesture(this, arguments).event(event).start().zoom(null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end();
22283         });
22284       }
22285     };
22286     zoom.scaleBy = function(selection2, k2, p2, event) {
22287       zoom.scaleTo(selection2, function() {
22288         var k0 = this.__zoom.k, k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
22289         return k0 * k1;
22290       }, p2, event);
22291     };
22292     zoom.scaleTo = function(selection2, k2, p2, event) {
22293       zoom.transform(selection2, function() {
22294         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;
22295         return constrain(translate(scale(t0, k1), p02, p1), e3, translateExtent);
22296       }, p2, event);
22297     };
22298     zoom.translateBy = function(selection2, x2, y2, event) {
22299       zoom.transform(selection2, function() {
22300         return constrain(this.__zoom.translate(
22301           typeof x2 === "function" ? x2.apply(this, arguments) : x2,
22302           typeof y2 === "function" ? y2.apply(this, arguments) : y2
22303         ), extent.apply(this, arguments), translateExtent);
22304       }, null, event);
22305     };
22306     zoom.translateTo = function(selection2, x2, y2, p2, event) {
22307       zoom.transform(selection2, function() {
22308         var e3 = extent.apply(this, arguments), t2 = this.__zoom, p02 = p2 == null ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
22309         return constrain(identity2.translate(p02[0], p02[1]).scale(t2.k).translate(
22310           typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
22311           typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
22312         ), e3, translateExtent);
22313       }, p2, event);
22314     };
22315     function scale(transform2, k2) {
22316       k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2));
22317       return k2 === transform2.k ? transform2 : new Transform(k2, transform2.x, transform2.y);
22318     }
22319     function translate(transform2, p02, p1) {
22320       var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k;
22321       return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
22322     }
22323     function centroid(extent2) {
22324       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
22325     }
22326     function schedule(transition2, transform2, point2, event) {
22327       transition2.on("start.zoom", function() {
22328         gesture(this, arguments).event(event).start();
22329       }).on("interrupt.zoom end.zoom", function() {
22330         gesture(this, arguments).event(event).end();
22331       }).tween("zoom", function() {
22332         var that = this, args = arguments, g3 = gesture(that, args).event(event), e3 = extent.apply(that, args), p2 = point2 == null ? centroid(e3) : typeof point2 === "function" ? point2.apply(that, args) : point2, w2 = Math.max(e3[1][0] - e3[0][0], e3[1][1] - e3[0][1]), a2 = that.__zoom, b2 = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i3 = interpolate(a2.invert(p2).concat(w2 / a2.k), b2.invert(p2).concat(w2 / b2.k));
22333         return function(t2) {
22334           if (t2 === 1)
22335             t2 = b2;
22336           else {
22337             var l2 = i3(t2), k2 = w2 / l2[2];
22338             t2 = new Transform(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
22339           }
22340           g3.zoom(null, t2);
22341         };
22342       });
22343     }
22344     function gesture(that, args, clean2) {
22345       return !clean2 && that.__zooming || new Gesture(that, args);
22346     }
22347     function Gesture(that, args) {
22348       this.that = that;
22349       this.args = args;
22350       this.active = 0;
22351       this.sourceEvent = null;
22352       this.extent = extent.apply(that, args);
22353       this.taps = 0;
22354     }
22355     Gesture.prototype = {
22356       event: function(event) {
22357         if (event)
22358           this.sourceEvent = event;
22359         return this;
22360       },
22361       start: function() {
22362         if (++this.active === 1) {
22363           this.that.__zooming = this;
22364           this.emit("start");
22365         }
22366         return this;
22367       },
22368       zoom: function(key, transform2) {
22369         if (this.mouse && key !== "mouse")
22370           this.mouse[1] = transform2.invert(this.mouse[0]);
22371         if (this.touch0 && key !== "touch")
22372           this.touch0[1] = transform2.invert(this.touch0[0]);
22373         if (this.touch1 && key !== "touch")
22374           this.touch1[1] = transform2.invert(this.touch1[0]);
22375         this.that.__zoom = transform2;
22376         this.emit("zoom");
22377         return this;
22378       },
22379       end: function() {
22380         if (--this.active === 0) {
22381           delete this.that.__zooming;
22382           this.emit("end");
22383         }
22384         return this;
22385       },
22386       emit: function(type2) {
22387         var d2 = select_default2(this.that).datum();
22388         listeners.call(
22389           type2,
22390           this.that,
22391           new ZoomEvent(type2, {
22392             sourceEvent: this.sourceEvent,
22393             target: zoom,
22394             type: type2,
22395             transform: this.that.__zoom,
22396             dispatch: listeners
22397           }),
22398           d2
22399         );
22400       }
22401     };
22402     function wheeled(event, ...args) {
22403       if (!filter2.apply(this, arguments))
22404         return;
22405       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);
22406       if (g3.wheel) {
22407         if (g3.mouse[0][0] !== p2[0] || g3.mouse[0][1] !== p2[1]) {
22408           g3.mouse[1] = t2.invert(g3.mouse[0] = p2);
22409         }
22410         clearTimeout(g3.wheel);
22411       } else if (t2.k === k2)
22412         return;
22413       else {
22414         g3.mouse = [p2, t2.invert(p2)];
22415         interrupt_default(this);
22416         g3.start();
22417       }
22418       noevent_default2(event);
22419       g3.wheel = setTimeout(wheelidled, wheelDelay);
22420       g3.zoom("mouse", constrain(translate(scale(t2, k2), g3.mouse[0], g3.mouse[1]), g3.extent, translateExtent));
22421       function wheelidled() {
22422         g3.wheel = null;
22423         g3.end();
22424       }
22425     }
22426     function mousedowned(event, ...args) {
22427       if (touchending || !filter2.apply(this, arguments))
22428         return;
22429       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;
22430       nodrag_default(event.view);
22431       nopropagation2(event);
22432       g3.mouse = [p2, this.__zoom.invert(p2)];
22433       interrupt_default(this);
22434       g3.start();
22435       function mousemoved(event2) {
22436         noevent_default2(event2);
22437         if (!g3.moved) {
22438           var dx = event2.clientX - x05, dy = event2.clientY - y05;
22439           g3.moved = dx * dx + dy * dy > clickDistance2;
22440         }
22441         g3.event(event2).zoom("mouse", constrain(translate(g3.that.__zoom, g3.mouse[0] = pointer_default(event2, currentTarget), g3.mouse[1]), g3.extent, translateExtent));
22442       }
22443       function mouseupped(event2) {
22444         v2.on("mousemove.zoom mouseup.zoom", null);
22445         yesdrag(event2.view, g3.moved);
22446         noevent_default2(event2);
22447         g3.event(event2).end();
22448       }
22449     }
22450     function dblclicked(event, ...args) {
22451       if (!filter2.apply(this, arguments))
22452         return;
22453       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);
22454       noevent_default2(event);
22455       if (duration > 0)
22456         select_default2(this).transition().duration(duration).call(schedule, t1, p02, event);
22457       else
22458         select_default2(this).call(zoom.transform, t1, p02, event);
22459     }
22460     function touchstarted(event, ...args) {
22461       if (!filter2.apply(this, arguments))
22462         return;
22463       var touches = event.touches, n3 = touches.length, g3 = gesture(this, args, event.changedTouches.length === n3).event(event), started, i3, t2, p2;
22464       nopropagation2(event);
22465       for (i3 = 0; i3 < n3; ++i3) {
22466         t2 = touches[i3], p2 = pointer_default(t2, this);
22467         p2 = [p2, this.__zoom.invert(p2), t2.identifier];
22468         if (!g3.touch0)
22469           g3.touch0 = p2, started = true, g3.taps = 1 + !!touchstarting;
22470         else if (!g3.touch1 && g3.touch0[2] !== p2[2])
22471           g3.touch1 = p2, g3.taps = 0;
22472       }
22473       if (touchstarting)
22474         touchstarting = clearTimeout(touchstarting);
22475       if (started) {
22476         if (g3.taps < 2)
22477           touchfirst = p2[0], touchstarting = setTimeout(function() {
22478             touchstarting = null;
22479           }, touchDelay);
22480         interrupt_default(this);
22481         g3.start();
22482       }
22483     }
22484     function touchmoved(event, ...args) {
22485       if (!this.__zooming)
22486         return;
22487       var g3 = gesture(this, args).event(event), touches = event.changedTouches, n3 = touches.length, i3, t2, p2, l2;
22488       noevent_default2(event);
22489       for (i3 = 0; i3 < n3; ++i3) {
22490         t2 = touches[i3], p2 = pointer_default(t2, this);
22491         if (g3.touch0 && g3.touch0[2] === t2.identifier)
22492           g3.touch0[0] = p2;
22493         else if (g3.touch1 && g3.touch1[2] === t2.identifier)
22494           g3.touch1[0] = p2;
22495       }
22496       t2 = g3.that.__zoom;
22497       if (g3.touch1) {
22498         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;
22499         t2 = scale(t2, Math.sqrt(dp / dl));
22500         p2 = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
22501         l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
22502       } else if (g3.touch0)
22503         p2 = g3.touch0[0], l2 = g3.touch0[1];
22504       else
22505         return;
22506       g3.zoom("touch", constrain(translate(t2, p2, l2), g3.extent, translateExtent));
22507     }
22508     function touchended(event, ...args) {
22509       if (!this.__zooming)
22510         return;
22511       var g3 = gesture(this, args).event(event), touches = event.changedTouches, n3 = touches.length, i3, t2;
22512       nopropagation2(event);
22513       if (touchending)
22514         clearTimeout(touchending);
22515       touchending = setTimeout(function() {
22516         touchending = null;
22517       }, touchDelay);
22518       for (i3 = 0; i3 < n3; ++i3) {
22519         t2 = touches[i3];
22520         if (g3.touch0 && g3.touch0[2] === t2.identifier)
22521           delete g3.touch0;
22522         else if (g3.touch1 && g3.touch1[2] === t2.identifier)
22523           delete g3.touch1;
22524       }
22525       if (g3.touch1 && !g3.touch0)
22526         g3.touch0 = g3.touch1, delete g3.touch1;
22527       if (g3.touch0)
22528         g3.touch0[1] = this.__zoom.invert(g3.touch0[0]);
22529       else {
22530         g3.end();
22531         if (g3.taps === 2) {
22532           t2 = pointer_default(t2, this);
22533           if (Math.hypot(touchfirst[0] - t2[0], touchfirst[1] - t2[1]) < tapDistance) {
22534             var p2 = select_default2(this).on("dblclick.zoom");
22535             if (p2)
22536               p2.apply(this, arguments);
22537           }
22538         }
22539       }
22540     }
22541     zoom.wheelDelta = function(_2) {
22542       return arguments.length ? (wheelDelta = typeof _2 === "function" ? _2 : constant_default4(+_2), zoom) : wheelDelta;
22543     };
22544     zoom.filter = function(_2) {
22545       return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant_default4(!!_2), zoom) : filter2;
22546     };
22547     zoom.touchable = function(_2) {
22548       return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant_default4(!!_2), zoom) : touchable;
22549     };
22550     zoom.extent = function(_2) {
22551       return arguments.length ? (extent = typeof _2 === "function" ? _2 : constant_default4([[+_2[0][0], +_2[0][1]], [+_2[1][0], +_2[1][1]]]), zoom) : extent;
22552     };
22553     zoom.scaleExtent = function(_2) {
22554       return arguments.length ? (scaleExtent[0] = +_2[0], scaleExtent[1] = +_2[1], zoom) : [scaleExtent[0], scaleExtent[1]];
22555     };
22556     zoom.translateExtent = function(_2) {
22557       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]]];
22558     };
22559     zoom.constrain = function(_2) {
22560       return arguments.length ? (constrain = _2, zoom) : constrain;
22561     };
22562     zoom.duration = function(_2) {
22563       return arguments.length ? (duration = +_2, zoom) : duration;
22564     };
22565     zoom.interpolate = function(_2) {
22566       return arguments.length ? (interpolate = _2, zoom) : interpolate;
22567     };
22568     zoom.on = function() {
22569       var value = listeners.on.apply(listeners, arguments);
22570       return value === listeners ? zoom : value;
22571     };
22572     zoom.clickDistance = function(_2) {
22573       return arguments.length ? (clickDistance2 = (_2 = +_2) * _2, zoom) : Math.sqrt(clickDistance2);
22574     };
22575     zoom.tapDistance = function(_2) {
22576       return arguments.length ? (tapDistance = +_2, zoom) : tapDistance;
22577     };
22578     return zoom;
22579   }
22580
22581   // modules/geo/raw_mercator.js
22582   function geoRawMercator() {
22583     var project = mercatorRaw;
22584     var k2 = 512 / Math.PI;
22585     var x2 = 0;
22586     var y2 = 0;
22587     var clipExtent = [[0, 0], [0, 0]];
22588     function projection2(point2) {
22589       point2 = project(point2[0] * Math.PI / 180, point2[1] * Math.PI / 180);
22590       return [point2[0] * k2 + x2, y2 - point2[1] * k2];
22591     }
22592     projection2.invert = function(point2) {
22593       point2 = project.invert((point2[0] - x2) / k2, (y2 - point2[1]) / k2);
22594       return point2 && [point2[0] * 180 / Math.PI, point2[1] * 180 / Math.PI];
22595     };
22596     projection2.scale = function(_2) {
22597       if (!arguments.length)
22598         return k2;
22599       k2 = +_2;
22600       return projection2;
22601     };
22602     projection2.translate = function(_2) {
22603       if (!arguments.length)
22604         return [x2, y2];
22605       x2 = +_2[0];
22606       y2 = +_2[1];
22607       return projection2;
22608     };
22609     projection2.clipExtent = function(_2) {
22610       if (!arguments.length)
22611         return clipExtent;
22612       clipExtent = _2;
22613       return projection2;
22614     };
22615     projection2.transform = function(obj) {
22616       if (!arguments.length)
22617         return identity2.translate(x2, y2).scale(k2);
22618       x2 = +obj.x;
22619       y2 = +obj.y;
22620       k2 = +obj.k;
22621       return projection2;
22622     };
22623     projection2.stream = transform_default({
22624       point: function(x3, y3) {
22625         var vec = projection2([x3, y3]);
22626         this.stream.point(vec[0], vec[1]);
22627       }
22628     }).stream;
22629     return projection2;
22630   }
22631
22632   // modules/geo/ortho.js
22633   function geoOrthoNormalizedDotProduct(a2, b2, origin) {
22634     if (geoVecEqual(origin, a2) || geoVecEqual(origin, b2)) {
22635       return 1;
22636     }
22637     return geoVecNormalizedDot(a2, b2, origin);
22638   }
22639   function geoOrthoFilterDotProduct(dotp, epsilon3, lowerThreshold, upperThreshold, allowStraightAngles) {
22640     var val = Math.abs(dotp);
22641     if (val < epsilon3) {
22642       return 0;
22643     } else if (allowStraightAngles && Math.abs(val - 1) < epsilon3) {
22644       return 0;
22645     } else if (val < lowerThreshold || val > upperThreshold) {
22646       return dotp;
22647     } else {
22648       return null;
22649     }
22650   }
22651   function geoOrthoCalcScore(points, isClosed, epsilon3, threshold) {
22652     var score = 0;
22653     var first = isClosed ? 0 : 1;
22654     var last = isClosed ? points.length : points.length - 1;
22655     var coords = points.map(function(p2) {
22656       return p2.coord;
22657     });
22658     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
22659     var upperThreshold = Math.cos(threshold * Math.PI / 180);
22660     for (var i3 = first; i3 < last; i3++) {
22661       var a2 = coords[(i3 - 1 + coords.length) % coords.length];
22662       var origin = coords[i3];
22663       var b2 = coords[(i3 + 1) % coords.length];
22664       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a2, b2, origin), epsilon3, lowerThreshold, upperThreshold);
22665       if (dotp === null)
22666         continue;
22667       score = score + 2 * Math.min(Math.abs(dotp - 1), Math.min(Math.abs(dotp), Math.abs(dotp + 1)));
22668     }
22669     return score;
22670   }
22671   function geoOrthoMaxOffsetAngle(coords, isClosed, lessThan) {
22672     var max3 = -Infinity;
22673     var first = isClosed ? 0 : 1;
22674     var last = isClosed ? coords.length : coords.length - 1;
22675     for (var i3 = first; i3 < last; i3++) {
22676       var a2 = coords[(i3 - 1 + coords.length) % coords.length];
22677       var origin = coords[i3];
22678       var b2 = coords[(i3 + 1) % coords.length];
22679       var normalizedDotP = geoOrthoNormalizedDotProduct(a2, b2, origin);
22680       var angle2 = Math.acos(Math.abs(normalizedDotP)) * 180 / Math.PI;
22681       if (angle2 > 45)
22682         angle2 = 90 - angle2;
22683       if (angle2 >= lessThan)
22684         continue;
22685       if (angle2 > max3)
22686         max3 = angle2;
22687     }
22688     if (max3 === -Infinity)
22689       return null;
22690     return max3;
22691   }
22692   function geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles) {
22693     var score = null;
22694     var first = isClosed ? 0 : 1;
22695     var last = isClosed ? coords.length : coords.length - 1;
22696     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
22697     var upperThreshold = Math.cos(threshold * Math.PI / 180);
22698     for (var i3 = first; i3 < last; i3++) {
22699       var a2 = coords[(i3 - 1 + coords.length) % coords.length];
22700       var origin = coords[i3];
22701       var b2 = coords[(i3 + 1) % coords.length];
22702       var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a2, b2, origin), epsilon3, lowerThreshold, upperThreshold, allowStraightAngles);
22703       if (dotp === null)
22704         continue;
22705       if (Math.abs(dotp) > 0)
22706         return 1;
22707       score = 0;
22708     }
22709     return score;
22710   }
22711
22712   // modules/util/array.js
22713   function utilArrayIdentical(a2, b2) {
22714     if (a2 === b2)
22715       return true;
22716     var i3 = a2.length;
22717     if (i3 !== b2.length)
22718       return false;
22719     while (i3--) {
22720       if (a2[i3] !== b2[i3])
22721         return false;
22722     }
22723     return true;
22724   }
22725   function utilArrayDifference(a2, b2) {
22726     var other = new Set(b2);
22727     return Array.from(new Set(a2)).filter(function(v2) {
22728       return !other.has(v2);
22729     });
22730   }
22731   function utilArrayIntersection(a2, b2) {
22732     var other = new Set(b2);
22733     return Array.from(new Set(a2)).filter(function(v2) {
22734       return other.has(v2);
22735     });
22736   }
22737   function utilArrayUnion(a2, b2) {
22738     var result = new Set(a2);
22739     b2.forEach(function(v2) {
22740       result.add(v2);
22741     });
22742     return Array.from(result);
22743   }
22744   function utilArrayUniq(a2) {
22745     return Array.from(new Set(a2));
22746   }
22747   function utilArrayChunk(a2, chunkSize) {
22748     if (!chunkSize || chunkSize < 0)
22749       return [a2.slice()];
22750     var result = new Array(Math.ceil(a2.length / chunkSize));
22751     return Array.from(result, function(item, i3) {
22752       return a2.slice(i3 * chunkSize, i3 * chunkSize + chunkSize);
22753     });
22754   }
22755   function utilArrayFlatten(a2) {
22756     return a2.reduce(function(acc, val) {
22757       return acc.concat(val);
22758     }, []);
22759   }
22760   function utilArrayGroupBy(a2, key) {
22761     return a2.reduce(function(acc, item) {
22762       var group = typeof key === "function" ? key(item) : item[key];
22763       (acc[group] = acc[group] || []).push(item);
22764       return acc;
22765     }, {});
22766   }
22767   function utilArrayUniqBy(a2, key) {
22768     var seen = /* @__PURE__ */ new Set();
22769     return a2.reduce(function(acc, item) {
22770       var val = typeof key === "function" ? key(item) : item[key];
22771       if (val && !seen.has(val)) {
22772         seen.add(val);
22773         acc.push(item);
22774       }
22775       return acc;
22776     }, []);
22777   }
22778
22779   // modules/util/util.js
22780   var import_diacritics = __toESM(require_diacritics());
22781
22782   // modules/util/svg_paths_rtl_fix.js
22783   var import_alif_toolkit = __toESM(require_lib());
22784   var rtlRegex = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u07BF\u08A0–\u08BF]/;
22785   function fixRTLTextForSvg(inputText) {
22786     var ret = "", rtlBuffer = [];
22787     var arabicRegex = /[\u0600-\u06FF]/g;
22788     var arabicDiacritics = /[\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06ED]/g;
22789     var arabicMath = /[\u0660-\u066C\u06F0-\u06F9]+/g;
22790     var thaanaVowel = /[\u07A6-\u07B0]/;
22791     var hebrewSign = /[\u0591-\u05bd\u05bf\u05c1-\u05c5\u05c7]/;
22792     if (arabicRegex.test(inputText)) {
22793       inputText = (0, import_alif_toolkit.WordShaper)(inputText);
22794     }
22795     for (var n3 = 0; n3 < inputText.length; n3++) {
22796       var c2 = inputText[n3];
22797       if (arabicMath.test(c2)) {
22798         ret += rtlBuffer.reverse().join("");
22799         rtlBuffer = [c2];
22800       } else {
22801         if (rtlBuffer.length && arabicMath.test(rtlBuffer[rtlBuffer.length - 1])) {
22802           ret += rtlBuffer.reverse().join("");
22803           rtlBuffer = [];
22804         }
22805         if ((thaanaVowel.test(c2) || hebrewSign.test(c2) || arabicDiacritics.test(c2)) && rtlBuffer.length) {
22806           rtlBuffer[rtlBuffer.length - 1] += c2;
22807         } else if (rtlRegex.test(c2) || c2.charCodeAt(0) >= 64336 && c2.charCodeAt(0) <= 65023 || c2.charCodeAt(0) >= 65136 && c2.charCodeAt(0) <= 65279) {
22808           rtlBuffer.push(c2);
22809         } else if (c2 === " " && rtlBuffer.length) {
22810           rtlBuffer = [rtlBuffer.reverse().join("") + " "];
22811         } else {
22812           ret += rtlBuffer.reverse().join("") + c2;
22813           rtlBuffer = [];
22814         }
22815       }
22816     }
22817     ret += rtlBuffer.reverse().join("");
22818     return ret;
22819   }
22820
22821   // modules/core/preferences.js
22822   var _storage;
22823   try {
22824     _storage = localStorage;
22825   } catch (e3) {
22826   }
22827   _storage = _storage || (() => {
22828     let s2 = {};
22829     return {
22830       getItem: (k2) => s2[k2],
22831       setItem: (k2, v2) => s2[k2] = v2,
22832       removeItem: (k2) => delete s2[k2]
22833     };
22834   })();
22835   var _listeners = {};
22836   function corePreferences(k2, v2) {
22837     try {
22838       if (v2 === void 0)
22839         return _storage.getItem(k2);
22840       else if (v2 === null)
22841         _storage.removeItem(k2);
22842       else
22843         _storage.setItem(k2, v2);
22844       if (_listeners[k2]) {
22845         _listeners[k2].forEach((handler) => handler(v2));
22846       }
22847       return true;
22848     } catch (e3) {
22849       if (typeof console !== "undefined") {
22850         console.error("localStorage quota exceeded");
22851       }
22852       return false;
22853     }
22854   }
22855   corePreferences.onChange = function(k2, handler) {
22856     _listeners[k2] = _listeners[k2] || [];
22857     _listeners[k2].push(handler);
22858   };
22859
22860   // modules/core/file_fetcher.js
22861   var import_vparse = __toESM(require_vparse());
22862
22863   // config/id.js
22864   var presetsCdnUrl = "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@{presets_version}/";
22865   var ociCdnUrl = "https://cdn.jsdelivr.net/npm/osm-community-index@{version}/";
22866   var wmfSitematrixCdnUrl = "https://cdn.jsdelivr.net/npm/wmf-sitematrix@{version}/";
22867   var nsiCdnUrl = "https://cdn.jsdelivr.net/npm/name-suggestion-index@{version}/";
22868   var defaultOsmApiConnections = {
22869     live: {
22870       url: "https://www.openstreetmap.org",
22871       apiUrl: "https://api.openstreetmap.org",
22872       client_id: "0tmNTmd0Jo1dQp4AUmMBLtGiD9YpMuXzHefitcuVStc",
22873       client_secret: "BTlNrNxIPitHdL4sP2clHw5KLoee9aKkA7dQbc0Bj7Q"
22874     },
22875     dev: {
22876       url: "https://api06.dev.openstreetmap.org",
22877       client_id: "Ee1wWJ6UlpERbF6BfTNOpwn0R8k_06mvMXdDUkeHMgw",
22878       client_secret: "OnfWFC-JkZNHyYdr_viNn_h_RTZXRslKcUxllOXqf5g"
22879     }
22880   };
22881   var osmApiConnections = [];
22882   if (false) {
22883     osmApiConnections.push({
22884       url: null,
22885       client_id: null,
22886       client_secret: null
22887     });
22888   } else if (false) {
22889     osmApiConnections.push(defaultOsmApiConnections[null]);
22890   } else {
22891     osmApiConnections.push(defaultOsmApiConnections.live);
22892     osmApiConnections.push(defaultOsmApiConnections.dev);
22893   }
22894   var taginfoApiUrl = "https://taginfo.openstreetmap.org/api/4/";
22895   var nominatimApiUrl = "https://nominatim.openstreetmap.org/";
22896
22897   // package.json
22898   var package_default = {
22899     name: "iD",
22900     version: "2.27.3",
22901     description: "A friendly editor for OpenStreetMap",
22902     main: "dist/iD.min.js",
22903     repository: "github:openstreetmap/iD",
22904     homepage: "https://github.com/openstreetmap/iD",
22905     bugs: "https://github.com/openstreetmap/iD/issues",
22906     keywords: [
22907       "editor",
22908       "openstreetmap"
22909     ],
22910     license: "ISC",
22911     scripts: {
22912       all: "run-s clean build dist",
22913       build: "run-s build:css build:data build:js",
22914       "build:css": "node scripts/build_css.js",
22915       "build:data": "shx mkdir -p dist/data && node scripts/build_data.js",
22916       "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",
22917       "build:js": "node config/esbuild.config.mjs",
22918       "build:js:watch": "node config/esbuild.config.mjs --watch",
22919       clean: "shx rm -f dist/esbuild.json dist/*.js dist/*.map dist/*.css dist/img/*.svg",
22920       dist: "run-p dist:**",
22921       "dist:mapillary": "shx mkdir -p dist/mapillary-js && shx cp -R node_modules/mapillary-js/dist/* dist/mapillary-js/",
22922       "dist:pannellum": "shx mkdir -p dist/pannellum && shx cp -R node_modules/pannellum/build/* dist/pannellum/",
22923       "dist:min": "node config/esbuild.config.min.mjs",
22924       "dist:svg:iD": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "iD-%s" --symbol-sprite dist/img/iD-sprite.svg "svg/iD-sprite/**/*.svg"',
22925       "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',
22926       "dist:svg:fa": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/fa-sprite.svg svg/fontawesome/*.svg",
22927       "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',
22928       "dist:svg:mapillary:signs": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-sprite.svg node_modules/mapillary_sprite_source/package_signs/*.svg",
22929       "dist:svg:mapillary:objects": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-object-sprite.svg node_modules/mapillary_sprite_source/package_objects/*.svg",
22930       "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',
22931       "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',
22932       imagery: "node scripts/update_imagery.js",
22933       lint: "eslint config scripts test/spec modules --ext js,mjs",
22934       "lint:fix": "eslint scripts test/spec modules --fix",
22935       start: "run-s start:watch",
22936       "start:single-build": "run-p build:js start:server",
22937       "start:watch": "run-p build:js:watch start:server",
22938       "start:server": "node scripts/server.js",
22939       test: "npm-run-all -s lint build test:spec",
22940       "test:spec": "karma start config/karma.conf.js",
22941       translations: "node scripts/update_locales.js"
22942     },
22943     dependencies: {
22944       "@mapbox/geojson-area": "^0.2.2",
22945       "@mapbox/sexagesimal": "1.2.0",
22946       "@mapbox/vector-tile": "^1.3.1",
22947       "@rapideditor/country-coder": "~5.2.0",
22948       "@rapideditor/location-conflation": "~1.2.1",
22949       "@tmcw/togeojson": "^5.8.1",
22950       "@turf/bbox": "^6.0.0",
22951       "@turf/bbox-clip": "^6.0.0",
22952       "abortcontroller-polyfill": "^1.7.5",
22953       "aes-js": "^3.1.2",
22954       "alif-toolkit": "^1.2.9",
22955       "core-js-bundle": "^3.33.2",
22956       diacritics: "1.3.0",
22957       exifr: "^7.1.3",
22958       "fast-deep-equal": "~3.1.1",
22959       "fast-json-stable-stringify": "2.1.0",
22960       "lodash-es": "~4.17.15",
22961       marked: "~7.0.3",
22962       "node-diff3": "~3.1.0",
22963       "osm-auth": "~2.2.0",
22964       pannellum: "2.5.6",
22965       pbf: "^3.2.1",
22966       "polygon-clipping": "~0.15.1",
22967       rbush: "3.0.1",
22968       "whatwg-fetch": "^3.6.17",
22969       "which-polygon": "2.2.1"
22970     },
22971     devDependencies: {
22972       "@fortawesome/fontawesome-svg-core": "~6.4.2",
22973       "@fortawesome/free-brands-svg-icons": "~6.4.2",
22974       "@fortawesome/free-regular-svg-icons": "~6.4.2",
22975       "@fortawesome/free-solid-svg-icons": "~6.4.2",
22976       "@mapbox/maki": "^8.0.1",
22977       "@openstreetmap/id-tagging-schema": "^6.4.1",
22978       "@rapideditor/temaki": "^5.6.0",
22979       "@transifex/api": "^5.4.0",
22980       autoprefixer: "^10.4.15",
22981       "browserslist-to-esbuild": "^1.2.0",
22982       chai: "^4.3.10",
22983       chalk: "^4.1.2",
22984       "cldr-core": "^43.0.0",
22985       "cldr-localenames-full": "^43.1.0",
22986       "concat-files": "^0.1.1",
22987       d3: "~7.8.5",
22988       dotenv: "^16.3.1",
22989       "editor-layer-index": "github:osmlab/editor-layer-index#gh-pages",
22990       esbuild: "^0.19.2",
22991       "esbuild-visualizer": "^0.4.1",
22992       eslint: "^8.47.0",
22993       "fetch-mock": "^9.11.0",
22994       gaze: "^1.1.3",
22995       glob: "^10.3.3",
22996       happen: "^0.3.2",
22997       "js-yaml": "^4.0.0",
22998       "json-stringify-pretty-compact": "^3.0.0",
22999       karma: "^6.4.2",
23000       "karma-chrome-launcher": "^3.2.0",
23001       "karma-coverage": "2.1.1",
23002       "karma-mocha": "^2.0.1",
23003       "karma-remap-istanbul": "^0.6.0",
23004       mapillary_sprite_source: "^1.8.0",
23005       "mapillary-js": "4.1.1",
23006       minimist: "^1.2.8",
23007       mocha: "^10.2.0",
23008       "name-suggestion-index": "~6.0",
23009       "node-fetch": "^2.7.0",
23010       "npm-run-all": "^4.0.0",
23011       "osm-community-index": "~5.6.0",
23012       postcss: "^8.4.31",
23013       "postcss-selector-prepend": "^0.5.0",
23014       shelljs: "^0.8.0",
23015       shx: "^0.3.0",
23016       sinon: "^11.1.2",
23017       "sinon-chai": "^3.7.0",
23018       smash: "0.0",
23019       "static-server": "^2.2.1",
23020       "svg-sprite": "2.0.2",
23021       vparse: "~1.1.0"
23022     },
23023     engines: {
23024       node: ">=16.14"
23025     },
23026     browserslist: [
23027       "> 0.3%, last 6 major versions, Firefox ESR, maintained node versions"
23028     ]
23029   };
23030
23031   // modules/core/file_fetcher.js
23032   var _mainFileFetcher = coreFileFetcher();
23033   function coreFileFetcher() {
23034     const ociVersion = package_default.dependencies["osm-community-index"] || package_default.devDependencies["osm-community-index"];
23035     const v2 = (0, import_vparse.default)(ociVersion);
23036     const ociVersionMinor = "".concat(v2.major, ".").concat(v2.minor);
23037     const presetsVersion = package_default.devDependencies["@openstreetmap/id-tagging-schema"];
23038     let _this = {};
23039     let _inflight4 = {};
23040     let _fileMap = {
23041       "address_formats": "data/address_formats.min.json",
23042       "imagery": "data/imagery.min.json",
23043       "intro_graph": "data/intro_graph.min.json",
23044       "keepRight": "data/keepRight.min.json",
23045       "languages": "data/languages.min.json",
23046       "locales": "locales/index.min.json",
23047       "phone_formats": "data/phone_formats.min.json",
23048       "qa_data": "data/qa_data.min.json",
23049       "shortcuts": "data/shortcuts.min.json",
23050       "territory_languages": "data/territory_languages.min.json",
23051       "oci_defaults": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/defaults.min.json",
23052       "oci_features": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/featureCollection.min.json",
23053       "oci_resources": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/resources.min.json",
23054       "presets_package": presetsCdnUrl.replace("{presets_version}", presetsVersion) + "package.json",
23055       "deprecated": presetsCdnUrl + "dist/deprecated.min.json",
23056       "discarded": presetsCdnUrl + "dist/discarded.min.json",
23057       "preset_categories": presetsCdnUrl + "dist/preset_categories.min.json",
23058       "preset_defaults": presetsCdnUrl + "dist/preset_defaults.min.json",
23059       "preset_fields": presetsCdnUrl + "dist/fields.min.json",
23060       "preset_presets": presetsCdnUrl + "dist/presets.min.json",
23061       "wmf_sitematrix": wmfSitematrixCdnUrl.replace("{version}", "0.1") + "wikipedia.min.json"
23062     };
23063     let _cachedData = {};
23064     _this.cache = () => _cachedData;
23065     _this.get = (which) => {
23066       if (_cachedData[which]) {
23067         return Promise.resolve(_cachedData[which]);
23068       }
23069       const file = _fileMap[which];
23070       const url = file && _this.asset(file);
23071       if (!url) {
23072         return Promise.reject('Unknown data file for "'.concat(which, '"'));
23073       }
23074       if (url.includes("{presets_version}")) {
23075         return _this.get("presets_package").then((result) => {
23076           const presetsVersion2 = result.version;
23077           return getUrl(url.replace("{presets_version}", presetsVersion2), which);
23078         });
23079       } else {
23080         return getUrl(url);
23081       }
23082     };
23083     function getUrl(url, which) {
23084       let prom = _inflight4[url];
23085       if (!prom) {
23086         _inflight4[url] = prom = fetch(url).then((response) => {
23087           if (!response.ok || !response.json) {
23088             throw new Error(response.status + " " + response.statusText);
23089           }
23090           if (response.status === 204 || response.status === 205)
23091             return;
23092           return response.json();
23093         }).then((result) => {
23094           delete _inflight4[url];
23095           if (!result) {
23096             throw new Error('No data loaded for "'.concat(which, '"'));
23097           }
23098           _cachedData[which] = result;
23099           return result;
23100         }).catch((err) => {
23101           delete _inflight4[url];
23102           throw err;
23103         });
23104       }
23105       return prom;
23106     }
23107     _this.fileMap = function(val) {
23108       if (!arguments.length)
23109         return _fileMap;
23110       _fileMap = val;
23111       return _this;
23112     };
23113     let _assetPath = "";
23114     _this.assetPath = function(val) {
23115       if (!arguments.length)
23116         return _assetPath;
23117       _assetPath = val;
23118       return _this;
23119     };
23120     let _assetMap = {};
23121     _this.assetMap = function(val) {
23122       if (!arguments.length)
23123         return _assetMap;
23124       _assetMap = val;
23125       return _this;
23126     };
23127     _this.asset = (val) => {
23128       if (/^http(s)?:\/\//i.test(val))
23129         return val;
23130       const filename = _assetPath + val;
23131       return _assetMap[filename] || filename;
23132     };
23133     return _this;
23134   }
23135
23136   // node_modules/@rapideditor/country-coder/dist/country-coder.mjs
23137   var import_which_polygon = __toESM(require_which_polygon(), 1);
23138   var borders_default = { type: "FeatureCollection", features: [
23139     { 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]]]] } },
23140     { 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]]]] } },
23141     { 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]]]] } },
23142     { 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]]]] } },
23143     { 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]]]] } },
23144     { 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]]]] } },
23145     { 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]]]] } },
23146     { 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]]]] } },
23147     { 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]]]] } },
23148     { 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]]]] } },
23149     { 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]]]] } },
23150     { 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]]]] } },
23151     { 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]]]] } },
23152     { 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]]]] } },
23153     { 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]]]] } },
23154     { 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]]]] } },
23155     { 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]]]] } },
23156     { 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]]]] } },
23157     { 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]]]] } },
23158     { type: "Feature", properties: { wikidata: "Q12837", nameEn: "Iberia", level: "sharedLandform" }, geometry: null },
23159     { 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]]]] } },
23160     { 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]]]] } },
23161     { type: "Feature", properties: { wikidata: "Q22890", nameEn: "Ireland", level: "sharedLandform" }, geometry: null },
23162     { type: "Feature", properties: { wikidata: "Q23666", nameEn: "Great Britain", country: "GB", level: "sharedLandform" }, geometry: null },
23163     { 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]]]] } },
23164     { 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]]]] } },
23165     { 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]]]] } },
23166     { 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]]]] } },
23167     { 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]]]] } },
23168     { 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]]]] } },
23169     { 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]]]] } },
23170     { 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]]]] } },
23171     { 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]]]] } },
23172     { 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]]]] } },
23173     { 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]]]] } },
23174     { 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]]]] } },
23175     { type: "Feature", properties: { wikidata: "Q35657", nameEn: "US States", country: "US", level: "subcountryGroup" }, geometry: null },
23176     { type: "Feature", properties: { wikidata: "Q36117", nameEn: "Borneo", level: "sharedLandform" }, geometry: null },
23177     { 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]]]] } },
23178     { type: "Feature", properties: { wikidata: "Q37362", nameEn: "Akrotiri and Dhekelia", aliases: ["SBA"], country: "GB" }, geometry: null },
23179     { 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]]]] } },
23180     { 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]]]] } },
23181     { 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]]]] } },
23182     { 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]]]] } },
23183     { 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]]]] } },
23184     { 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]]]] } },
23185     { type: "Feature", properties: { wikidata: "Q46395", nameEn: "British Overseas Territories", aliases: ["BOTS", "UKOTS"], country: "GB", level: "subcountryGroup" }, geometry: null },
23186     { 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]]]] } },
23187     { 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]]]] } },
23188     { 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]]]] } },
23189     { 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]]]] } },
23190     { type: "Feature", properties: { wikidata: "Q105472", nameEn: "Macaronesia", level: "sharedLandform" }, geometry: null },
23191     { 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]]]] } },
23192     { 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]]]] } },
23193     { 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]]]] } },
23194     { 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]]]] } },
23195     { 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]]]] } },
23196     { 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]]]] } },
23197     { 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]]]] } },
23198     { 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]]]] } },
23199     { 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]]]] } },
23200     { 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]]]] } },
23201     { type: "Feature", properties: { wikidata: "Q153732", nameEn: "Mariana Islands", level: "sharedLandform" }, geometry: null },
23202     { 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]]]] } },
23203     { 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]]]] } },
23204     { type: "Feature", properties: { wikidata: "Q185086", nameEn: "Crown Dependencies", country: "GB", level: "subcountryGroup" }, geometry: null },
23205     { 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]]]] } },
23206     { type: "Feature", properties: { wikidata: "Q191011", nameEn: "Plazas de soberan\xEDa", country: "ES" }, geometry: null },
23207     { 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]]]] } },
23208     { 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]]]] } },
23209     { 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]]]] } },
23210     { 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]]]] } },
23211     { 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]]]] } },
23212     { type: "Feature", properties: { wikidata: "Q644636", nameEn: "Cyprus", level: "sharedLandform" }, geometry: null },
23213     { type: "Feature", properties: { wikidata: "Q851132", nameEn: "New Zealand Outlying Islands", country: "NZ", level: "subcountryGroup" }, geometry: null },
23214     { 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]]]] } },
23215     { 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]]]] } },
23216     { 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]]]] } },
23217     { 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]]]] } },
23218     { type: "Feature", properties: { wikidata: "Q1352230", nameEn: "US Territories", country: "US", level: "subcountryGroup" }, geometry: null },
23219     { type: "Feature", properties: { wikidata: "Q1451600", nameEn: "Overseas Countries and Territories of the EU", aliases: ["OCT"], level: "subunion" }, geometry: null },
23220     { 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]]]] } },
23221     { 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]]]] } },
23222     { 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]]]] } },
23223     { 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]]]] } },
23224     { 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]]]] } },
23225     { 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]]]] } },
23226     { 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]]]] } },
23227     { 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]]]] } },
23228     { type: "Feature", properties: { wikidata: "Q2914565", nameEn: "Autonomous Regions of Portugal", country: "PT", level: "subcountryGroup" }, geometry: null },
23229     { 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]]]] } },
23230     { 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]]]] } },
23231     { type: "Feature", properties: { wikidata: "Q3320166", nameEn: "Outermost Regions of the EU", aliases: ["OMR"], level: "subunion" }, geometry: null },
23232     { type: "Feature", properties: { wikidata: "Q3336843", nameEn: "Countries of the United Kingdom", aliases: ["GB-UKM"], country: "GB", level: "subcountryGroup" }, geometry: null },
23233     { 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]]]] } },
23234     { 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]]]] } },
23235     { 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]]]] } },
23236     { 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]]]] } },
23237     { 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]]]] } },
23238     { 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]]]] } },
23239     { type: "Feature", properties: { m49: "001", wikidata: "Q2", nameEn: "World", aliases: ["Earth", "Planet"], level: "world" }, geometry: null },
23240     { type: "Feature", properties: { m49: "002", wikidata: "Q15", nameEn: "Africa", level: "region" }, geometry: null },
23241     { type: "Feature", properties: { m49: "003", wikidata: "Q49", nameEn: "North America", level: "subregion" }, geometry: null },
23242     { type: "Feature", properties: { m49: "005", wikidata: "Q18", nameEn: "South America", level: "intermediateRegion" }, geometry: null },
23243     { type: "Feature", properties: { m49: "009", wikidata: "Q538", nameEn: "Oceania", level: "region" }, geometry: null },
23244     { type: "Feature", properties: { m49: "011", wikidata: "Q4412", nameEn: "Western Africa", level: "intermediateRegion" }, geometry: null },
23245     { type: "Feature", properties: { m49: "013", wikidata: "Q27611", nameEn: "Central America", level: "intermediateRegion" }, geometry: null },
23246     { type: "Feature", properties: { m49: "014", wikidata: "Q27407", nameEn: "Eastern Africa", level: "intermediateRegion" }, geometry: null },
23247     { type: "Feature", properties: { m49: "015", wikidata: "Q27381", nameEn: "Northern Africa", level: "subregion" }, geometry: null },
23248     { type: "Feature", properties: { m49: "017", wikidata: "Q27433", nameEn: "Middle Africa", level: "intermediateRegion" }, geometry: null },
23249     { type: "Feature", properties: { m49: "018", wikidata: "Q27394", nameEn: "Southern Africa", level: "intermediateRegion" }, geometry: null },
23250     { type: "Feature", properties: { m49: "019", wikidata: "Q828", nameEn: "Americas", level: "region" }, geometry: null },
23251     { type: "Feature", properties: { m49: "021", wikidata: "Q2017699", nameEn: "Northern America", level: "subregion" }, geometry: null },
23252     { type: "Feature", properties: { m49: "029", wikidata: "Q664609", nameEn: "Caribbean", level: "intermediateRegion" }, geometry: null },
23253     { type: "Feature", properties: { m49: "030", wikidata: "Q27231", nameEn: "Eastern Asia", level: "subregion" }, geometry: null },
23254     { type: "Feature", properties: { m49: "034", wikidata: "Q771405", nameEn: "Southern Asia", level: "subregion" }, geometry: null },
23255     { type: "Feature", properties: { m49: "035", wikidata: "Q11708", nameEn: "South-eastern Asia", level: "subregion" }, geometry: null },
23256     { type: "Feature", properties: { m49: "039", wikidata: "Q27449", nameEn: "Southern Europe", level: "subregion" }, geometry: null },
23257     { type: "Feature", properties: { m49: "053", wikidata: "Q45256", nameEn: "Australia and New Zealand", aliases: ["Australasia"], level: "subregion" }, geometry: null },
23258     { type: "Feature", properties: { m49: "054", wikidata: "Q37394", nameEn: "Melanesia", level: "subregion" }, geometry: null },
23259     { type: "Feature", properties: { m49: "057", wikidata: "Q3359409", nameEn: "Micronesia", level: "subregion" }, geometry: null },
23260     { type: "Feature", properties: { m49: "061", wikidata: "Q35942", nameEn: "Polynesia", level: "subregion" }, geometry: null },
23261     { type: "Feature", properties: { m49: "142", wikidata: "Q48", nameEn: "Asia", level: "region" }, geometry: null },
23262     { type: "Feature", properties: { m49: "143", wikidata: "Q27275", nameEn: "Central Asia", level: "subregion" }, geometry: null },
23263     { type: "Feature", properties: { m49: "145", wikidata: "Q27293", nameEn: "Western Asia", level: "subregion" }, geometry: null },
23264     { type: "Feature", properties: { m49: "150", wikidata: "Q46", nameEn: "Europe", level: "region" }, geometry: null },
23265     { type: "Feature", properties: { m49: "151", wikidata: "Q27468", nameEn: "Eastern Europe", level: "subregion" }, geometry: null },
23266     { type: "Feature", properties: { m49: "154", wikidata: "Q27479", nameEn: "Northern Europe", level: "subregion" }, geometry: null },
23267     { type: "Feature", properties: { m49: "155", wikidata: "Q27496", nameEn: "Western Europe", level: "subregion" }, geometry: null },
23268     { type: "Feature", properties: { m49: "202", wikidata: "Q132959", nameEn: "Sub-Saharan Africa", level: "subregion" }, geometry: null },
23269     { type: "Feature", properties: { m49: "419", wikidata: "Q72829598", nameEn: "Latin America and the Caribbean", level: "subregion" }, geometry: null },
23270     { type: "Feature", properties: { m49: "680", wikidata: "Q3405693", nameEn: "Sark", country: "GB", groups: ["GG", "830", "Q185086", "154", "150", "UN"], level: "subterritory", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44 01481"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.36485, 49.48223], [-2.65349, 49.15373], [-2.09454, 49.46288], [-2.36485, 49.48223]]]] } },
23271     { type: "Feature", properties: { m49: "830", wikidata: "Q42314", nameEn: "Channel Islands", level: "intermediateRegion" }, geometry: null },
23272     { 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]]]] } },
23273     { 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]]]] } },
23274     { 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]]]] } },
23275     { 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]]]] } },
23276     { 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]]]] } },
23277     { 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]]]] } },
23278     { 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]]]] } },
23279     { 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]]]] } },
23280     { 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]]]] } },
23281     { 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]]]] } },
23282     { 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]]]] } },
23283     { 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]]]] } },
23284     { 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]]]] } },
23285     { type: "Feature", properties: { iso1A2: "AU", iso1A3: "AUS", iso1N3: "036", wikidata: "Q408", nameEn: "Australia" }, geometry: null },
23286     { 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]]]] } },
23287     { 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]]]] } },
23288     { 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]]]] } },
23289     { 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]]]] } },
23290     { 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]]]] } },
23291     { 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]]]] } },
23292     { 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]]]] } },
23293     { 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]]]] } },
23294     { 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]]]] } },
23295     { 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]]]] } },
23296     { 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]]]] } },
23297     { 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]]]] } },
23298     { 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]]]] } },
23299     { 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]]]] } },
23300     { 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]]]] } },
23301     { 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]]]] } },
23302     { type: "Feature", properties: { iso1A2: "BQ", iso1A3: "BES", iso1N3: "535", wikidata: "Q27561", nameEn: "Caribbean Netherlands", country: "NL" }, geometry: null },
23303     { 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]]]] } },
23304     { 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]]]] } },
23305     { 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]]]] } },
23306     { 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]]]] } },
23307     { 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]]]] } },
23308     { 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]]]] } },
23309     { 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]]]] } },
23310     { 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]]]] } },
23311     { 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]]]] } },
23312     { 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]]]] } },
23313     { 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]]]] } },
23314     { 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]]]] } },
23315     { 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"] } },
23316     { 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]]]] } },
23317     { 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]]]] } },
23318     { 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]]]] } },
23319     { 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]]]] } },
23320     { type: "Feature", properties: { iso1A2: "CN", iso1A3: "CHN", iso1N3: "156", wikidata: "Q148", nameEn: "People's Republic of China" }, geometry: null },
23321     { 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]]]] } },
23322     { 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]]]] } },
23323     { 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]]]] } },
23324     { 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]]]] } },
23325     { 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]]]] } },
23326     { 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]]]] } },
23327     { 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]]]] } },
23328     { 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]]]] } },
23329     { 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]]]] } },
23330     { 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]]]] } },
23331     { 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]]]] } },
23332     { 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]]]] } },
23333     { type: "Feature", properties: { iso1A2: "DK", iso1A3: "DNK", iso1N3: "208", wikidata: "Q756617", nameEn: "Kingdom of Denmark" }, geometry: null },
23334     { 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]]]] } },
23335     { 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]]]] } },
23336     { 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]]]] } },
23337     { type: "Feature", properties: { iso1A2: "EA", wikidata: "Q28868874", nameEn: "Ceuta, Melilla", country: "ES", level: "territory", isoStatus: "excRes" }, geometry: null },
23338     { type: "Feature", properties: { iso1A2: "EC", iso1A3: "ECU", iso1N3: "218", wikidata: "Q736", nameEn: "Ecuador" }, geometry: null },
23339     { 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]]]] } },
23340     { 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]]]] } },
23341     { 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]]]] } },
23342     { 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]]]] } },
23343     { type: "Feature", properties: { iso1A2: "ES", iso1A3: "ESP", iso1N3: "724", wikidata: "Q29", nameEn: "Spain" }, geometry: null },
23344     { 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]]]] } },
23345     { type: "Feature", properties: { iso1A2: "EU", iso1A3: "EUE", wikidata: "Q458", nameEn: "European Union", level: "union", isoStatus: "excRes" }, geometry: null },
23346     { type: "Feature", properties: { iso1A2: "FI", iso1A3: "FIN", iso1N3: "246", wikidata: "Q33", nameEn: "Finland", aliases: ["SF"] }, geometry: null },
23347     { 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]]]] } },
23348     { 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]]]] } },
23349     { 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]]]] } },
23350     { 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]]]] } },
23351     { type: "Feature", properties: { iso1A2: "FR", iso1A3: "FRA", iso1N3: "250", wikidata: "Q142", nameEn: "France" }, geometry: null },
23352     { 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]]]] } },
23353     { 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]]]] } },
23354     { type: "Feature", properties: { iso1A2: "GB", iso1A3: "GBR", iso1N3: "826", wikidata: "Q145", ccTLD: ".uk", nameEn: "United Kingdom", aliases: ["UK"] }, geometry: null },
23355     { 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]]]] } },
23356     { 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]]]] } },
23357     { 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]]]] } },
23358     { type: "Feature", properties: { iso1A2: "GG", iso1A3: "GGY", iso1N3: "831", wikidata: "Q25230", nameEn: "Bailiwick of Guernsey", country: "GB" }, geometry: null },
23359     { 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]]]] } },
23360     { 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]]]] } },
23361     { 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]]]] } },
23362     { 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]]]] } },
23363     { 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]]]] } },
23364     { 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]]]] } },
23365     { 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]]]] } },
23366     { 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]]]] } },
23367     { 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]]]] } },
23368     { 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]]]] } },
23369     { 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]]]] } },
23370     { 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]]]] } },
23371     { 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]]]] } },
23372     { 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]]]] } },
23373     { 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]]]] } },
23374     { 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]]]] } },
23375     { 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]]]] } },
23376     { 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]]]] } },
23377     { 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]]]] } },
23378     { 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]]]] } },
23379     { type: "Feature", properties: { iso1A2: "ID", iso1A3: "IDN", iso1N3: "360", wikidata: "Q252", nameEn: "Indonesia", aliases: ["RI"] }, geometry: null },
23380     { 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"] } },
23381     { 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]]]] } },
23382     { 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]]]] } },
23383     { type: "Feature", properties: { iso1A2: "IN", iso1A3: "IND", iso1N3: "356", wikidata: "Q668", nameEn: "India" }, geometry: null },
23384     { type: "Feature", properties: { iso1A2: "IO", iso1A3: "IOT", iso1N3: "086", wikidata: "Q43448", nameEn: "British Indian Ocean Territory", country: "GB" }, geometry: null },
23385     { 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]]]] } },
23386     { 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]]]] } },
23387     { 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]]]] } },
23388     { 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]]]] } },
23389     { 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]]]] } },
23390     { 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]]]] } },
23391     { 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]]]] } },
23392     { 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]]]] } },
23393     { 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]]]] } },
23394     { 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]]]] } },
23395     { 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]]]] } },
23396     { 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]]]] } },
23397     { 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]]]] } },
23398     { 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]]]] } },
23399     { 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]]]] } },
23400     { 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]]]] } },
23401     { 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]]]] } },
23402     { 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]]]] } },
23403     { 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]]]] } },
23404     { 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]]]] } },
23405     { 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]]]] } },
23406     { 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]]]] } },
23407     { 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]]]] } },
23408     { 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]]]] } },
23409     { 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]]]] } },
23410     { 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]]]] } },
23411     { 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]]]] } },
23412     { 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]]]] } },
23413     { 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]]]] } },
23414     { 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]]]] } },
23415     { 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]]]] } },
23416     { 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]]]] } },
23417     { 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]]]] } },
23418     { 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]]]] } },
23419     { 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]]]] } },
23420     { 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]]]] } },
23421     { 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]]]] } },
23422     { 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]]]] } },
23423     { 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]]]] } },
23424     { 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]]]] } },
23425     { 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]]]] } },
23426     { 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]]]] } },
23427     { 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]]]] } },
23428     { 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]]]] } },
23429     { 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]]]] } },
23430     { 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]]]] } },
23431     { 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]]]] } },
23432     { 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]]]] } },
23433     { 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]]]] } },
23434     { 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]]]] } },
23435     { 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]]]] } },
23436     { type: "Feature", properties: { iso1A2: "MY", iso1A3: "MYS", iso1N3: "458", wikidata: "Q833", nameEn: "Malaysia" }, geometry: null },
23437     { 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]]]] } },
23438     { 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]]]] } },
23439     { 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]]]] } },
23440     { 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]]]] } },
23441     { 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]]]] } },
23442     { 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]]]] } },
23443     { 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]]]] } },
23444     { type: "Feature", properties: { iso1A2: "NL", iso1A3: "NLD", iso1N3: "528", wikidata: "Q29999", nameEn: "Kingdom of the Netherlands" }, geometry: null },
23445     { type: "Feature", properties: { iso1A2: "NO", iso1A3: "NOR", iso1N3: "578", wikidata: "Q20", nameEn: "Norway" }, geometry: null },
23446     { 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]]]] } },
23447     { 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]]]] } },
23448     { 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]]]] } },
23449     { type: "Feature", properties: { iso1A2: "NZ", iso1A3: "NZL", iso1N3: "554", wikidata: "Q664", nameEn: "New Zealand" }, geometry: null },
23450     { 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]]]] } },
23451     { 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]]]] } },
23452     { 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]]]] } },
23453     { 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]]]] } },
23454     { 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]]]] } },
23455     { 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]]]] } },
23456     { 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]]]] } },
23457     { 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]]]] } },
23458     { 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]]]] } },
23459     { 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]]]] } },
23460     { 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]]]] } },
23461     { type: "Feature", properties: { iso1A2: "PS", iso1A3: "PSE", iso1N3: "275", wikidata: "Q219060", nameEn: "Palestine" }, geometry: null },
23462     { type: "Feature", properties: { iso1A2: "PT", iso1A3: "PRT", iso1N3: "620", wikidata: "Q45", nameEn: "Portugal" }, geometry: null },
23463     { 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]]]] } },
23464     { 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]]]] } },
23465     { 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]]]] } },
23466     { 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]]]] } },
23467     { 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]]]] } },
23468     { 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]]]] } },
23469     { type: "Feature", properties: { iso1A2: "RU", iso1A3: "RUS", iso1N3: "643", wikidata: "Q159", nameEn: "Russia" }, geometry: null },
23470     { 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]]]] } },
23471     { 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]]]] } },
23472     { 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]]]] } },
23473     { 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]]]] } },
23474     { 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]]]] } },
23475     { 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]]]] } },
23476     { 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]]]] } },
23477     { type: "Feature", properties: { iso1A2: "SH", iso1A3: "SHN", iso1N3: "654", wikidata: "Q192184", nameEn: "Saint Helena, Ascension and Tristan da Cunha", country: "GB" }, geometry: null },
23478     { 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]]]] } },
23479     { type: "Feature", properties: { iso1A2: "SJ", iso1A3: "SJM", iso1N3: "744", wikidata: "Q842829", nameEn: "Svalbard and Jan Mayen", country: "NO" }, geometry: null },
23480     { 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]]]] } },
23481     { 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]]]] } },
23482     { 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]]]] } },
23483     { 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]]]] } },
23484     { 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]]]] } },
23485     { 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]]]] } },
23486     { 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]]]] } },
23487     { 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]]]] } },
23488     { 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]]]] } },
23489     { 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]]]] } },
23490     { 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]]]] } },
23491     { 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]]]] } },
23492     { 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]]]] } },
23493     { 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]]]] } },
23494     { 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]]]] } },
23495     { type: "Feature", properties: { iso1A2: "TF", iso1A3: "ATF", iso1N3: "260", wikidata: "Q129003", nameEn: "French Southern Territories", country: "FR", groups: ["EU", "UN"] }, geometry: null },
23496     { 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]]]] } },
23497     { 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]]]] } },
23498     { 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]]]] } },
23499     { 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]]]] } },
23500     { 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]]]] } },
23501     { 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]]]] } },
23502     { 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]]]] } },
23503     { 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]]]] } },
23504     { 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]]]] } },
23505     { 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]]]] } },
23506     { 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]]]] } },
23507     { 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]]]] } },
23508     { 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]]]] } },
23509     { 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]]]] } },
23510     { 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]]]] } },
23511     { type: "Feature", properties: { iso1A2: "UM", iso1A3: "UMI", iso1N3: "581", wikidata: "Q16645", nameEn: "United States Minor Outlying Islands", country: "US" }, geometry: null },
23512     { type: "Feature", properties: { iso1A2: "UN", wikidata: "Q1065", nameEn: "United Nations", level: "unitedNations", isoStatus: "excRes" }, geometry: null },
23513     { type: "Feature", properties: { iso1A2: "US", iso1A3: "USA", iso1N3: "840", wikidata: "Q30", nameEn: "United States of America" }, geometry: null },
23514     { 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]]]] } },
23515     { 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]]]] } },
23516     { 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]]]] } },
23517     { 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]]]] } },
23518     { 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]]]] } },
23519     { 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]]]] } },
23520     { 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]]]] } },
23521     { 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]]]] } },
23522     { 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]]]] } },
23523     { 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]]]] } },
23524     { 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]]]] } },
23525     { 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]]]] } },
23526     { 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]]]] } },
23527     { 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]]]] } },
23528     { 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]]]] } },
23529     { 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]]]] } },
23530     { 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]]]] } }
23531   ] };
23532   var borders = borders_default;
23533   var _whichPolygon = {};
23534   var _featuresByCode = {};
23535   var idFilterRegex = /(?=(?!^(and|the|of|el|la|de)$))(\b(and|the|of|el|la|de)\b)|[-_ .,'()&[\]/]/gi;
23536   function canonicalID(id2) {
23537     const s2 = id2 || "";
23538     if (s2.charAt(0) === ".") {
23539       return s2.toUpperCase();
23540     } else {
23541       return s2.replace(idFilterRegex, "").toUpperCase();
23542     }
23543   }
23544   var levels = [
23545     "subterritory",
23546     "territory",
23547     "subcountryGroup",
23548     "country",
23549     "sharedLandform",
23550     "intermediateRegion",
23551     "subregion",
23552     "region",
23553     "subunion",
23554     "union",
23555     "unitedNations",
23556     "world"
23557   ];
23558   loadDerivedDataAndCaches(borders);
23559   function loadDerivedDataAndCaches(borders2) {
23560     const identifierProps = ["iso1A2", "iso1A3", "m49", "wikidata", "emojiFlag", "ccTLD", "nameEn"];
23561     let geometryFeatures = [];
23562     for (const feature22 of borders2.features) {
23563       const props = feature22.properties;
23564       props.id = props.iso1A2 || props.m49 || props.wikidata;
23565       loadM49(feature22);
23566       loadTLD(feature22);
23567       loadIsoStatus(feature22);
23568       loadLevel(feature22);
23569       loadGroups(feature22);
23570       loadFlag(feature22);
23571       cacheFeatureByIDs(feature22);
23572       if (feature22.geometry) {
23573         geometryFeatures.push(feature22);
23574       }
23575     }
23576     for (const feature22 of borders2.features) {
23577       feature22.properties.groups = feature22.properties.groups.map((groupID) => {
23578         return _featuresByCode[groupID].properties.id;
23579       });
23580       loadMembersForGroupsOf(feature22);
23581     }
23582     for (const feature22 of borders2.features) {
23583       loadRoadSpeedUnit(feature22);
23584       loadRoadHeightUnit(feature22);
23585       loadDriveSide(feature22);
23586       loadCallingCodes(feature22);
23587       loadGroupGroups(feature22);
23588     }
23589     for (const feature22 of borders2.features) {
23590       feature22.properties.groups.sort((groupID1, groupID2) => {
23591         return levels.indexOf(_featuresByCode[groupID1].properties.level) - levels.indexOf(_featuresByCode[groupID2].properties.level);
23592       });
23593       if (feature22.properties.members) {
23594         feature22.properties.members.sort((id1, id2) => {
23595           const diff = levels.indexOf(_featuresByCode[id1].properties.level) - levels.indexOf(_featuresByCode[id2].properties.level);
23596           if (diff === 0) {
23597             return borders2.features.indexOf(_featuresByCode[id1]) - borders2.features.indexOf(_featuresByCode[id2]);
23598           }
23599           return diff;
23600         });
23601       }
23602     }
23603     const geometryOnlyCollection = {
23604       type: "FeatureCollection",
23605       features: geometryFeatures
23606     };
23607     _whichPolygon = (0, import_which_polygon.default)(geometryOnlyCollection);
23608     function loadGroups(feature22) {
23609       const props = feature22.properties;
23610       if (!props.groups) {
23611         props.groups = [];
23612       }
23613       if (feature22.geometry && props.country) {
23614         props.groups.push(props.country);
23615       }
23616       if (props.m49 !== "001") {
23617         props.groups.push("001");
23618       }
23619     }
23620     function loadM49(feature22) {
23621       const props = feature22.properties;
23622       if (!props.m49 && props.iso1N3) {
23623         props.m49 = props.iso1N3;
23624       }
23625     }
23626     function loadTLD(feature22) {
23627       const props = feature22.properties;
23628       if (props.level === "unitedNations")
23629         return;
23630       if (!props.ccTLD && props.iso1A2) {
23631         props.ccTLD = "." + props.iso1A2.toLowerCase();
23632       }
23633     }
23634     function loadIsoStatus(feature22) {
23635       const props = feature22.properties;
23636       if (!props.isoStatus && props.iso1A2) {
23637         props.isoStatus = "official";
23638       }
23639     }
23640     function loadLevel(feature22) {
23641       const props = feature22.properties;
23642       if (props.level)
23643         return;
23644       if (!props.country) {
23645         props.level = "country";
23646       } else if (!props.iso1A2 || props.isoStatus === "official") {
23647         props.level = "territory";
23648       } else {
23649         props.level = "subterritory";
23650       }
23651     }
23652     function loadGroupGroups(feature22) {
23653       const props = feature22.properties;
23654       if (feature22.geometry || !props.members)
23655         return;
23656       const featureLevelIndex = levels.indexOf(props.level);
23657       let sharedGroups = [];
23658       props.members.forEach((memberID, index) => {
23659         const member = _featuresByCode[memberID];
23660         const memberGroups = member.properties.groups.filter((groupID) => {
23661           return groupID !== feature22.properties.id && featureLevelIndex < levels.indexOf(_featuresByCode[groupID].properties.level);
23662         });
23663         if (index === 0) {
23664           sharedGroups = memberGroups;
23665         } else {
23666           sharedGroups = sharedGroups.filter((groupID) => memberGroups.indexOf(groupID) !== -1);
23667         }
23668       });
23669       props.groups = props.groups.concat(
23670         sharedGroups.filter((groupID) => props.groups.indexOf(groupID) === -1)
23671       );
23672       for (const groupID of sharedGroups) {
23673         const groupFeature = _featuresByCode[groupID];
23674         if (groupFeature.properties.members.indexOf(props.id) === -1) {
23675           groupFeature.properties.members.push(props.id);
23676         }
23677       }
23678     }
23679     function loadRoadSpeedUnit(feature22) {
23680       const props = feature22.properties;
23681       if (feature22.geometry) {
23682         if (!props.roadSpeedUnit)
23683           props.roadSpeedUnit = "km/h";
23684       } else if (props.members) {
23685         const vals = Array.from(
23686           new Set(
23687             props.members.map((id2) => {
23688               const member = _featuresByCode[id2];
23689               if (member.geometry)
23690                 return member.properties.roadSpeedUnit || "km/h";
23691             }).filter(Boolean)
23692           )
23693         );
23694         if (vals.length === 1)
23695           props.roadSpeedUnit = vals[0];
23696       }
23697     }
23698     function loadRoadHeightUnit(feature22) {
23699       const props = feature22.properties;
23700       if (feature22.geometry) {
23701         if (!props.roadHeightUnit)
23702           props.roadHeightUnit = "m";
23703       } else if (props.members) {
23704         const vals = Array.from(
23705           new Set(
23706             props.members.map((id2) => {
23707               const member = _featuresByCode[id2];
23708               if (member.geometry)
23709                 return member.properties.roadHeightUnit || "m";
23710             }).filter(Boolean)
23711           )
23712         );
23713         if (vals.length === 1)
23714           props.roadHeightUnit = vals[0];
23715       }
23716     }
23717     function loadDriveSide(feature22) {
23718       const props = feature22.properties;
23719       if (feature22.geometry) {
23720         if (!props.driveSide)
23721           props.driveSide = "right";
23722       } else if (props.members) {
23723         const vals = Array.from(
23724           new Set(
23725             props.members.map((id2) => {
23726               const member = _featuresByCode[id2];
23727               if (member.geometry)
23728                 return member.properties.driveSide || "right";
23729             }).filter(Boolean)
23730           )
23731         );
23732         if (vals.length === 1)
23733           props.driveSide = vals[0];
23734       }
23735     }
23736     function loadCallingCodes(feature22) {
23737       const props = feature22.properties;
23738       if (!feature22.geometry && props.members) {
23739         props.callingCodes = Array.from(
23740           new Set(
23741             props.members.reduce((array2, id2) => {
23742               const member = _featuresByCode[id2];
23743               if (member.geometry && member.properties.callingCodes) {
23744                 return array2.concat(member.properties.callingCodes);
23745               }
23746               return array2;
23747             }, [])
23748           )
23749         );
23750       }
23751     }
23752     function loadFlag(feature22) {
23753       if (!feature22.properties.iso1A2)
23754         return;
23755       const flag = feature22.properties.iso1A2.replace(/./g, function(char) {
23756         return String.fromCodePoint(char.charCodeAt(0) + 127397);
23757       });
23758       feature22.properties.emojiFlag = flag;
23759     }
23760     function loadMembersForGroupsOf(feature22) {
23761       for (const groupID of feature22.properties.groups) {
23762         const groupFeature = _featuresByCode[groupID];
23763         if (!groupFeature.properties.members) {
23764           groupFeature.properties.members = [];
23765         }
23766         groupFeature.properties.members.push(feature22.properties.id);
23767       }
23768     }
23769     function cacheFeatureByIDs(feature22) {
23770       let ids = [];
23771       for (const prop of identifierProps) {
23772         const id2 = feature22.properties[prop];
23773         if (id2) {
23774           ids.push(id2);
23775         }
23776       }
23777       for (const alias of feature22.properties.aliases || []) {
23778         ids.push(alias);
23779       }
23780       for (const id2 of ids) {
23781         const cid = canonicalID(id2);
23782         _featuresByCode[cid] = feature22;
23783       }
23784     }
23785   }
23786   function locArray(loc) {
23787     if (Array.isArray(loc)) {
23788       return loc;
23789     } else if (loc.coordinates) {
23790       return loc.coordinates;
23791     }
23792     return loc.geometry.coordinates;
23793   }
23794   function smallestFeature(loc) {
23795     const query = locArray(loc);
23796     const featureProperties = _whichPolygon(query);
23797     if (!featureProperties)
23798       return null;
23799     return _featuresByCode[featureProperties.id];
23800   }
23801   function countryFeature(loc) {
23802     const feature22 = smallestFeature(loc);
23803     if (!feature22)
23804       return null;
23805     const countryCode = feature22.properties.country || feature22.properties.iso1A2;
23806     return _featuresByCode[countryCode] || null;
23807   }
23808   var defaultOpts = {
23809     level: void 0,
23810     maxLevel: void 0,
23811     withProp: void 0
23812   };
23813   function featureForLoc(loc, opts) {
23814     const targetLevel = opts.level || "country";
23815     const maxLevel = opts.maxLevel || "world";
23816     const withProp = opts.withProp;
23817     const targetLevelIndex = levels.indexOf(targetLevel);
23818     if (targetLevelIndex === -1)
23819       return null;
23820     const maxLevelIndex = levels.indexOf(maxLevel);
23821     if (maxLevelIndex === -1)
23822       return null;
23823     if (maxLevelIndex < targetLevelIndex)
23824       return null;
23825     if (targetLevel === "country") {
23826       const fastFeature = countryFeature(loc);
23827       if (fastFeature) {
23828         if (!withProp || fastFeature.properties[withProp]) {
23829           return fastFeature;
23830         }
23831       }
23832     }
23833     const features = featuresContaining(loc);
23834     const match = features.find((feature22) => {
23835       let levelIndex = levels.indexOf(feature22.properties.level);
23836       if (feature22.properties.level === targetLevel || // if no feature exists at the target level, return the first feature at the next level up
23837       levelIndex > targetLevelIndex && levelIndex <= maxLevelIndex) {
23838         if (!withProp || feature22.properties[withProp]) {
23839           return feature22;
23840         }
23841       }
23842       return false;
23843     });
23844     return match || null;
23845   }
23846   function featureForID(id2) {
23847     let stringID;
23848     if (typeof id2 === "number") {
23849       stringID = id2.toString();
23850       if (stringID.length === 1) {
23851         stringID = "00" + stringID;
23852       } else if (stringID.length === 2) {
23853         stringID = "0" + stringID;
23854       }
23855     } else {
23856       stringID = canonicalID(id2);
23857     }
23858     return _featuresByCode[stringID] || null;
23859   }
23860   function smallestFeaturesForBbox(bbox2) {
23861     return _whichPolygon.bbox(bbox2).map((props) => _featuresByCode[props.id]);
23862   }
23863   function smallestOrMatchingFeature(query) {
23864     if (typeof query === "object") {
23865       return smallestFeature(query);
23866     }
23867     return featureForID(query);
23868   }
23869   function feature(query, opts = defaultOpts) {
23870     if (typeof query === "object") {
23871       return featureForLoc(query, opts);
23872     }
23873     return featureForID(query);
23874   }
23875   function iso1A2Code(query, opts = defaultOpts) {
23876     opts.withProp = "iso1A2";
23877     const match = feature(query, opts);
23878     if (!match)
23879       return null;
23880     return match.properties.iso1A2 || null;
23881   }
23882   function propertiesForQuery(query, property) {
23883     const features = featuresContaining(query, false);
23884     return features.map((feature22) => feature22.properties[property]).filter(Boolean);
23885   }
23886   function iso1A2Codes(query) {
23887     return propertiesForQuery(query, "iso1A2");
23888   }
23889   function featuresContaining(query, strict) {
23890     let matchingFeatures;
23891     if (Array.isArray(query) && query.length === 4) {
23892       matchingFeatures = smallestFeaturesForBbox(query);
23893     } else {
23894       const smallestOrMatching = smallestOrMatchingFeature(query);
23895       matchingFeatures = smallestOrMatching ? [smallestOrMatching] : [];
23896     }
23897     if (!matchingFeatures.length)
23898       return [];
23899     let returnFeatures;
23900     if (!strict || typeof query === "object") {
23901       returnFeatures = matchingFeatures.slice();
23902     } else {
23903       returnFeatures = [];
23904     }
23905     for (const feature22 of matchingFeatures) {
23906       const properties = feature22.properties;
23907       for (const groupID of properties.groups) {
23908         const groupFeature = _featuresByCode[groupID];
23909         if (returnFeatures.indexOf(groupFeature) === -1) {
23910           returnFeatures.push(groupFeature);
23911         }
23912       }
23913     }
23914     return returnFeatures;
23915   }
23916   function featuresIn(id2, strict) {
23917     const feature22 = featureForID(id2);
23918     if (!feature22)
23919       return [];
23920     let features = [];
23921     if (!strict) {
23922       features.push(feature22);
23923     }
23924     const properties = feature22.properties;
23925     for (const memberID of properties.members || []) {
23926       features.push(_featuresByCode[memberID]);
23927     }
23928     return features;
23929   }
23930   function aggregateFeature(id2) {
23931     var _a;
23932     const features = featuresIn(id2, false);
23933     if (features.length === 0)
23934       return null;
23935     let aggregateCoordinates = [];
23936     for (const feature22 of features) {
23937       if (((_a = feature22.geometry) == null ? void 0 : _a.type) === "MultiPolygon" && feature22.geometry.coordinates) {
23938         aggregateCoordinates = aggregateCoordinates.concat(feature22.geometry.coordinates);
23939       }
23940     }
23941     return {
23942       type: "Feature",
23943       properties: features[0].properties,
23944       geometry: {
23945         type: "MultiPolygon",
23946         coordinates: aggregateCoordinates
23947       }
23948     };
23949   }
23950   function roadSpeedUnit(query) {
23951     const feature22 = smallestOrMatchingFeature(query);
23952     return feature22 && feature22.properties.roadSpeedUnit || null;
23953   }
23954   function roadHeightUnit(query) {
23955     const feature22 = smallestOrMatchingFeature(query);
23956     return feature22 && feature22.properties.roadHeightUnit || null;
23957   }
23958
23959   // node_modules/@rapideditor/location-conflation/index.mjs
23960   var import_geojson_area = __toESM(require_geojson_area(), 1);
23961   var import_circle_to_polygon = __toESM(require_circle_to_polygon(), 1);
23962   var import_polygon_clipping = __toESM(require_polygon_clipping_umd(), 1);
23963   var import_geojson_precision = __toESM(require_geojson_precision(), 1);
23964   var import_json_stringify_pretty_compact = __toESM(require_json_stringify_pretty_compact(), 1);
23965   var location_conflation_default = class {
23966     // constructor
23967     //
23968     // `fc`  Optional FeatureCollection of known features
23969     //
23970     // Optionally pass a GeoJSON FeatureCollection of known features which we can refer to later.
23971     // Each feature must have a filename-like `id`, for example: `something.geojson`
23972     //
23973     // {
23974     //   "type": "FeatureCollection"
23975     //   "features": [
23976     //     {
23977     //       "type": "Feature",
23978     //       "id": "philly_metro.geojson",
23979     //       "properties": { … },
23980     //       "geometry": { … }
23981     //     }
23982     //   ]
23983     // }
23984     constructor(fc) {
23985       this._cache = {};
23986       this._strict = true;
23987       if (fc && fc.type === "FeatureCollection" && Array.isArray(fc.features)) {
23988         fc.features.forEach((feature3) => {
23989           feature3.properties = feature3.properties || {};
23990           let props = feature3.properties;
23991           let id2 = feature3.id || props.id;
23992           if (!id2 || !/^\S+\.geojson$/i.test(id2))
23993             return;
23994           id2 = id2.toLowerCase();
23995           feature3.id = id2;
23996           props.id = id2;
23997           if (!props.area) {
23998             const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
23999             props.area = Number(area.toFixed(2));
24000           }
24001           this._cache[id2] = feature3;
24002         });
24003       }
24004       let world = _cloneDeep(feature("Q2"));
24005       world.geometry = {
24006         type: "Polygon",
24007         coordinates: [[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]]
24008       };
24009       world.id = "Q2";
24010       world.properties.id = "Q2";
24011       world.properties.area = import_geojson_area.default.geometry(world.geometry) / 1e6;
24012       this._cache.Q2 = world;
24013     }
24014     // validateLocation
24015     // `location`  The location to validate
24016     //
24017     // Pass a `location` value to validate
24018     //
24019     // Returns a result like:
24020     //   {
24021     //     type:     'point', 'geojson', or 'countrycoder'
24022     //     location:  the queried location
24023     //     id:        the stable identifier for the feature
24024     //   }
24025     // or `null` if the location is invalid
24026     //
24027     validateLocation(location) {
24028       if (Array.isArray(location) && (location.length === 2 || location.length === 3)) {
24029         const lon = location[0];
24030         const lat = location[1];
24031         const radius = location[2];
24032         if (Number.isFinite(lon) && lon >= -180 && lon <= 180 && Number.isFinite(lat) && lat >= -90 && lat <= 90 && (location.length === 2 || Number.isFinite(radius) && radius > 0)) {
24033           const id2 = "[" + location.toString() + "]";
24034           return { type: "point", location, id: id2 };
24035         }
24036       } else if (typeof location === "string" && /^\S+\.geojson$/i.test(location)) {
24037         const id2 = location.toLowerCase();
24038         if (this._cache[id2]) {
24039           return { type: "geojson", location, id: id2 };
24040         }
24041       } else if (typeof location === "string" || typeof location === "number") {
24042         const feature3 = feature(location);
24043         if (feature3) {
24044           const id2 = feature3.properties.wikidata;
24045           return { type: "countrycoder", location, id: id2 };
24046         }
24047       }
24048       if (this._strict) {
24049         throw new Error('validateLocation:  Invalid location: "'.concat(location, '".'));
24050       } else {
24051         return null;
24052       }
24053     }
24054     // resolveLocation
24055     // `location`  The location to resolve
24056     //
24057     // Pass a `location` value to resolve
24058     //
24059     // Returns a result like:
24060     //   {
24061     //     type:      'point', 'geojson', or 'countrycoder'
24062     //     location:  the queried location
24063     //     id:        a stable identifier for the feature
24064     //     feature:   the resolved GeoJSON feature
24065     //   }
24066     //  or `null` if the location is invalid
24067     //
24068     resolveLocation(location) {
24069       const valid = this.validateLocation(location);
24070       if (!valid)
24071         return null;
24072       const id2 = valid.id;
24073       if (this._cache[id2]) {
24074         return Object.assign(valid, { feature: this._cache[id2] });
24075       }
24076       if (valid.type === "point") {
24077         const lon = location[0];
24078         const lat = location[1];
24079         const radius = location[2] || 25;
24080         const EDGES = 10;
24081         const PRECISION = 3;
24082         const area = Math.PI * radius * radius;
24083         const feature3 = this._cache[id2] = (0, import_geojson_precision.default)({
24084           type: "Feature",
24085           id: id2,
24086           properties: { id: id2, area: Number(area.toFixed(2)) },
24087           geometry: (0, import_circle_to_polygon.default)([lon, lat], radius * 1e3, EDGES)
24088           // km to m
24089         }, PRECISION);
24090         return Object.assign(valid, { feature: feature3 });
24091       } else if (valid.type === "geojson") {
24092       } else if (valid.type === "countrycoder") {
24093         let feature3 = _cloneDeep(feature(id2));
24094         let props = feature3.properties;
24095         if (Array.isArray(props.members)) {
24096           let aggregate = aggregateFeature(id2);
24097           aggregate.geometry.coordinates = _clip([aggregate], "UNION").geometry.coordinates;
24098           feature3.geometry = aggregate.geometry;
24099         }
24100         if (!props.area) {
24101           const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
24102           props.area = Number(area.toFixed(2));
24103         }
24104         feature3.id = id2;
24105         props.id = id2;
24106         this._cache[id2] = feature3;
24107         return Object.assign(valid, { feature: feature3 });
24108       }
24109       if (this._strict) {
24110         throw new Error("resolveLocation:  Couldn't resolve location \"".concat(location, '".'));
24111       } else {
24112         return null;
24113       }
24114     }
24115     // validateLocationSet
24116     // `locationSet`  the locationSet to validate
24117     //
24118     // Pass a locationSet Object to validate like:
24119     //   {
24120     //     include: [ Array of locations ],
24121     //     exclude: [ Array of locations ]
24122     //   }
24123     //
24124     // Returns a result like:
24125     //   {
24126     //     type:         'locationset'
24127     //     locationSet:  the queried locationSet
24128     //     id:           the stable identifier for the feature
24129     //   }
24130     // or `null` if the locationSet is invalid
24131     //
24132     validateLocationSet(locationSet) {
24133       locationSet = locationSet || {};
24134       const validator = this.validateLocation.bind(this);
24135       let include = (locationSet.include || []).map(validator).filter(Boolean);
24136       let exclude = (locationSet.exclude || []).map(validator).filter(Boolean);
24137       if (!include.length) {
24138         if (this._strict) {
24139           throw new Error("validateLocationSet:  LocationSet includes nothing.");
24140         } else {
24141           locationSet.include = ["Q2"];
24142           include = [{ type: "countrycoder", location: "Q2", id: "Q2" }];
24143         }
24144       }
24145       include.sort(_sortLocations);
24146       let id2 = "+[" + include.map((d2) => d2.id).join(",") + "]";
24147       if (exclude.length) {
24148         exclude.sort(_sortLocations);
24149         id2 += "-[" + exclude.map((d2) => d2.id).join(",") + "]";
24150       }
24151       return { type: "locationset", locationSet, id: id2 };
24152     }
24153     // resolveLocationSet
24154     // `locationSet`  the locationSet to resolve
24155     //
24156     // Pass a locationSet Object to validate like:
24157     //   {
24158     //     include: [ Array of locations ],
24159     //     exclude: [ Array of locations ]
24160     //   }
24161     //
24162     // Returns a result like:
24163     //   {
24164     //     type:         'locationset'
24165     //     locationSet:  the queried locationSet
24166     //     id:           the stable identifier for the feature
24167     //     feature:      the resolved GeoJSON feature
24168     //   }
24169     // or `null` if the locationSet is invalid
24170     //
24171     resolveLocationSet(locationSet) {
24172       locationSet = locationSet || {};
24173       const valid = this.validateLocationSet(locationSet);
24174       if (!valid)
24175         return null;
24176       const id2 = valid.id;
24177       if (this._cache[id2]) {
24178         return Object.assign(valid, { feature: this._cache[id2] });
24179       }
24180       const resolver = this.resolveLocation.bind(this);
24181       const includes = (locationSet.include || []).map(resolver).filter(Boolean);
24182       const excludes = (locationSet.exclude || []).map(resolver).filter(Boolean);
24183       if (includes.length === 1 && excludes.length === 0) {
24184         return Object.assign(valid, { feature: includes[0].feature });
24185       }
24186       const includeGeoJSON = _clip(includes.map((d2) => d2.feature), "UNION");
24187       const excludeGeoJSON = _clip(excludes.map((d2) => d2.feature), "UNION");
24188       let resultGeoJSON = excludeGeoJSON ? _clip([includeGeoJSON, excludeGeoJSON], "DIFFERENCE") : includeGeoJSON;
24189       const area = import_geojson_area.default.geometry(resultGeoJSON.geometry) / 1e6;
24190       resultGeoJSON.id = id2;
24191       resultGeoJSON.properties = { id: id2, area: Number(area.toFixed(2)) };
24192       this._cache[id2] = resultGeoJSON;
24193       return Object.assign(valid, { feature: resultGeoJSON });
24194     }
24195     // strict
24196     //
24197     strict(val) {
24198       if (val === void 0) {
24199         return this._strict;
24200       } else {
24201         this._strict = val;
24202         return this;
24203       }
24204     }
24205     // cache
24206     // convenience method to access the internal cache
24207     cache() {
24208       return this._cache;
24209     }
24210     // stringify
24211     // convenience method to prettyStringify the given object
24212     stringify(obj, options2) {
24213       return (0, import_json_stringify_pretty_compact.default)(obj, options2);
24214     }
24215   };
24216   function _clip(features, which) {
24217     if (!Array.isArray(features) || !features.length)
24218       return null;
24219     const fn = { UNION: import_polygon_clipping.default.union, DIFFERENCE: import_polygon_clipping.default.difference }[which];
24220     const args = features.map((feature3) => feature3.geometry.coordinates);
24221     const coords = fn.apply(null, args);
24222     return {
24223       type: "Feature",
24224       properties: {},
24225       geometry: {
24226         type: whichType(coords),
24227         coordinates: coords
24228       }
24229     };
24230     function whichType(coords2) {
24231       const a2 = Array.isArray(coords2);
24232       const b2 = a2 && Array.isArray(coords2[0]);
24233       const c2 = b2 && Array.isArray(coords2[0][0]);
24234       const d2 = c2 && Array.isArray(coords2[0][0][0]);
24235       return d2 ? "MultiPolygon" : "Polygon";
24236     }
24237   }
24238   function _cloneDeep(obj) {
24239     return JSON.parse(JSON.stringify(obj));
24240   }
24241   function _sortLocations(a2, b2) {
24242     const rank = { countrycoder: 1, geojson: 2, point: 3 };
24243     const aRank = rank[a2.type];
24244     const bRank = rank[b2.type];
24245     return aRank > bRank ? 1 : aRank < bRank ? -1 : a2.id.localeCompare(b2.id);
24246   }
24247
24248   // modules/core/LocationManager.js
24249   var import_which_polygon2 = __toESM(require_which_polygon());
24250   var import_geojson_area2 = __toESM(require_geojson_area());
24251   var _loco = new location_conflation_default();
24252   var LocationManager = class {
24253     /**
24254      * @constructor
24255      */
24256     constructor() {
24257       this._wp = null;
24258       this._resolved = /* @__PURE__ */ new Map();
24259       this._knownLocationSets = /* @__PURE__ */ new Map();
24260       this._locationIncludedIn = /* @__PURE__ */ new Map();
24261       this._locationExcludedIn = /* @__PURE__ */ new Map();
24262       const world = { locationSet: { include: ["Q2"] } };
24263       this._resolveLocationSet(world);
24264       this._rebuildIndex();
24265     }
24266     /**
24267      * _validateLocationSet
24268      * Pass an Object with a `locationSet` property.
24269      * Validates the `locationSet` and sets a `locationSetID` property on the object.
24270      * To avoid so much computation we only resolve the include and exclude regions, but not the locationSet itself.
24271      *
24272      * Use `_resolveLocationSet()` instead if you need to resolve geojson of locationSet, for example to render it.
24273      * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
24274      *
24275      * @param  `obj`  Object to check, it should have `locationSet` property
24276      */
24277     _validateLocationSet(obj) {
24278       if (obj.locationSetID)
24279         return;
24280       try {
24281         let locationSet = obj.locationSet;
24282         if (!locationSet) {
24283           throw new Error("object missing locationSet property");
24284         }
24285         if (!locationSet.include) {
24286           locationSet.include = ["Q2"];
24287         }
24288         const locationSetID = _loco.validateLocationSet(locationSet).id;
24289         obj.locationSetID = locationSetID;
24290         if (this._knownLocationSets.has(locationSetID))
24291           return;
24292         let area = 0;
24293         (locationSet.include || []).forEach((location) => {
24294           const locationID = _loco.validateLocation(location).id;
24295           let geojson = this._resolved.get(locationID);
24296           if (!geojson) {
24297             geojson = _loco.resolveLocation(location).feature;
24298             this._resolved.set(locationID, geojson);
24299           }
24300           area += geojson.properties.area;
24301           let s2 = this._locationIncludedIn.get(locationID);
24302           if (!s2) {
24303             s2 = /* @__PURE__ */ new Set();
24304             this._locationIncludedIn.set(locationID, s2);
24305           }
24306           s2.add(locationSetID);
24307         });
24308         (locationSet.exclude || []).forEach((location) => {
24309           const locationID = _loco.validateLocation(location).id;
24310           let geojson = this._resolved.get(locationID);
24311           if (!geojson) {
24312             geojson = _loco.resolveLocation(location).feature;
24313             this._resolved.set(locationID, geojson);
24314           }
24315           area -= geojson.properties.area;
24316           let s2 = this._locationExcludedIn.get(locationID);
24317           if (!s2) {
24318             s2 = /* @__PURE__ */ new Set();
24319             this._locationExcludedIn.set(locationID, s2);
24320           }
24321           s2.add(locationSetID);
24322         });
24323         this._knownLocationSets.set(locationSetID, area);
24324       } catch (err) {
24325         obj.locationSet = { include: ["Q2"] };
24326         obj.locationSetID = "+[Q2]";
24327       }
24328     }
24329     /**
24330      * _resolveLocationSet
24331      * Does everything that `_validateLocationSet()` does, but then "resolves" the locationSet into GeoJSON.
24332      * This step is a bit more computationally expensive, so really only needed if you intend to render the shape.
24333      *
24334      * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
24335      *
24336      * @param  `obj`  Object to check, it should have `locationSet` property
24337      */
24338     _resolveLocationSet(obj) {
24339       this._validateLocationSet(obj);
24340       if (this._resolved.has(obj.locationSetID))
24341         return;
24342       try {
24343         const result = _loco.resolveLocationSet(obj.locationSet);
24344         const locationSetID = result.id;
24345         obj.locationSetID = locationSetID;
24346         if (!result.feature.geometry.coordinates.length || !result.feature.properties.area) {
24347           throw new Error("locationSet ".concat(locationSetID, " resolves to an empty feature."));
24348         }
24349         let geojson = JSON.parse(JSON.stringify(result.feature));
24350         geojson.id = locationSetID;
24351         geojson.properties.id = locationSetID;
24352         this._resolved.set(locationSetID, geojson);
24353       } catch (err) {
24354         obj.locationSet = { include: ["Q2"] };
24355         obj.locationSetID = "+[Q2]";
24356       }
24357     }
24358     /**
24359      * _rebuildIndex
24360      * Rebuilds the whichPolygon index with whatever features have been resolved into GeoJSON.
24361      */
24362     _rebuildIndex() {
24363       this._wp = (0, import_which_polygon2.default)({ features: [...this._resolved.values()] });
24364     }
24365     /**
24366      * mergeCustomGeoJSON
24367      * Accepts a FeatureCollection-like object containing custom locations
24368      * Each feature must have a filename-like `id`, for example: `something.geojson`
24369      * {
24370      *   "type": "FeatureCollection"
24371      *   "features": [
24372      *     {
24373      *       "type": "Feature",
24374      *       "id": "philly_metro.geojson",
24375      *       "properties": { … },
24376      *       "geometry": { … }
24377      *     }
24378      *   ]
24379      * }
24380      *
24381      * @param  `fc`  FeatureCollection-like Object containing custom locations
24382      */
24383     mergeCustomGeoJSON(fc) {
24384       if (!fc || fc.type !== "FeatureCollection" || !Array.isArray(fc.features))
24385         return;
24386       fc.features.forEach((feature3) => {
24387         feature3.properties = feature3.properties || {};
24388         let props = feature3.properties;
24389         let id2 = feature3.id || props.id;
24390         if (!id2 || !/^\S+\.geojson$/i.test(id2))
24391           return;
24392         id2 = id2.toLowerCase();
24393         feature3.id = id2;
24394         props.id = id2;
24395         if (!props.area) {
24396           const area = import_geojson_area2.default.geometry(feature3.geometry) / 1e6;
24397           props.area = Number(area.toFixed(2));
24398         }
24399         _loco._cache[id2] = feature3;
24400       });
24401     }
24402     /**
24403      * mergeLocationSets
24404      * Accepts an Array of Objects containing `locationSet` properties:
24405      * [
24406      *  { id: 'preset1', locationSet: {…} },
24407      *  { id: 'preset2', locationSet: {…} },
24408      *  …
24409      * ]
24410      * After validating, the Objects will be decorated with a `locationSetID` property:
24411      * [
24412      *  { id: 'preset1', locationSet: {…}, locationSetID: '+[Q2]' },
24413      *  { id: 'preset2', locationSet: {…}, locationSetID: '+[Q30]' },
24414      *  …
24415      * ]
24416      *
24417      * @param  `objects`  Objects to check - they should have `locationSet` property
24418      * @return  Promise resolved true (this function used to be slow/async, now it's faster and sync)
24419      */
24420     mergeLocationSets(objects) {
24421       if (!Array.isArray(objects))
24422         return Promise.reject("nothing to do");
24423       objects.forEach((obj) => this._validateLocationSet(obj));
24424       this._rebuildIndex();
24425       return Promise.resolve(objects);
24426     }
24427     /**
24428      * locationSetID
24429      * Returns a locationSetID for a given locationSet (fallback to `+[Q2]`, world)
24430      * (The locationSet doesn't necessarily need to be resolved to compute its `id`)
24431      *
24432      * @param  `locationSet`  A locationSet Object, e.g. `{ include: ['us'] }`
24433      * @return  String locationSetID, e.g. `+[Q30]`
24434      */
24435     locationSetID(locationSet) {
24436       let locationSetID;
24437       try {
24438         locationSetID = _loco.validateLocationSet(locationSet).id;
24439       } catch (err) {
24440         locationSetID = "+[Q2]";
24441       }
24442       return locationSetID;
24443     }
24444     /**
24445      * feature
24446      * Returns the resolved GeoJSON feature for a given locationSetID (fallback to 'world')
24447      * A GeoJSON feature:
24448      * {
24449      *   type: 'Feature',
24450      *   id: '+[Q30]',
24451      *   properties: { id: '+[Q30]', area: 21817019.17, … },
24452      *   geometry: { … }
24453      * }
24454      *
24455      * @param  `locationSetID`  String identifier, e.g. `+[Q30]`
24456      * @return  GeoJSON object (fallback to world)
24457      */
24458     feature(locationSetID = "+[Q2]") {
24459       const feature3 = this._resolved.get(locationSetID);
24460       return feature3 || this._resolved.get("+[Q2]");
24461     }
24462     /**
24463      * locationSetsAt
24464      * Find all the locationSets valid at the given location.
24465      * Results include the area (in km²) to facilitate sorting.
24466      *
24467      * Object of locationSetIDs to areas (in km²)
24468      * {
24469      *   "+[Q2]": 511207893.3958111,
24470      *   "+[Q30]": 21817019.17,
24471      *   "+[new_jersey.geojson]": 22390.77,
24472      *   …
24473      * }
24474      *
24475      * @param  `loc`  `[lon,lat]` location to query, e.g. `[-74.4813, 40.7967]`
24476      * @return  Object of locationSetIDs valid at given location
24477      */
24478     locationSetsAt(loc) {
24479       let result = {};
24480       const hits = this._wp(loc, true) || [];
24481       const thiz = this;
24482       hits.forEach((prop) => {
24483         if (prop.id[0] !== "+")
24484           return;
24485         const locationSetID = prop.id;
24486         const area = thiz._knownLocationSets.get(locationSetID);
24487         if (area) {
24488           result[locationSetID] = area;
24489         }
24490       });
24491       hits.forEach((prop) => {
24492         if (prop.id[0] === "+")
24493           return;
24494         const locationID = prop.id;
24495         const included = thiz._locationIncludedIn.get(locationID);
24496         (included || []).forEach((locationSetID) => {
24497           const area = thiz._knownLocationSets.get(locationSetID);
24498           if (area) {
24499             result[locationSetID] = area;
24500           }
24501         });
24502       });
24503       hits.forEach((prop) => {
24504         if (prop.id[0] === "+")
24505           return;
24506         const locationID = prop.id;
24507         const excluded = thiz._locationExcludedIn.get(locationID);
24508         (excluded || []).forEach((locationSetID) => {
24509           delete result[locationSetID];
24510         });
24511       });
24512       return result;
24513     }
24514     // Direct access to the location-conflation resolver
24515     loco() {
24516       return _loco;
24517     }
24518   };
24519   var _sharedLocationManager = new LocationManager();
24520
24521   // node_modules/lodash-es/_freeGlobal.js
24522   var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
24523   var freeGlobal_default = freeGlobal;
24524
24525   // node_modules/lodash-es/_root.js
24526   var freeSelf = typeof self == "object" && self && self.Object === Object && self;
24527   var root2 = freeGlobal_default || freeSelf || Function("return this")();
24528   var root_default = root2;
24529
24530   // node_modules/lodash-es/_Symbol.js
24531   var Symbol2 = root_default.Symbol;
24532   var Symbol_default = Symbol2;
24533
24534   // node_modules/lodash-es/_getRawTag.js
24535   var objectProto = Object.prototype;
24536   var hasOwnProperty = objectProto.hasOwnProperty;
24537   var nativeObjectToString = objectProto.toString;
24538   var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
24539   function getRawTag(value) {
24540     var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
24541     try {
24542       value[symToStringTag] = void 0;
24543       var unmasked = true;
24544     } catch (e3) {
24545     }
24546     var result = nativeObjectToString.call(value);
24547     if (unmasked) {
24548       if (isOwn) {
24549         value[symToStringTag] = tag;
24550       } else {
24551         delete value[symToStringTag];
24552       }
24553     }
24554     return result;
24555   }
24556   var getRawTag_default = getRawTag;
24557
24558   // node_modules/lodash-es/_objectToString.js
24559   var objectProto2 = Object.prototype;
24560   var nativeObjectToString2 = objectProto2.toString;
24561   function objectToString(value) {
24562     return nativeObjectToString2.call(value);
24563   }
24564   var objectToString_default = objectToString;
24565
24566   // node_modules/lodash-es/_baseGetTag.js
24567   var nullTag = "[object Null]";
24568   var undefinedTag = "[object Undefined]";
24569   var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
24570   function baseGetTag(value) {
24571     if (value == null) {
24572       return value === void 0 ? undefinedTag : nullTag;
24573     }
24574     return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
24575   }
24576   var baseGetTag_default = baseGetTag;
24577
24578   // node_modules/lodash-es/isObjectLike.js
24579   function isObjectLike(value) {
24580     return value != null && typeof value == "object";
24581   }
24582   var isObjectLike_default = isObjectLike;
24583
24584   // node_modules/lodash-es/isSymbol.js
24585   var symbolTag = "[object Symbol]";
24586   function isSymbol(value) {
24587     return typeof value == "symbol" || isObjectLike_default(value) && baseGetTag_default(value) == symbolTag;
24588   }
24589   var isSymbol_default = isSymbol;
24590
24591   // node_modules/lodash-es/_arrayMap.js
24592   function arrayMap(array2, iteratee) {
24593     var index = -1, length = array2 == null ? 0 : array2.length, result = Array(length);
24594     while (++index < length) {
24595       result[index] = iteratee(array2[index], index, array2);
24596     }
24597     return result;
24598   }
24599   var arrayMap_default = arrayMap;
24600
24601   // node_modules/lodash-es/isArray.js
24602   var isArray = Array.isArray;
24603   var isArray_default = isArray;
24604
24605   // node_modules/lodash-es/_baseToString.js
24606   var INFINITY = 1 / 0;
24607   var symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
24608   var symbolToString = symbolProto ? symbolProto.toString : void 0;
24609   function baseToString(value) {
24610     if (typeof value == "string") {
24611       return value;
24612     }
24613     if (isArray_default(value)) {
24614       return arrayMap_default(value, baseToString) + "";
24615     }
24616     if (isSymbol_default(value)) {
24617       return symbolToString ? symbolToString.call(value) : "";
24618     }
24619     var result = value + "";
24620     return result == "0" && 1 / value == -INFINITY ? "-0" : result;
24621   }
24622   var baseToString_default = baseToString;
24623
24624   // node_modules/lodash-es/_trimmedEndIndex.js
24625   var reWhitespace = /\s/;
24626   function trimmedEndIndex(string) {
24627     var index = string.length;
24628     while (index-- && reWhitespace.test(string.charAt(index))) {
24629     }
24630     return index;
24631   }
24632   var trimmedEndIndex_default = trimmedEndIndex;
24633
24634   // node_modules/lodash-es/_baseTrim.js
24635   var reTrimStart = /^\s+/;
24636   function baseTrim(string) {
24637     return string ? string.slice(0, trimmedEndIndex_default(string) + 1).replace(reTrimStart, "") : string;
24638   }
24639   var baseTrim_default = baseTrim;
24640
24641   // node_modules/lodash-es/isObject.js
24642   function isObject(value) {
24643     var type2 = typeof value;
24644     return value != null && (type2 == "object" || type2 == "function");
24645   }
24646   var isObject_default = isObject;
24647
24648   // node_modules/lodash-es/toNumber.js
24649   var NAN = 0 / 0;
24650   var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
24651   var reIsBinary = /^0b[01]+$/i;
24652   var reIsOctal = /^0o[0-7]+$/i;
24653   var freeParseInt = parseInt;
24654   function toNumber(value) {
24655     if (typeof value == "number") {
24656       return value;
24657     }
24658     if (isSymbol_default(value)) {
24659       return NAN;
24660     }
24661     if (isObject_default(value)) {
24662       var other = typeof value.valueOf == "function" ? value.valueOf() : value;
24663       value = isObject_default(other) ? other + "" : other;
24664     }
24665     if (typeof value != "string") {
24666       return value === 0 ? value : +value;
24667     }
24668     value = baseTrim_default(value);
24669     var isBinary = reIsBinary.test(value);
24670     return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
24671   }
24672   var toNumber_default = toNumber;
24673
24674   // node_modules/lodash-es/isFunction.js
24675   var asyncTag = "[object AsyncFunction]";
24676   var funcTag = "[object Function]";
24677   var genTag = "[object GeneratorFunction]";
24678   var proxyTag = "[object Proxy]";
24679   function isFunction(value) {
24680     if (!isObject_default(value)) {
24681       return false;
24682     }
24683     var tag = baseGetTag_default(value);
24684     return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
24685   }
24686   var isFunction_default = isFunction;
24687
24688   // node_modules/lodash-es/_coreJsData.js
24689   var coreJsData = root_default["__core-js_shared__"];
24690   var coreJsData_default = coreJsData;
24691
24692   // node_modules/lodash-es/_isMasked.js
24693   var maskSrcKey = function() {
24694     var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
24695     return uid ? "Symbol(src)_1." + uid : "";
24696   }();
24697   function isMasked(func) {
24698     return !!maskSrcKey && maskSrcKey in func;
24699   }
24700   var isMasked_default = isMasked;
24701
24702   // node_modules/lodash-es/_toSource.js
24703   var funcProto = Function.prototype;
24704   var funcToString = funcProto.toString;
24705   function toSource(func) {
24706     if (func != null) {
24707       try {
24708         return funcToString.call(func);
24709       } catch (e3) {
24710       }
24711       try {
24712         return func + "";
24713       } catch (e3) {
24714       }
24715     }
24716     return "";
24717   }
24718   var toSource_default = toSource;
24719
24720   // node_modules/lodash-es/_baseIsNative.js
24721   var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
24722   var reIsHostCtor = /^\[object .+?Constructor\]$/;
24723   var funcProto2 = Function.prototype;
24724   var objectProto3 = Object.prototype;
24725   var funcToString2 = funcProto2.toString;
24726   var hasOwnProperty2 = objectProto3.hasOwnProperty;
24727   var reIsNative = RegExp(
24728     "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
24729   );
24730   function baseIsNative(value) {
24731     if (!isObject_default(value) || isMasked_default(value)) {
24732       return false;
24733     }
24734     var pattern = isFunction_default(value) ? reIsNative : reIsHostCtor;
24735     return pattern.test(toSource_default(value));
24736   }
24737   var baseIsNative_default = baseIsNative;
24738
24739   // node_modules/lodash-es/_getValue.js
24740   function getValue(object, key) {
24741     return object == null ? void 0 : object[key];
24742   }
24743   var getValue_default = getValue;
24744
24745   // node_modules/lodash-es/_getNative.js
24746   function getNative(object, key) {
24747     var value = getValue_default(object, key);
24748     return baseIsNative_default(value) ? value : void 0;
24749   }
24750   var getNative_default = getNative;
24751
24752   // node_modules/lodash-es/_WeakMap.js
24753   var WeakMap = getNative_default(root_default, "WeakMap");
24754   var WeakMap_default = WeakMap;
24755
24756   // node_modules/lodash-es/_isIndex.js
24757   var MAX_SAFE_INTEGER = 9007199254740991;
24758   var reIsUint = /^(?:0|[1-9]\d*)$/;
24759   function isIndex(value, length) {
24760     var type2 = typeof value;
24761     length = length == null ? MAX_SAFE_INTEGER : length;
24762     return !!length && (type2 == "number" || type2 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
24763   }
24764   var isIndex_default = isIndex;
24765
24766   // node_modules/lodash-es/eq.js
24767   function eq(value, other) {
24768     return value === other || value !== value && other !== other;
24769   }
24770   var eq_default = eq;
24771
24772   // node_modules/lodash-es/isLength.js
24773   var MAX_SAFE_INTEGER2 = 9007199254740991;
24774   function isLength(value) {
24775     return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER2;
24776   }
24777   var isLength_default = isLength;
24778
24779   // node_modules/lodash-es/isArrayLike.js
24780   function isArrayLike(value) {
24781     return value != null && isLength_default(value.length) && !isFunction_default(value);
24782   }
24783   var isArrayLike_default = isArrayLike;
24784
24785   // node_modules/lodash-es/_isPrototype.js
24786   var objectProto4 = Object.prototype;
24787   function isPrototype(value) {
24788     var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto4;
24789     return value === proto;
24790   }
24791   var isPrototype_default = isPrototype;
24792
24793   // node_modules/lodash-es/_baseTimes.js
24794   function baseTimes(n3, iteratee) {
24795     var index = -1, result = Array(n3);
24796     while (++index < n3) {
24797       result[index] = iteratee(index);
24798     }
24799     return result;
24800   }
24801   var baseTimes_default = baseTimes;
24802
24803   // node_modules/lodash-es/_baseIsArguments.js
24804   var argsTag = "[object Arguments]";
24805   function baseIsArguments(value) {
24806     return isObjectLike_default(value) && baseGetTag_default(value) == argsTag;
24807   }
24808   var baseIsArguments_default = baseIsArguments;
24809
24810   // node_modules/lodash-es/isArguments.js
24811   var objectProto5 = Object.prototype;
24812   var hasOwnProperty3 = objectProto5.hasOwnProperty;
24813   var propertyIsEnumerable = objectProto5.propertyIsEnumerable;
24814   var isArguments = baseIsArguments_default(function() {
24815     return arguments;
24816   }()) ? baseIsArguments_default : function(value) {
24817     return isObjectLike_default(value) && hasOwnProperty3.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
24818   };
24819   var isArguments_default = isArguments;
24820
24821   // node_modules/lodash-es/stubFalse.js
24822   function stubFalse() {
24823     return false;
24824   }
24825   var stubFalse_default = stubFalse;
24826
24827   // node_modules/lodash-es/isBuffer.js
24828   var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
24829   var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
24830   var moduleExports = freeModule && freeModule.exports === freeExports;
24831   var Buffer2 = moduleExports ? root_default.Buffer : void 0;
24832   var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
24833   var isBuffer = nativeIsBuffer || stubFalse_default;
24834   var isBuffer_default = isBuffer;
24835
24836   // node_modules/lodash-es/_baseIsTypedArray.js
24837   var argsTag2 = "[object Arguments]";
24838   var arrayTag = "[object Array]";
24839   var boolTag = "[object Boolean]";
24840   var dateTag = "[object Date]";
24841   var errorTag = "[object Error]";
24842   var funcTag2 = "[object Function]";
24843   var mapTag = "[object Map]";
24844   var numberTag = "[object Number]";
24845   var objectTag = "[object Object]";
24846   var regexpTag = "[object RegExp]";
24847   var setTag = "[object Set]";
24848   var stringTag = "[object String]";
24849   var weakMapTag = "[object WeakMap]";
24850   var arrayBufferTag = "[object ArrayBuffer]";
24851   var dataViewTag = "[object DataView]";
24852   var float32Tag = "[object Float32Array]";
24853   var float64Tag = "[object Float64Array]";
24854   var int8Tag = "[object Int8Array]";
24855   var int16Tag = "[object Int16Array]";
24856   var int32Tag = "[object Int32Array]";
24857   var uint8Tag = "[object Uint8Array]";
24858   var uint8ClampedTag = "[object Uint8ClampedArray]";
24859   var uint16Tag = "[object Uint16Array]";
24860   var uint32Tag = "[object Uint32Array]";
24861   var typedArrayTags = {};
24862   typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
24863   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;
24864   function baseIsTypedArray(value) {
24865     return isObjectLike_default(value) && isLength_default(value.length) && !!typedArrayTags[baseGetTag_default(value)];
24866   }
24867   var baseIsTypedArray_default = baseIsTypedArray;
24868
24869   // node_modules/lodash-es/_baseUnary.js
24870   function baseUnary(func) {
24871     return function(value) {
24872       return func(value);
24873     };
24874   }
24875   var baseUnary_default = baseUnary;
24876
24877   // node_modules/lodash-es/_nodeUtil.js
24878   var freeExports2 = typeof exports == "object" && exports && !exports.nodeType && exports;
24879   var freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module;
24880   var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
24881   var freeProcess = moduleExports2 && freeGlobal_default.process;
24882   var nodeUtil = function() {
24883     try {
24884       var types = freeModule2 && freeModule2.require && freeModule2.require("util").types;
24885       if (types) {
24886         return types;
24887       }
24888       return freeProcess && freeProcess.binding && freeProcess.binding("util");
24889     } catch (e3) {
24890     }
24891   }();
24892   var nodeUtil_default = nodeUtil;
24893
24894   // node_modules/lodash-es/isTypedArray.js
24895   var nodeIsTypedArray = nodeUtil_default && nodeUtil_default.isTypedArray;
24896   var isTypedArray = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : baseIsTypedArray_default;
24897   var isTypedArray_default = isTypedArray;
24898
24899   // node_modules/lodash-es/_arrayLikeKeys.js
24900   var objectProto6 = Object.prototype;
24901   var hasOwnProperty4 = objectProto6.hasOwnProperty;
24902   function arrayLikeKeys(value, inherited) {
24903     var isArr = isArray_default(value), isArg = !isArr && isArguments_default(value), isBuff = !isArr && !isArg && isBuffer_default(value), isType = !isArr && !isArg && !isBuff && isTypedArray_default(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes_default(value.length, String) : [], length = result.length;
24904     for (var key in value) {
24905       if ((inherited || hasOwnProperty4.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
24906       (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
24907       isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
24908       isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
24909       isIndex_default(key, length)))) {
24910         result.push(key);
24911       }
24912     }
24913     return result;
24914   }
24915   var arrayLikeKeys_default = arrayLikeKeys;
24916
24917   // node_modules/lodash-es/_overArg.js
24918   function overArg(func, transform2) {
24919     return function(arg) {
24920       return func(transform2(arg));
24921     };
24922   }
24923   var overArg_default = overArg;
24924
24925   // node_modules/lodash-es/_nativeKeys.js
24926   var nativeKeys = overArg_default(Object.keys, Object);
24927   var nativeKeys_default = nativeKeys;
24928
24929   // node_modules/lodash-es/_baseKeys.js
24930   var objectProto7 = Object.prototype;
24931   var hasOwnProperty5 = objectProto7.hasOwnProperty;
24932   function baseKeys(object) {
24933     if (!isPrototype_default(object)) {
24934       return nativeKeys_default(object);
24935     }
24936     var result = [];
24937     for (var key in Object(object)) {
24938       if (hasOwnProperty5.call(object, key) && key != "constructor") {
24939         result.push(key);
24940       }
24941     }
24942     return result;
24943   }
24944   var baseKeys_default = baseKeys;
24945
24946   // node_modules/lodash-es/keys.js
24947   function keys(object) {
24948     return isArrayLike_default(object) ? arrayLikeKeys_default(object) : baseKeys_default(object);
24949   }
24950   var keys_default = keys;
24951
24952   // node_modules/lodash-es/_nativeCreate.js
24953   var nativeCreate = getNative_default(Object, "create");
24954   var nativeCreate_default = nativeCreate;
24955
24956   // node_modules/lodash-es/_hashClear.js
24957   function hashClear() {
24958     this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {};
24959     this.size = 0;
24960   }
24961   var hashClear_default = hashClear;
24962
24963   // node_modules/lodash-es/_hashDelete.js
24964   function hashDelete(key) {
24965     var result = this.has(key) && delete this.__data__[key];
24966     this.size -= result ? 1 : 0;
24967     return result;
24968   }
24969   var hashDelete_default = hashDelete;
24970
24971   // node_modules/lodash-es/_hashGet.js
24972   var HASH_UNDEFINED = "__lodash_hash_undefined__";
24973   var objectProto8 = Object.prototype;
24974   var hasOwnProperty6 = objectProto8.hasOwnProperty;
24975   function hashGet(key) {
24976     var data = this.__data__;
24977     if (nativeCreate_default) {
24978       var result = data[key];
24979       return result === HASH_UNDEFINED ? void 0 : result;
24980     }
24981     return hasOwnProperty6.call(data, key) ? data[key] : void 0;
24982   }
24983   var hashGet_default = hashGet;
24984
24985   // node_modules/lodash-es/_hashHas.js
24986   var objectProto9 = Object.prototype;
24987   var hasOwnProperty7 = objectProto9.hasOwnProperty;
24988   function hashHas(key) {
24989     var data = this.__data__;
24990     return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty7.call(data, key);
24991   }
24992   var hashHas_default = hashHas;
24993
24994   // node_modules/lodash-es/_hashSet.js
24995   var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
24996   function hashSet(key, value) {
24997     var data = this.__data__;
24998     this.size += this.has(key) ? 0 : 1;
24999     data[key] = nativeCreate_default && value === void 0 ? HASH_UNDEFINED2 : value;
25000     return this;
25001   }
25002   var hashSet_default = hashSet;
25003
25004   // node_modules/lodash-es/_Hash.js
25005   function Hash(entries) {
25006     var index = -1, length = entries == null ? 0 : entries.length;
25007     this.clear();
25008     while (++index < length) {
25009       var entry = entries[index];
25010       this.set(entry[0], entry[1]);
25011     }
25012   }
25013   Hash.prototype.clear = hashClear_default;
25014   Hash.prototype["delete"] = hashDelete_default;
25015   Hash.prototype.get = hashGet_default;
25016   Hash.prototype.has = hashHas_default;
25017   Hash.prototype.set = hashSet_default;
25018   var Hash_default = Hash;
25019
25020   // node_modules/lodash-es/_listCacheClear.js
25021   function listCacheClear() {
25022     this.__data__ = [];
25023     this.size = 0;
25024   }
25025   var listCacheClear_default = listCacheClear;
25026
25027   // node_modules/lodash-es/_assocIndexOf.js
25028   function assocIndexOf(array2, key) {
25029     var length = array2.length;
25030     while (length--) {
25031       if (eq_default(array2[length][0], key)) {
25032         return length;
25033       }
25034     }
25035     return -1;
25036   }
25037   var assocIndexOf_default = assocIndexOf;
25038
25039   // node_modules/lodash-es/_listCacheDelete.js
25040   var arrayProto = Array.prototype;
25041   var splice = arrayProto.splice;
25042   function listCacheDelete(key) {
25043     var data = this.__data__, index = assocIndexOf_default(data, key);
25044     if (index < 0) {
25045       return false;
25046     }
25047     var lastIndex = data.length - 1;
25048     if (index == lastIndex) {
25049       data.pop();
25050     } else {
25051       splice.call(data, index, 1);
25052     }
25053     --this.size;
25054     return true;
25055   }
25056   var listCacheDelete_default = listCacheDelete;
25057
25058   // node_modules/lodash-es/_listCacheGet.js
25059   function listCacheGet(key) {
25060     var data = this.__data__, index = assocIndexOf_default(data, key);
25061     return index < 0 ? void 0 : data[index][1];
25062   }
25063   var listCacheGet_default = listCacheGet;
25064
25065   // node_modules/lodash-es/_listCacheHas.js
25066   function listCacheHas(key) {
25067     return assocIndexOf_default(this.__data__, key) > -1;
25068   }
25069   var listCacheHas_default = listCacheHas;
25070
25071   // node_modules/lodash-es/_listCacheSet.js
25072   function listCacheSet(key, value) {
25073     var data = this.__data__, index = assocIndexOf_default(data, key);
25074     if (index < 0) {
25075       ++this.size;
25076       data.push([key, value]);
25077     } else {
25078       data[index][1] = value;
25079     }
25080     return this;
25081   }
25082   var listCacheSet_default = listCacheSet;
25083
25084   // node_modules/lodash-es/_ListCache.js
25085   function ListCache(entries) {
25086     var index = -1, length = entries == null ? 0 : entries.length;
25087     this.clear();
25088     while (++index < length) {
25089       var entry = entries[index];
25090       this.set(entry[0], entry[1]);
25091     }
25092   }
25093   ListCache.prototype.clear = listCacheClear_default;
25094   ListCache.prototype["delete"] = listCacheDelete_default;
25095   ListCache.prototype.get = listCacheGet_default;
25096   ListCache.prototype.has = listCacheHas_default;
25097   ListCache.prototype.set = listCacheSet_default;
25098   var ListCache_default = ListCache;
25099
25100   // node_modules/lodash-es/_Map.js
25101   var Map2 = getNative_default(root_default, "Map");
25102   var Map_default = Map2;
25103
25104   // node_modules/lodash-es/_mapCacheClear.js
25105   function mapCacheClear() {
25106     this.size = 0;
25107     this.__data__ = {
25108       "hash": new Hash_default(),
25109       "map": new (Map_default || ListCache_default)(),
25110       "string": new Hash_default()
25111     };
25112   }
25113   var mapCacheClear_default = mapCacheClear;
25114
25115   // node_modules/lodash-es/_isKeyable.js
25116   function isKeyable(value) {
25117     var type2 = typeof value;
25118     return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
25119   }
25120   var isKeyable_default = isKeyable;
25121
25122   // node_modules/lodash-es/_getMapData.js
25123   function getMapData(map2, key) {
25124     var data = map2.__data__;
25125     return isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
25126   }
25127   var getMapData_default = getMapData;
25128
25129   // node_modules/lodash-es/_mapCacheDelete.js
25130   function mapCacheDelete(key) {
25131     var result = getMapData_default(this, key)["delete"](key);
25132     this.size -= result ? 1 : 0;
25133     return result;
25134   }
25135   var mapCacheDelete_default = mapCacheDelete;
25136
25137   // node_modules/lodash-es/_mapCacheGet.js
25138   function mapCacheGet(key) {
25139     return getMapData_default(this, key).get(key);
25140   }
25141   var mapCacheGet_default = mapCacheGet;
25142
25143   // node_modules/lodash-es/_mapCacheHas.js
25144   function mapCacheHas(key) {
25145     return getMapData_default(this, key).has(key);
25146   }
25147   var mapCacheHas_default = mapCacheHas;
25148
25149   // node_modules/lodash-es/_mapCacheSet.js
25150   function mapCacheSet(key, value) {
25151     var data = getMapData_default(this, key), size = data.size;
25152     data.set(key, value);
25153     this.size += data.size == size ? 0 : 1;
25154     return this;
25155   }
25156   var mapCacheSet_default = mapCacheSet;
25157
25158   // node_modules/lodash-es/_MapCache.js
25159   function MapCache(entries) {
25160     var index = -1, length = entries == null ? 0 : entries.length;
25161     this.clear();
25162     while (++index < length) {
25163       var entry = entries[index];
25164       this.set(entry[0], entry[1]);
25165     }
25166   }
25167   MapCache.prototype.clear = mapCacheClear_default;
25168   MapCache.prototype["delete"] = mapCacheDelete_default;
25169   MapCache.prototype.get = mapCacheGet_default;
25170   MapCache.prototype.has = mapCacheHas_default;
25171   MapCache.prototype.set = mapCacheSet_default;
25172   var MapCache_default = MapCache;
25173
25174   // node_modules/lodash-es/toString.js
25175   function toString(value) {
25176     return value == null ? "" : baseToString_default(value);
25177   }
25178   var toString_default = toString;
25179
25180   // node_modules/lodash-es/_arrayPush.js
25181   function arrayPush(array2, values) {
25182     var index = -1, length = values.length, offset = array2.length;
25183     while (++index < length) {
25184       array2[offset + index] = values[index];
25185     }
25186     return array2;
25187   }
25188   var arrayPush_default = arrayPush;
25189
25190   // node_modules/lodash-es/_basePropertyOf.js
25191   function basePropertyOf(object) {
25192     return function(key) {
25193       return object == null ? void 0 : object[key];
25194     };
25195   }
25196   var basePropertyOf_default = basePropertyOf;
25197
25198   // node_modules/lodash-es/_stackClear.js
25199   function stackClear() {
25200     this.__data__ = new ListCache_default();
25201     this.size = 0;
25202   }
25203   var stackClear_default = stackClear;
25204
25205   // node_modules/lodash-es/_stackDelete.js
25206   function stackDelete(key) {
25207     var data = this.__data__, result = data["delete"](key);
25208     this.size = data.size;
25209     return result;
25210   }
25211   var stackDelete_default = stackDelete;
25212
25213   // node_modules/lodash-es/_stackGet.js
25214   function stackGet(key) {
25215     return this.__data__.get(key);
25216   }
25217   var stackGet_default = stackGet;
25218
25219   // node_modules/lodash-es/_stackHas.js
25220   function stackHas(key) {
25221     return this.__data__.has(key);
25222   }
25223   var stackHas_default = stackHas;
25224
25225   // node_modules/lodash-es/_stackSet.js
25226   var LARGE_ARRAY_SIZE = 200;
25227   function stackSet(key, value) {
25228     var data = this.__data__;
25229     if (data instanceof ListCache_default) {
25230       var pairs2 = data.__data__;
25231       if (!Map_default || pairs2.length < LARGE_ARRAY_SIZE - 1) {
25232         pairs2.push([key, value]);
25233         this.size = ++data.size;
25234         return this;
25235       }
25236       data = this.__data__ = new MapCache_default(pairs2);
25237     }
25238     data.set(key, value);
25239     this.size = data.size;
25240     return this;
25241   }
25242   var stackSet_default = stackSet;
25243
25244   // node_modules/lodash-es/_Stack.js
25245   function Stack(entries) {
25246     var data = this.__data__ = new ListCache_default(entries);
25247     this.size = data.size;
25248   }
25249   Stack.prototype.clear = stackClear_default;
25250   Stack.prototype["delete"] = stackDelete_default;
25251   Stack.prototype.get = stackGet_default;
25252   Stack.prototype.has = stackHas_default;
25253   Stack.prototype.set = stackSet_default;
25254   var Stack_default = Stack;
25255
25256   // node_modules/lodash-es/_arrayFilter.js
25257   function arrayFilter(array2, predicate) {
25258     var index = -1, length = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
25259     while (++index < length) {
25260       var value = array2[index];
25261       if (predicate(value, index, array2)) {
25262         result[resIndex++] = value;
25263       }
25264     }
25265     return result;
25266   }
25267   var arrayFilter_default = arrayFilter;
25268
25269   // node_modules/lodash-es/stubArray.js
25270   function stubArray() {
25271     return [];
25272   }
25273   var stubArray_default = stubArray;
25274
25275   // node_modules/lodash-es/_getSymbols.js
25276   var objectProto10 = Object.prototype;
25277   var propertyIsEnumerable2 = objectProto10.propertyIsEnumerable;
25278   var nativeGetSymbols = Object.getOwnPropertySymbols;
25279   var getSymbols = !nativeGetSymbols ? stubArray_default : function(object) {
25280     if (object == null) {
25281       return [];
25282     }
25283     object = Object(object);
25284     return arrayFilter_default(nativeGetSymbols(object), function(symbol) {
25285       return propertyIsEnumerable2.call(object, symbol);
25286     });
25287   };
25288   var getSymbols_default = getSymbols;
25289
25290   // node_modules/lodash-es/_baseGetAllKeys.js
25291   function baseGetAllKeys(object, keysFunc, symbolsFunc) {
25292     var result = keysFunc(object);
25293     return isArray_default(object) ? result : arrayPush_default(result, symbolsFunc(object));
25294   }
25295   var baseGetAllKeys_default = baseGetAllKeys;
25296
25297   // node_modules/lodash-es/_getAllKeys.js
25298   function getAllKeys(object) {
25299     return baseGetAllKeys_default(object, keys_default, getSymbols_default);
25300   }
25301   var getAllKeys_default = getAllKeys;
25302
25303   // node_modules/lodash-es/_DataView.js
25304   var DataView2 = getNative_default(root_default, "DataView");
25305   var DataView_default = DataView2;
25306
25307   // node_modules/lodash-es/_Promise.js
25308   var Promise2 = getNative_default(root_default, "Promise");
25309   var Promise_default = Promise2;
25310
25311   // node_modules/lodash-es/_Set.js
25312   var Set2 = getNative_default(root_default, "Set");
25313   var Set_default = Set2;
25314
25315   // node_modules/lodash-es/_getTag.js
25316   var mapTag2 = "[object Map]";
25317   var objectTag2 = "[object Object]";
25318   var promiseTag = "[object Promise]";
25319   var setTag2 = "[object Set]";
25320   var weakMapTag2 = "[object WeakMap]";
25321   var dataViewTag2 = "[object DataView]";
25322   var dataViewCtorString = toSource_default(DataView_default);
25323   var mapCtorString = toSource_default(Map_default);
25324   var promiseCtorString = toSource_default(Promise_default);
25325   var setCtorString = toSource_default(Set_default);
25326   var weakMapCtorString = toSource_default(WeakMap_default);
25327   var getTag = baseGetTag_default;
25328   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) {
25329     getTag = function(value) {
25330       var result = baseGetTag_default(value), Ctor = result == objectTag2 ? value.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : "";
25331       if (ctorString) {
25332         switch (ctorString) {
25333           case dataViewCtorString:
25334             return dataViewTag2;
25335           case mapCtorString:
25336             return mapTag2;
25337           case promiseCtorString:
25338             return promiseTag;
25339           case setCtorString:
25340             return setTag2;
25341           case weakMapCtorString:
25342             return weakMapTag2;
25343         }
25344       }
25345       return result;
25346     };
25347   }
25348   var getTag_default = getTag;
25349
25350   // node_modules/lodash-es/_Uint8Array.js
25351   var Uint8Array2 = root_default.Uint8Array;
25352   var Uint8Array_default = Uint8Array2;
25353
25354   // node_modules/lodash-es/_setCacheAdd.js
25355   var HASH_UNDEFINED3 = "__lodash_hash_undefined__";
25356   function setCacheAdd(value) {
25357     this.__data__.set(value, HASH_UNDEFINED3);
25358     return this;
25359   }
25360   var setCacheAdd_default = setCacheAdd;
25361
25362   // node_modules/lodash-es/_setCacheHas.js
25363   function setCacheHas(value) {
25364     return this.__data__.has(value);
25365   }
25366   var setCacheHas_default = setCacheHas;
25367
25368   // node_modules/lodash-es/_SetCache.js
25369   function SetCache(values) {
25370     var index = -1, length = values == null ? 0 : values.length;
25371     this.__data__ = new MapCache_default();
25372     while (++index < length) {
25373       this.add(values[index]);
25374     }
25375   }
25376   SetCache.prototype.add = SetCache.prototype.push = setCacheAdd_default;
25377   SetCache.prototype.has = setCacheHas_default;
25378   var SetCache_default = SetCache;
25379
25380   // node_modules/lodash-es/_arraySome.js
25381   function arraySome(array2, predicate) {
25382     var index = -1, length = array2 == null ? 0 : array2.length;
25383     while (++index < length) {
25384       if (predicate(array2[index], index, array2)) {
25385         return true;
25386       }
25387     }
25388     return false;
25389   }
25390   var arraySome_default = arraySome;
25391
25392   // node_modules/lodash-es/_cacheHas.js
25393   function cacheHas(cache, key) {
25394     return cache.has(key);
25395   }
25396   var cacheHas_default = cacheHas;
25397
25398   // node_modules/lodash-es/_equalArrays.js
25399   var COMPARE_PARTIAL_FLAG = 1;
25400   var COMPARE_UNORDERED_FLAG = 2;
25401   function equalArrays(array2, other, bitmask, customizer, equalFunc, stack) {
25402     var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array2.length, othLength = other.length;
25403     if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
25404       return false;
25405     }
25406     var arrStacked = stack.get(array2);
25407     var othStacked = stack.get(other);
25408     if (arrStacked && othStacked) {
25409       return arrStacked == other && othStacked == array2;
25410     }
25411     var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache_default() : void 0;
25412     stack.set(array2, other);
25413     stack.set(other, array2);
25414     while (++index < arrLength) {
25415       var arrValue = array2[index], othValue = other[index];
25416       if (customizer) {
25417         var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack);
25418       }
25419       if (compared !== void 0) {
25420         if (compared) {
25421           continue;
25422         }
25423         result = false;
25424         break;
25425       }
25426       if (seen) {
25427         if (!arraySome_default(other, function(othValue2, othIndex) {
25428           if (!cacheHas_default(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
25429             return seen.push(othIndex);
25430           }
25431         })) {
25432           result = false;
25433           break;
25434         }
25435       } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
25436         result = false;
25437         break;
25438       }
25439     }
25440     stack["delete"](array2);
25441     stack["delete"](other);
25442     return result;
25443   }
25444   var equalArrays_default = equalArrays;
25445
25446   // node_modules/lodash-es/_mapToArray.js
25447   function mapToArray(map2) {
25448     var index = -1, result = Array(map2.size);
25449     map2.forEach(function(value, key) {
25450       result[++index] = [key, value];
25451     });
25452     return result;
25453   }
25454   var mapToArray_default = mapToArray;
25455
25456   // node_modules/lodash-es/_setToArray.js
25457   function setToArray(set3) {
25458     var index = -1, result = Array(set3.size);
25459     set3.forEach(function(value) {
25460       result[++index] = value;
25461     });
25462     return result;
25463   }
25464   var setToArray_default = setToArray;
25465
25466   // node_modules/lodash-es/_equalByTag.js
25467   var COMPARE_PARTIAL_FLAG2 = 1;
25468   var COMPARE_UNORDERED_FLAG2 = 2;
25469   var boolTag2 = "[object Boolean]";
25470   var dateTag2 = "[object Date]";
25471   var errorTag2 = "[object Error]";
25472   var mapTag3 = "[object Map]";
25473   var numberTag2 = "[object Number]";
25474   var regexpTag2 = "[object RegExp]";
25475   var setTag3 = "[object Set]";
25476   var stringTag2 = "[object String]";
25477   var symbolTag2 = "[object Symbol]";
25478   var arrayBufferTag2 = "[object ArrayBuffer]";
25479   var dataViewTag3 = "[object DataView]";
25480   var symbolProto2 = Symbol_default ? Symbol_default.prototype : void 0;
25481   var symbolValueOf = symbolProto2 ? symbolProto2.valueOf : void 0;
25482   function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
25483     switch (tag) {
25484       case dataViewTag3:
25485         if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
25486           return false;
25487         }
25488         object = object.buffer;
25489         other = other.buffer;
25490       case arrayBufferTag2:
25491         if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array_default(object), new Uint8Array_default(other))) {
25492           return false;
25493         }
25494         return true;
25495       case boolTag2:
25496       case dateTag2:
25497       case numberTag2:
25498         return eq_default(+object, +other);
25499       case errorTag2:
25500         return object.name == other.name && object.message == other.message;
25501       case regexpTag2:
25502       case stringTag2:
25503         return object == other + "";
25504       case mapTag3:
25505         var convert = mapToArray_default;
25506       case setTag3:
25507         var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
25508         convert || (convert = setToArray_default);
25509         if (object.size != other.size && !isPartial) {
25510           return false;
25511         }
25512         var stacked = stack.get(object);
25513         if (stacked) {
25514           return stacked == other;
25515         }
25516         bitmask |= COMPARE_UNORDERED_FLAG2;
25517         stack.set(object, other);
25518         var result = equalArrays_default(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
25519         stack["delete"](object);
25520         return result;
25521       case symbolTag2:
25522         if (symbolValueOf) {
25523           return symbolValueOf.call(object) == symbolValueOf.call(other);
25524         }
25525     }
25526     return false;
25527   }
25528   var equalByTag_default = equalByTag;
25529
25530   // node_modules/lodash-es/_equalObjects.js
25531   var COMPARE_PARTIAL_FLAG3 = 1;
25532   var objectProto11 = Object.prototype;
25533   var hasOwnProperty8 = objectProto11.hasOwnProperty;
25534   function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
25535     var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = getAllKeys_default(object), objLength = objProps.length, othProps = getAllKeys_default(other), othLength = othProps.length;
25536     if (objLength != othLength && !isPartial) {
25537       return false;
25538     }
25539     var index = objLength;
25540     while (index--) {
25541       var key = objProps[index];
25542       if (!(isPartial ? key in other : hasOwnProperty8.call(other, key))) {
25543         return false;
25544       }
25545     }
25546     var objStacked = stack.get(object);
25547     var othStacked = stack.get(other);
25548     if (objStacked && othStacked) {
25549       return objStacked == other && othStacked == object;
25550     }
25551     var result = true;
25552     stack.set(object, other);
25553     stack.set(other, object);
25554     var skipCtor = isPartial;
25555     while (++index < objLength) {
25556       key = objProps[index];
25557       var objValue = object[key], othValue = other[key];
25558       if (customizer) {
25559         var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
25560       }
25561       if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
25562         result = false;
25563         break;
25564       }
25565       skipCtor || (skipCtor = key == "constructor");
25566     }
25567     if (result && !skipCtor) {
25568       var objCtor = object.constructor, othCtor = other.constructor;
25569       if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
25570         result = false;
25571       }
25572     }
25573     stack["delete"](object);
25574     stack["delete"](other);
25575     return result;
25576   }
25577   var equalObjects_default = equalObjects;
25578
25579   // node_modules/lodash-es/_baseIsEqualDeep.js
25580   var COMPARE_PARTIAL_FLAG4 = 1;
25581   var argsTag3 = "[object Arguments]";
25582   var arrayTag2 = "[object Array]";
25583   var objectTag3 = "[object Object]";
25584   var objectProto12 = Object.prototype;
25585   var hasOwnProperty9 = objectProto12.hasOwnProperty;
25586   function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
25587     var objIsArr = isArray_default(object), othIsArr = isArray_default(other), objTag = objIsArr ? arrayTag2 : getTag_default(object), othTag = othIsArr ? arrayTag2 : getTag_default(other);
25588     objTag = objTag == argsTag3 ? objectTag3 : objTag;
25589     othTag = othTag == argsTag3 ? objectTag3 : othTag;
25590     var objIsObj = objTag == objectTag3, othIsObj = othTag == objectTag3, isSameTag = objTag == othTag;
25591     if (isSameTag && isBuffer_default(object)) {
25592       if (!isBuffer_default(other)) {
25593         return false;
25594       }
25595       objIsArr = true;
25596       objIsObj = false;
25597     }
25598     if (isSameTag && !objIsObj) {
25599       stack || (stack = new Stack_default());
25600       return objIsArr || isTypedArray_default(object) ? equalArrays_default(object, other, bitmask, customizer, equalFunc, stack) : equalByTag_default(object, other, objTag, bitmask, customizer, equalFunc, stack);
25601     }
25602     if (!(bitmask & COMPARE_PARTIAL_FLAG4)) {
25603       var objIsWrapped = objIsObj && hasOwnProperty9.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty9.call(other, "__wrapped__");
25604       if (objIsWrapped || othIsWrapped) {
25605         var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
25606         stack || (stack = new Stack_default());
25607         return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
25608       }
25609     }
25610     if (!isSameTag) {
25611       return false;
25612     }
25613     stack || (stack = new Stack_default());
25614     return equalObjects_default(object, other, bitmask, customizer, equalFunc, stack);
25615   }
25616   var baseIsEqualDeep_default = baseIsEqualDeep;
25617
25618   // node_modules/lodash-es/_baseIsEqual.js
25619   function baseIsEqual(value, other, bitmask, customizer, stack) {
25620     if (value === other) {
25621       return true;
25622     }
25623     if (value == null || other == null || !isObjectLike_default(value) && !isObjectLike_default(other)) {
25624       return value !== value && other !== other;
25625     }
25626     return baseIsEqualDeep_default(value, other, bitmask, customizer, baseIsEqual, stack);
25627   }
25628   var baseIsEqual_default = baseIsEqual;
25629
25630   // node_modules/lodash-es/now.js
25631   var now2 = function() {
25632     return root_default.Date.now();
25633   };
25634   var now_default = now2;
25635
25636   // node_modules/lodash-es/debounce.js
25637   var FUNC_ERROR_TEXT = "Expected a function";
25638   var nativeMax = Math.max;
25639   var nativeMin = Math.min;
25640   function debounce(func, wait, options2) {
25641     var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
25642     if (typeof func != "function") {
25643       throw new TypeError(FUNC_ERROR_TEXT);
25644     }
25645     wait = toNumber_default(wait) || 0;
25646     if (isObject_default(options2)) {
25647       leading = !!options2.leading;
25648       maxing = "maxWait" in options2;
25649       maxWait = maxing ? nativeMax(toNumber_default(options2.maxWait) || 0, wait) : maxWait;
25650       trailing = "trailing" in options2 ? !!options2.trailing : trailing;
25651     }
25652     function invokeFunc(time) {
25653       var args = lastArgs, thisArg = lastThis;
25654       lastArgs = lastThis = void 0;
25655       lastInvokeTime = time;
25656       result = func.apply(thisArg, args);
25657       return result;
25658     }
25659     function leadingEdge(time) {
25660       lastInvokeTime = time;
25661       timerId = setTimeout(timerExpired, wait);
25662       return leading ? invokeFunc(time) : result;
25663     }
25664     function remainingWait(time) {
25665       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
25666       return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
25667     }
25668     function shouldInvoke(time) {
25669       var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
25670       return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
25671     }
25672     function timerExpired() {
25673       var time = now_default();
25674       if (shouldInvoke(time)) {
25675         return trailingEdge(time);
25676       }
25677       timerId = setTimeout(timerExpired, remainingWait(time));
25678     }
25679     function trailingEdge(time) {
25680       timerId = void 0;
25681       if (trailing && lastArgs) {
25682         return invokeFunc(time);
25683       }
25684       lastArgs = lastThis = void 0;
25685       return result;
25686     }
25687     function cancel() {
25688       if (timerId !== void 0) {
25689         clearTimeout(timerId);
25690       }
25691       lastInvokeTime = 0;
25692       lastArgs = lastCallTime = lastThis = timerId = void 0;
25693     }
25694     function flush() {
25695       return timerId === void 0 ? result : trailingEdge(now_default());
25696     }
25697     function debounced() {
25698       var time = now_default(), isInvoking = shouldInvoke(time);
25699       lastArgs = arguments;
25700       lastThis = this;
25701       lastCallTime = time;
25702       if (isInvoking) {
25703         if (timerId === void 0) {
25704           return leadingEdge(lastCallTime);
25705         }
25706         if (maxing) {
25707           clearTimeout(timerId);
25708           timerId = setTimeout(timerExpired, wait);
25709           return invokeFunc(lastCallTime);
25710         }
25711       }
25712       if (timerId === void 0) {
25713         timerId = setTimeout(timerExpired, wait);
25714       }
25715       return result;
25716     }
25717     debounced.cancel = cancel;
25718     debounced.flush = flush;
25719     return debounced;
25720   }
25721   var debounce_default = debounce;
25722
25723   // node_modules/lodash-es/_escapeHtmlChar.js
25724   var htmlEscapes = {
25725     "&": "&amp;",
25726     "<": "&lt;",
25727     ">": "&gt;",
25728     '"': "&quot;",
25729     "'": "&#39;"
25730   };
25731   var escapeHtmlChar = basePropertyOf_default(htmlEscapes);
25732   var escapeHtmlChar_default = escapeHtmlChar;
25733
25734   // node_modules/lodash-es/escape.js
25735   var reUnescapedHtml = /[&<>"']/g;
25736   var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
25737   function escape2(string) {
25738     string = toString_default(string);
25739     return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar_default) : string;
25740   }
25741   var escape_default = escape2;
25742
25743   // node_modules/lodash-es/isEqual.js
25744   function isEqual(value, other) {
25745     return baseIsEqual_default(value, other);
25746   }
25747   var isEqual_default = isEqual;
25748
25749   // node_modules/lodash-es/isNumber.js
25750   var numberTag3 = "[object Number]";
25751   function isNumber(value) {
25752     return typeof value == "number" || isObjectLike_default(value) && baseGetTag_default(value) == numberTag3;
25753   }
25754   var isNumber_default = isNumber;
25755
25756   // node_modules/lodash-es/throttle.js
25757   var FUNC_ERROR_TEXT2 = "Expected a function";
25758   function throttle(func, wait, options2) {
25759     var leading = true, trailing = true;
25760     if (typeof func != "function") {
25761       throw new TypeError(FUNC_ERROR_TEXT2);
25762     }
25763     if (isObject_default(options2)) {
25764       leading = "leading" in options2 ? !!options2.leading : leading;
25765       trailing = "trailing" in options2 ? !!options2.trailing : trailing;
25766     }
25767     return debounce_default(func, wait, {
25768       "leading": leading,
25769       "maxWait": wait,
25770       "trailing": trailing
25771     });
25772   }
25773   var throttle_default = throttle;
25774
25775   // node_modules/lodash-es/_unescapeHtmlChar.js
25776   var htmlUnescapes = {
25777     "&amp;": "&",
25778     "&lt;": "<",
25779     "&gt;": ">",
25780     "&quot;": '"',
25781     "&#39;": "'"
25782   };
25783   var unescapeHtmlChar = basePropertyOf_default(htmlUnescapes);
25784   var unescapeHtmlChar_default = unescapeHtmlChar;
25785
25786   // node_modules/lodash-es/unescape.js
25787   var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
25788   var reHasEscapedHtml = RegExp(reEscapedHtml.source);
25789   function unescape2(string) {
25790     string = toString_default(string);
25791     return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar_default) : string;
25792   }
25793   var unescape_default = unescape2;
25794
25795   // modules/util/detect.js
25796   var _detected;
25797   function utilDetect(refresh2) {
25798     if (_detected && !refresh2)
25799       return _detected;
25800     _detected = {};
25801     const ua = navigator.userAgent;
25802     let m2 = null;
25803     m2 = ua.match(/(edge)\/?\s*(\.?\d+(\.\d+)*)/i);
25804     if (m2 !== null) {
25805       _detected.browser = m2[1];
25806       _detected.version = m2[2];
25807     }
25808     if (!_detected.browser) {
25809       m2 = ua.match(/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/i);
25810       if (m2 !== null) {
25811         _detected.browser = "msie";
25812         _detected.version = m2[1];
25813       }
25814     }
25815     if (!_detected.browser) {
25816       m2 = ua.match(/(opr)\/?\s*(\.?\d+(\.\d+)*)/i);
25817       if (m2 !== null) {
25818         _detected.browser = "Opera";
25819         _detected.version = m2[2];
25820       }
25821     }
25822     if (!_detected.browser) {
25823       m2 = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
25824       if (m2 !== null) {
25825         _detected.browser = m2[1];
25826         _detected.version = m2[2];
25827         m2 = ua.match(/version\/([\.\d]+)/i);
25828         if (m2 !== null)
25829           _detected.version = m2[1];
25830       }
25831     }
25832     if (!_detected.browser) {
25833       _detected.browser = navigator.appName;
25834       _detected.version = navigator.appVersion;
25835     }
25836     _detected.version = _detected.version.split(/\W/).slice(0, 2).join(".");
25837     _detected.opera = _detected.browser.toLowerCase() === "opera" && Number(_detected.version) < 15;
25838     if (_detected.browser.toLowerCase() === "msie") {
25839       _detected.ie = true;
25840       _detected.browser = "Internet Explorer";
25841       _detected.support = false;
25842     } else {
25843       _detected.ie = false;
25844       _detected.support = true;
25845     }
25846     _detected.filedrop = window.FileReader && "ondrop" in window;
25847     if (/Win/.test(ua)) {
25848       _detected.os = "win";
25849       _detected.platform = "Windows";
25850     } else if (/Mac/.test(ua)) {
25851       _detected.os = "mac";
25852       _detected.platform = "Macintosh";
25853     } else if (/X11/.test(ua) || /Linux/.test(ua)) {
25854       _detected.os = "linux";
25855       _detected.platform = "Linux";
25856     } else {
25857       _detected.os = "win";
25858       _detected.platform = "Unknown";
25859     }
25860     _detected.isMobileWebKit = (/\b(iPad|iPhone|iPod)\b/.test(ua) || // HACK: iPadOS 13+ requests desktop sites by default by using a Mac user agent,
25861     // so assume any "mac" with multitouch is actually iOS
25862     navigator.platform === "MacIntel" && "maxTouchPoints" in navigator && navigator.maxTouchPoints > 1) && /WebKit/.test(ua) && !/Edge/.test(ua) && !window.MSStream;
25863     _detected.browserLocales = Array.from(new Set(
25864       // remove duplicates
25865       [navigator.language].concat(navigator.languages || []).concat([
25866         // old property for backwards compatibility
25867         navigator.userLanguage
25868       ]).filter(Boolean)
25869     ));
25870     const loc = window.top.location;
25871     let origin = loc.origin;
25872     if (!origin) {
25873       origin = loc.protocol + "//" + loc.hostname + (loc.port ? ":" + loc.port : "");
25874     }
25875     _detected.host = origin + loc.pathname;
25876     return _detected;
25877   }
25878
25879   // modules/util/aes.js
25880   var import_aes_js = __toESM(require_aes_js());
25881   var DEFAULT_128 = [250, 157, 60, 79, 142, 134, 229, 129, 138, 126, 210, 129, 29, 71, 160, 208];
25882   function utilAesEncrypt(text2, key) {
25883     key = key || DEFAULT_128;
25884     const textBytes = import_aes_js.default.utils.utf8.toBytes(text2);
25885     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
25886     const encryptedBytes = aesCtr.encrypt(textBytes);
25887     const encryptedHex = import_aes_js.default.utils.hex.fromBytes(encryptedBytes);
25888     return encryptedHex;
25889   }
25890   function utilAesDecrypt(encryptedHex, key) {
25891     key = key || DEFAULT_128;
25892     const encryptedBytes = import_aes_js.default.utils.hex.toBytes(encryptedHex);
25893     const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
25894     const decryptedBytes = aesCtr.decrypt(encryptedBytes);
25895     const text2 = import_aes_js.default.utils.utf8.fromBytes(decryptedBytes);
25896     return text2;
25897   }
25898
25899   // modules/util/clean_tags.js
25900   function utilCleanTags(tags) {
25901     var out = {};
25902     for (var k2 in tags) {
25903       if (!k2)
25904         continue;
25905       var v2 = tags[k2];
25906       if (v2 !== void 0) {
25907         out[k2] = cleanValue(k2, v2);
25908       }
25909     }
25910     return out;
25911     function cleanValue(k3, v3) {
25912       function keepSpaces(k4) {
25913         return /_hours|_times|:conditional$/.test(k4);
25914       }
25915       function skip(k4) {
25916         return /^(description|note|fixme)$/.test(k4);
25917       }
25918       if (skip(k3))
25919         return v3;
25920       var cleaned = v3.split(";").map(function(s2) {
25921         return s2.trim();
25922       }).join(keepSpaces(k3) ? "; " : ";");
25923       if (k3.indexOf("website") !== -1 || k3.indexOf("email") !== -1 || cleaned.indexOf("http") === 0) {
25924         cleaned = cleaned.replace(/[\u200B-\u200F\uFEFF]/g, "");
25925       }
25926       return cleaned;
25927     }
25928   }
25929
25930   // modules/util/get_set_value.js
25931   function utilGetSetValue(selection2, value, shouldUpdate) {
25932     function setValue(value2, shouldUpdate2) {
25933       function valueNull() {
25934         delete this.value;
25935       }
25936       function valueConstant() {
25937         if (shouldUpdate2(this.value, value2)) {
25938           this.value = value2;
25939         }
25940       }
25941       function valueFunction() {
25942         var x2 = value2.apply(this, arguments);
25943         if (x2 === null || x2 === void 0) {
25944           delete this.value;
25945         } else if (shouldUpdate2(this.value, x2)) {
25946           this.value = x2;
25947         }
25948       }
25949       return value2 === null || value2 === void 0 ? valueNull : typeof value2 === "function" ? valueFunction : valueConstant;
25950     }
25951     if (arguments.length === 1) {
25952       return selection2.property("value");
25953     }
25954     if (shouldUpdate === void 0) {
25955       shouldUpdate = (a2, b2) => a2 !== b2;
25956     }
25957     return selection2.each(setValue(value, shouldUpdate));
25958   }
25959
25960   // modules/util/keybinding.js
25961   function utilKeybinding(namespace) {
25962     var _keybindings = {};
25963     function testBindings(d3_event, isCapturing) {
25964       var didMatch = false;
25965       var bindings = Object.keys(_keybindings).map(function(id2) {
25966         return _keybindings[id2];
25967       });
25968       var i3, binding;
25969       for (i3 = 0; i3 < bindings.length; i3++) {
25970         binding = bindings[i3];
25971         if (!binding.event.modifiers.shiftKey)
25972           continue;
25973         if (!!binding.capture !== isCapturing)
25974           continue;
25975         if (matches(d3_event, binding, true)) {
25976           binding.callback(d3_event);
25977           didMatch = true;
25978           break;
25979         }
25980       }
25981       if (didMatch)
25982         return;
25983       for (i3 = 0; i3 < bindings.length; i3++) {
25984         binding = bindings[i3];
25985         if (binding.event.modifiers.shiftKey)
25986           continue;
25987         if (!!binding.capture !== isCapturing)
25988           continue;
25989         if (matches(d3_event, binding, false)) {
25990           binding.callback(d3_event);
25991           break;
25992         }
25993       }
25994       function matches(d3_event2, binding2, testShift) {
25995         var event = d3_event2;
25996         var isMatch = false;
25997         var tryKeyCode = true;
25998         if (event.key !== void 0) {
25999           tryKeyCode = event.key.charCodeAt(0) > 127;
26000           isMatch = true;
26001           if (binding2.event.key === void 0) {
26002             isMatch = false;
26003           } else if (Array.isArray(binding2.event.key)) {
26004             if (binding2.event.key.map(function(s2) {
26005               return s2.toLowerCase();
26006             }).indexOf(event.key.toLowerCase()) === -1) {
26007               isMatch = false;
26008             }
26009           } else {
26010             if (event.key.toLowerCase() !== binding2.event.key.toLowerCase()) {
26011               isMatch = false;
26012             }
26013           }
26014         }
26015         if (!isMatch && (tryKeyCode || binding2.event.modifiers.altKey)) {
26016           isMatch = event.keyCode === binding2.event.keyCode;
26017         }
26018         if (!isMatch)
26019           return false;
26020         if (!(event.ctrlKey && event.altKey)) {
26021           if (event.ctrlKey !== binding2.event.modifiers.ctrlKey)
26022             return false;
26023           if (event.altKey !== binding2.event.modifiers.altKey)
26024             return false;
26025         }
26026         if (event.metaKey !== binding2.event.modifiers.metaKey)
26027           return false;
26028         if (testShift && event.shiftKey !== binding2.event.modifiers.shiftKey)
26029           return false;
26030         return true;
26031       }
26032     }
26033     function capture(d3_event) {
26034       testBindings(d3_event, true);
26035     }
26036     function bubble(d3_event) {
26037       var tagName = select_default2(d3_event.target).node().tagName;
26038       if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
26039         return;
26040       }
26041       testBindings(d3_event, false);
26042     }
26043     function keybinding(selection2) {
26044       selection2 = selection2 || select_default2(document);
26045       selection2.on("keydown.capture." + namespace, capture, true);
26046       selection2.on("keydown.bubble." + namespace, bubble, false);
26047       return keybinding;
26048     }
26049     keybinding.unbind = function(selection2) {
26050       _keybindings = [];
26051       selection2 = selection2 || select_default2(document);
26052       selection2.on("keydown.capture." + namespace, null);
26053       selection2.on("keydown.bubble." + namespace, null);
26054       return keybinding;
26055     };
26056     keybinding.clear = function() {
26057       _keybindings = {};
26058       return keybinding;
26059     };
26060     keybinding.off = function(codes, capture2) {
26061       var arr = utilArrayUniq([].concat(codes));
26062       for (var i3 = 0; i3 < arr.length; i3++) {
26063         var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
26064         delete _keybindings[id2];
26065       }
26066       return keybinding;
26067     };
26068     keybinding.on = function(codes, callback, capture2) {
26069       if (typeof callback !== "function") {
26070         return keybinding.off(codes, capture2);
26071       }
26072       var arr = utilArrayUniq([].concat(codes));
26073       for (var i3 = 0; i3 < arr.length; i3++) {
26074         var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
26075         var binding = {
26076           id: id2,
26077           capture: capture2,
26078           callback,
26079           event: {
26080             key: void 0,
26081             // preferred
26082             keyCode: 0,
26083             // fallback
26084             modifiers: {
26085               shiftKey: false,
26086               ctrlKey: false,
26087               altKey: false,
26088               metaKey: false
26089             }
26090           }
26091         };
26092         if (_keybindings[id2]) {
26093           console.warn('warning: duplicate keybinding for "' + id2 + '"');
26094         }
26095         _keybindings[id2] = binding;
26096         var matches = arr[i3].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g);
26097         for (var j3 = 0; j3 < matches.length; j3++) {
26098           if (matches[j3] === "++")
26099             matches[j3] = "+";
26100           if (matches[j3] in utilKeybinding.modifierCodes) {
26101             var prop = utilKeybinding.modifierProperties[utilKeybinding.modifierCodes[matches[j3]]];
26102             binding.event.modifiers[prop] = true;
26103           } else {
26104             binding.event.key = utilKeybinding.keys[matches[j3]] || matches[j3];
26105             if (matches[j3] in utilKeybinding.keyCodes) {
26106               binding.event.keyCode = utilKeybinding.keyCodes[matches[j3]];
26107             }
26108           }
26109         }
26110       }
26111       return keybinding;
26112     };
26113     return keybinding;
26114   }
26115   utilKeybinding.modifierCodes = {
26116     // Shift key, ⇧
26117     "\u21E7": 16,
26118     shift: 16,
26119     // CTRL key, on Mac: ⌃
26120     "\u2303": 17,
26121     ctrl: 17,
26122     // ALT key, on Mac: ⌥ (Alt)
26123     "\u2325": 18,
26124     alt: 18,
26125     option: 18,
26126     // META, on Mac: ⌘ (CMD), on Windows (Win), on Linux (Super)
26127     "\u2318": 91,
26128     meta: 91,
26129     cmd: 91,
26130     "super": 91,
26131     win: 91
26132   };
26133   utilKeybinding.modifierProperties = {
26134     16: "shiftKey",
26135     17: "ctrlKey",
26136     18: "altKey",
26137     91: "metaKey"
26138   };
26139   utilKeybinding.plusKeys = ["plus", "ffplus", "=", "ffequals", "\u2260", "\xB1"];
26140   utilKeybinding.minusKeys = ["_", "-", "ffminus", "dash", "\u2013", "\u2014"];
26141   utilKeybinding.keys = {
26142     // Backspace key, on Mac: ⌫ (Backspace)
26143     "\u232B": "Backspace",
26144     backspace: "Backspace",
26145     // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
26146     "\u21E5": "Tab",
26147     "\u21C6": "Tab",
26148     tab: "Tab",
26149     // Return key, ↩
26150     "\u21A9": "Enter",
26151     "\u21B5": "Enter",
26152     "\u23CE": "Enter",
26153     "return": "Enter",
26154     enter: "Enter",
26155     "\u2305": "Enter",
26156     // Pause/Break key
26157     "pause": "Pause",
26158     "pause-break": "Pause",
26159     // Caps Lock key, ⇪
26160     "\u21EA": "CapsLock",
26161     caps: "CapsLock",
26162     "caps-lock": "CapsLock",
26163     // Escape key, on Mac: ⎋, on Windows: Esc
26164     "\u238B": ["Escape", "Esc"],
26165     escape: ["Escape", "Esc"],
26166     esc: ["Escape", "Esc"],
26167     // Space key
26168     space: [" ", "Spacebar"],
26169     // Page-Up key, or pgup, on Mac: ↖
26170     "\u2196": "PageUp",
26171     pgup: "PageUp",
26172     "page-up": "PageUp",
26173     // Page-Down key, or pgdown, on Mac: ↘
26174     "\u2198": "PageDown",
26175     pgdown: "PageDown",
26176     "page-down": "PageDown",
26177     // END key, on Mac: ⇟
26178     "\u21DF": "End",
26179     end: "End",
26180     // HOME key, on Mac: ⇞
26181     "\u21DE": "Home",
26182     home: "Home",
26183     // Insert key, or ins
26184     ins: "Insert",
26185     insert: "Insert",
26186     // Delete key, on Mac: ⌦ (Delete)
26187     "\u2326": ["Delete", "Del"],
26188     del: ["Delete", "Del"],
26189     "delete": ["Delete", "Del"],
26190     // Left Arrow Key, or ←
26191     "\u2190": ["ArrowLeft", "Left"],
26192     left: ["ArrowLeft", "Left"],
26193     "arrow-left": ["ArrowLeft", "Left"],
26194     // Up Arrow Key, or ↑
26195     "\u2191": ["ArrowUp", "Up"],
26196     up: ["ArrowUp", "Up"],
26197     "arrow-up": ["ArrowUp", "Up"],
26198     // Right Arrow Key, or →
26199     "\u2192": ["ArrowRight", "Right"],
26200     right: ["ArrowRight", "Right"],
26201     "arrow-right": ["ArrowRight", "Right"],
26202     // Up Arrow Key, or ↓
26203     "\u2193": ["ArrowDown", "Down"],
26204     down: ["ArrowDown", "Down"],
26205     "arrow-down": ["ArrowDown", "Down"],
26206     // odities, stuff for backward compatibility (browsers and code):
26207     // Num-Multiply, or *
26208     "*": ["*", "Multiply"],
26209     star: ["*", "Multiply"],
26210     asterisk: ["*", "Multiply"],
26211     multiply: ["*", "Multiply"],
26212     // Num-Plus or +
26213     "+": ["+", "Add"],
26214     "plus": ["+", "Add"],
26215     // Num-Subtract, or -
26216     "-": ["-", "Subtract"],
26217     subtract: ["-", "Subtract"],
26218     "dash": ["-", "Subtract"],
26219     // Semicolon
26220     semicolon: ";",
26221     // = or equals
26222     equals: "=",
26223     // Comma, or ,
26224     comma: ",",
26225     // Period, or ., or full-stop
26226     period: ".",
26227     "full-stop": ".",
26228     // Slash, or /, or forward-slash
26229     slash: "/",
26230     "forward-slash": "/",
26231     // Tick, or `, or back-quote
26232     tick: "`",
26233     "back-quote": "`",
26234     // Open bracket, or [
26235     "open-bracket": "[",
26236     // Back slash, or \
26237     "back-slash": "\\",
26238     // Close backet, or ]
26239     "close-bracket": "]",
26240     // Apostrophe, or Quote, or '
26241     quote: "'",
26242     apostrophe: "'",
26243     // NUMPAD 0-9
26244     "num-0": "0",
26245     "num-1": "1",
26246     "num-2": "2",
26247     "num-3": "3",
26248     "num-4": "4",
26249     "num-5": "5",
26250     "num-6": "6",
26251     "num-7": "7",
26252     "num-8": "8",
26253     "num-9": "9",
26254     // F1-F25
26255     f1: "F1",
26256     f2: "F2",
26257     f3: "F3",
26258     f4: "F4",
26259     f5: "F5",
26260     f6: "F6",
26261     f7: "F7",
26262     f8: "F8",
26263     f9: "F9",
26264     f10: "F10",
26265     f11: "F11",
26266     f12: "F12",
26267     f13: "F13",
26268     f14: "F14",
26269     f15: "F15",
26270     f16: "F16",
26271     f17: "F17",
26272     f18: "F18",
26273     f19: "F19",
26274     f20: "F20",
26275     f21: "F21",
26276     f22: "F22",
26277     f23: "F23",
26278     f24: "F24",
26279     f25: "F25"
26280   };
26281   utilKeybinding.keyCodes = {
26282     // Backspace key, on Mac: ⌫ (Backspace)
26283     "\u232B": 8,
26284     backspace: 8,
26285     // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
26286     "\u21E5": 9,
26287     "\u21C6": 9,
26288     tab: 9,
26289     // Return key, ↩
26290     "\u21A9": 13,
26291     "\u21B5": 13,
26292     "\u23CE": 13,
26293     "return": 13,
26294     enter: 13,
26295     "\u2305": 13,
26296     // Pause/Break key
26297     "pause": 19,
26298     "pause-break": 19,
26299     // Caps Lock key, ⇪
26300     "\u21EA": 20,
26301     caps: 20,
26302     "caps-lock": 20,
26303     // Escape key, on Mac: ⎋, on Windows: Esc
26304     "\u238B": 27,
26305     escape: 27,
26306     esc: 27,
26307     // Space key
26308     space: 32,
26309     // Page-Up key, or pgup, on Mac: ↖
26310     "\u2196": 33,
26311     pgup: 33,
26312     "page-up": 33,
26313     // Page-Down key, or pgdown, on Mac: ↘
26314     "\u2198": 34,
26315     pgdown: 34,
26316     "page-down": 34,
26317     // END key, on Mac: ⇟
26318     "\u21DF": 35,
26319     end: 35,
26320     // HOME key, on Mac: ⇞
26321     "\u21DE": 36,
26322     home: 36,
26323     // Insert key, or ins
26324     ins: 45,
26325     insert: 45,
26326     // Delete key, on Mac: ⌦ (Delete)
26327     "\u2326": 46,
26328     del: 46,
26329     "delete": 46,
26330     // Left Arrow Key, or ←
26331     "\u2190": 37,
26332     left: 37,
26333     "arrow-left": 37,
26334     // Up Arrow Key, or ↑
26335     "\u2191": 38,
26336     up: 38,
26337     "arrow-up": 38,
26338     // Right Arrow Key, or →
26339     "\u2192": 39,
26340     right: 39,
26341     "arrow-right": 39,
26342     // Up Arrow Key, or ↓
26343     "\u2193": 40,
26344     down: 40,
26345     "arrow-down": 40,
26346     // odities, printing characters that come out wrong:
26347     // Firefox Equals
26348     "ffequals": 61,
26349     // Num-Multiply, or *
26350     "*": 106,
26351     star: 106,
26352     asterisk: 106,
26353     multiply: 106,
26354     // Num-Plus or +
26355     "+": 107,
26356     "plus": 107,
26357     // Num-Subtract, or -
26358     "-": 109,
26359     subtract: 109,
26360     // Vertical Bar / Pipe
26361     "|": 124,
26362     // Firefox Plus
26363     "ffplus": 171,
26364     // Firefox Minus
26365     "ffminus": 173,
26366     // Semicolon
26367     ";": 186,
26368     semicolon: 186,
26369     // = or equals
26370     "=": 187,
26371     "equals": 187,
26372     // Comma, or ,
26373     ",": 188,
26374     comma: 188,
26375     // Dash / Underscore key
26376     "dash": 189,
26377     // Period, or ., or full-stop
26378     ".": 190,
26379     period: 190,
26380     "full-stop": 190,
26381     // Slash, or /, or forward-slash
26382     "/": 191,
26383     slash: 191,
26384     "forward-slash": 191,
26385     // Tick, or `, or back-quote
26386     "`": 192,
26387     tick: 192,
26388     "back-quote": 192,
26389     // Open bracket, or [
26390     "[": 219,
26391     "open-bracket": 219,
26392     // Back slash, or \
26393     "\\": 220,
26394     "back-slash": 220,
26395     // Close backet, or ]
26396     "]": 221,
26397     "close-bracket": 221,
26398     // Apostrophe, or Quote, or '
26399     "'": 222,
26400     quote: 222,
26401     apostrophe: 222
26402   };
26403   var i = 95;
26404   var n = 0;
26405   while (++i < 106) {
26406     utilKeybinding.keyCodes["num-" + n] = i;
26407     ++n;
26408   }
26409   i = 47;
26410   n = 0;
26411   while (++i < 58) {
26412     utilKeybinding.keyCodes[n] = i;
26413     ++n;
26414   }
26415   i = 111;
26416   n = 1;
26417   while (++i < 136) {
26418     utilKeybinding.keyCodes["f" + n] = i;
26419     ++n;
26420   }
26421   i = 64;
26422   while (++i < 91) {
26423     utilKeybinding.keyCodes[String.fromCharCode(i).toLowerCase()] = i;
26424   }
26425
26426   // modules/util/object.js
26427   function utilObjectOmit(obj, omitKeys) {
26428     return Object.keys(obj).reduce(function(result, key) {
26429       if (omitKeys.indexOf(key) === -1) {
26430         result[key] = obj[key];
26431       }
26432       return result;
26433     }, {});
26434   }
26435
26436   // modules/util/rebind.js
26437   function utilRebind(target, source) {
26438     var i3 = 1, n3 = arguments.length, method;
26439     while (++i3 < n3) {
26440       target[method = arguments[i3]] = d3_rebind(target, source, source[method]);
26441     }
26442     return target;
26443   }
26444   function d3_rebind(target, source, method) {
26445     return function() {
26446       var value = method.apply(source, arguments);
26447       return value === source ? target : value;
26448     };
26449   }
26450
26451   // modules/util/session_mutex.js
26452   function utilSessionMutex(name) {
26453     var mutex = {};
26454     var intervalID;
26455     function renew() {
26456       var expires = /* @__PURE__ */ new Date();
26457       expires.setSeconds(expires.getSeconds() + 5);
26458       document.cookie = name + "=1; expires=" + expires.toUTCString() + "; sameSite=strict";
26459     }
26460     mutex.lock = function() {
26461       if (intervalID)
26462         return true;
26463       var cookie = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + name + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1");
26464       if (cookie)
26465         return false;
26466       renew();
26467       intervalID = window.setInterval(renew, 4e3);
26468       return true;
26469     };
26470     mutex.unlock = function() {
26471       if (!intervalID)
26472         return;
26473       document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; sameSite=strict";
26474       clearInterval(intervalID);
26475       intervalID = null;
26476     };
26477     mutex.locked = function() {
26478       return !!intervalID;
26479     };
26480     return mutex;
26481   }
26482
26483   // modules/util/tiler.js
26484   function utilTiler() {
26485     var _size = [256, 256];
26486     var _scale = 256;
26487     var _tileSize = 256;
26488     var _zoomExtent = [0, 20];
26489     var _translate = [_size[0] / 2, _size[1] / 2];
26490     var _margin = 0;
26491     var _skipNullIsland = false;
26492     function clamp3(num, min3, max3) {
26493       return Math.max(min3, Math.min(num, max3));
26494     }
26495     function nearNullIsland(tile) {
26496       var x2 = tile[0];
26497       var y2 = tile[1];
26498       var z2 = tile[2];
26499       if (z2 >= 7) {
26500         var center = Math.pow(2, z2 - 1);
26501         var width = Math.pow(2, z2 - 6);
26502         var min3 = center - width / 2;
26503         var max3 = center + width / 2 - 1;
26504         return x2 >= min3 && x2 <= max3 && y2 >= min3 && y2 <= max3;
26505       }
26506       return false;
26507     }
26508     function tiler9() {
26509       var z2 = geoScaleToZoom(_scale / (2 * Math.PI), _tileSize);
26510       var z0 = clamp3(Math.round(z2), _zoomExtent[0], _zoomExtent[1]);
26511       var tileMin = 0;
26512       var tileMax = Math.pow(2, z0) - 1;
26513       var log2ts = Math.log(_tileSize) * Math.LOG2E;
26514       var k2 = Math.pow(2, z2 - z0 + log2ts);
26515       var origin = [
26516         (_translate[0] - _scale / 2) / k2,
26517         (_translate[1] - _scale / 2) / k2
26518       ];
26519       var cols = range(
26520         clamp3(Math.floor(-origin[0]) - _margin, tileMin, tileMax + 1),
26521         clamp3(Math.ceil(_size[0] / k2 - origin[0]) + _margin, tileMin, tileMax + 1)
26522       );
26523       var rows = range(
26524         clamp3(Math.floor(-origin[1]) - _margin, tileMin, tileMax + 1),
26525         clamp3(Math.ceil(_size[1] / k2 - origin[1]) + _margin, tileMin, tileMax + 1)
26526       );
26527       var tiles = [];
26528       for (var i3 = 0; i3 < rows.length; i3++) {
26529         var y2 = rows[i3];
26530         for (var j3 = 0; j3 < cols.length; j3++) {
26531           var x2 = cols[j3];
26532           if (i3 >= _margin && i3 <= rows.length - _margin && j3 >= _margin && j3 <= cols.length - _margin) {
26533             tiles.unshift([x2, y2, z0]);
26534           } else {
26535             tiles.push([x2, y2, z0]);
26536           }
26537         }
26538       }
26539       tiles.translate = origin;
26540       tiles.scale = k2;
26541       return tiles;
26542     }
26543     tiler9.getTiles = function(projection2) {
26544       var origin = [
26545         projection2.scale() * Math.PI - projection2.translate()[0],
26546         projection2.scale() * Math.PI - projection2.translate()[1]
26547       ];
26548       this.size(projection2.clipExtent()[1]).scale(projection2.scale() * 2 * Math.PI).translate(projection2.translate());
26549       var tiles = tiler9();
26550       var ts = tiles.scale;
26551       return tiles.map(function(tile) {
26552         if (_skipNullIsland && nearNullIsland(tile)) {
26553           return false;
26554         }
26555         var x2 = tile[0] * ts - origin[0];
26556         var y2 = tile[1] * ts - origin[1];
26557         return {
26558           id: tile.toString(),
26559           xyz: tile,
26560           extent: geoExtent(
26561             projection2.invert([x2, y2 + ts]),
26562             projection2.invert([x2 + ts, y2])
26563           )
26564         };
26565       }).filter(Boolean);
26566     };
26567     tiler9.getGeoJSON = function(projection2) {
26568       var features = tiler9.getTiles(projection2).map(function(tile) {
26569         return {
26570           type: "Feature",
26571           properties: {
26572             id: tile.id,
26573             name: tile.id
26574           },
26575           geometry: {
26576             type: "Polygon",
26577             coordinates: [tile.extent.polygon()]
26578           }
26579         };
26580       });
26581       return {
26582         type: "FeatureCollection",
26583         features
26584       };
26585     };
26586     tiler9.tileSize = function(val) {
26587       if (!arguments.length)
26588         return _tileSize;
26589       _tileSize = val;
26590       return tiler9;
26591     };
26592     tiler9.zoomExtent = function(val) {
26593       if (!arguments.length)
26594         return _zoomExtent;
26595       _zoomExtent = val;
26596       return tiler9;
26597     };
26598     tiler9.size = function(val) {
26599       if (!arguments.length)
26600         return _size;
26601       _size = val;
26602       return tiler9;
26603     };
26604     tiler9.scale = function(val) {
26605       if (!arguments.length)
26606         return _scale;
26607       _scale = val;
26608       return tiler9;
26609     };
26610     tiler9.translate = function(val) {
26611       if (!arguments.length)
26612         return _translate;
26613       _translate = val;
26614       return tiler9;
26615     };
26616     tiler9.margin = function(val) {
26617       if (!arguments.length)
26618         return _margin;
26619       _margin = +val;
26620       return tiler9;
26621     };
26622     tiler9.skipNullIsland = function(val) {
26623       if (!arguments.length)
26624         return _skipNullIsland;
26625       _skipNullIsland = val;
26626       return tiler9;
26627     };
26628     return tiler9;
26629   }
26630
26631   // modules/util/trigger_event.js
26632   function utilTriggerEvent(target, type2, eventProperties) {
26633     target.each(function() {
26634       var evt = document.createEvent("HTMLEvents");
26635       evt.initEvent(type2, true, true);
26636       for (var prop in eventProperties) {
26637         evt[prop] = eventProperties[prop];
26638       }
26639       this.dispatchEvent(evt);
26640     });
26641   }
26642
26643   // modules/core/localizer.js
26644   var _mainLocalizer = coreLocalizer();
26645   var _t = _mainLocalizer.t;
26646   function coreLocalizer() {
26647     let localizer = {};
26648     let _dataLanguages = {};
26649     let _dataLocales = {};
26650     let _localeStrings = {};
26651     let _localeCode = "en-US";
26652     let _localeCodes = ["en-US", "en"];
26653     let _languageCode = "en";
26654     let _textDirection = "ltr";
26655     let _usesMetric = false;
26656     let _languageNames = {};
26657     let _scriptNames = {};
26658     localizer.localeCode = () => _localeCode;
26659     localizer.localeCodes = () => _localeCodes;
26660     localizer.languageCode = () => _languageCode;
26661     localizer.textDirection = () => _textDirection;
26662     localizer.usesMetric = () => _usesMetric;
26663     localizer.languageNames = () => _languageNames;
26664     localizer.scriptNames = () => _scriptNames;
26665     let _preferredLocaleCodes = [];
26666     localizer.preferredLocaleCodes = function(codes) {
26667       if (!arguments.length)
26668         return _preferredLocaleCodes;
26669       if (typeof codes === "string") {
26670         _preferredLocaleCodes = codes.split(/,|;| /gi).filter(Boolean);
26671       } else {
26672         _preferredLocaleCodes = codes;
26673       }
26674       return localizer;
26675     };
26676     var _loadPromise;
26677     localizer.ensureLoaded = () => {
26678       if (_loadPromise)
26679         return _loadPromise;
26680       let filesToFetch = [
26681         "languages",
26682         // load the list of languages
26683         "locales"
26684         // load the list of supported locales
26685       ];
26686       const localeDirs = {
26687         general: "locales",
26688         tagging: presetsCdnUrl + "dist/translations"
26689       };
26690       let fileMap = _mainFileFetcher.fileMap();
26691       for (let scopeId in localeDirs) {
26692         const key = "locales_index_".concat(scopeId);
26693         if (!fileMap[key]) {
26694           fileMap[key] = localeDirs[scopeId] + "/index.min.json";
26695         }
26696         filesToFetch.push(key);
26697       }
26698       return _loadPromise = Promise.all(filesToFetch.map((key) => _mainFileFetcher.get(key))).then((results) => {
26699         _dataLanguages = results[0];
26700         _dataLocales = results[1];
26701         let indexes = results.slice(2);
26702         let requestedLocales = (_preferredLocaleCodes || []).concat(utilDetect().browserLocales).concat(["en"]);
26703         _localeCodes = localesToUseFrom(requestedLocales);
26704         _localeCode = _localeCodes[0];
26705         let loadStringsPromises = [];
26706         indexes.forEach((index, i3) => {
26707           const fullCoverageIndex = _localeCodes.findIndex(function(locale2) {
26708             return index[locale2] && index[locale2].pct === 1;
26709           });
26710           _localeCodes.slice(0, fullCoverageIndex + 1).forEach(function(code) {
26711             let scopeId = Object.keys(localeDirs)[i3];
26712             let directory = Object.values(localeDirs)[i3];
26713             if (index[code])
26714               loadStringsPromises.push(localizer.loadLocale(code, scopeId, directory));
26715           });
26716         });
26717         return Promise.all(loadStringsPromises);
26718       }).then(() => {
26719         updateForCurrentLocale();
26720       }).catch((err) => console.error(err));
26721     };
26722     function localesToUseFrom(requestedLocales) {
26723       let supportedLocales = _dataLocales;
26724       let toUse = [];
26725       for (let i3 in requestedLocales) {
26726         let locale2 = requestedLocales[i3];
26727         if (supportedLocales[locale2])
26728           toUse.push(locale2);
26729         if (locale2.includes("-")) {
26730           let langPart = locale2.split("-")[0];
26731           if (supportedLocales[langPart])
26732             toUse.push(langPart);
26733         }
26734       }
26735       return utilArrayUniq(toUse);
26736     }
26737     function updateForCurrentLocale() {
26738       if (!_localeCode)
26739         return;
26740       _languageCode = _localeCode.split("-")[0];
26741       const currentData = _dataLocales[_localeCode] || _dataLocales[_languageCode];
26742       const hash = utilStringQs(window.location.hash);
26743       if (hash.rtl === "true") {
26744         _textDirection = "rtl";
26745       } else if (hash.rtl === "false") {
26746         _textDirection = "ltr";
26747       } else {
26748         _textDirection = currentData && currentData.rtl ? "rtl" : "ltr";
26749       }
26750       let locale2 = _localeCode;
26751       if (locale2.toLowerCase() === "en-us")
26752         locale2 = "en";
26753       _languageNames = _localeStrings.general[locale2].languageNames || _localeStrings.general[_languageCode].languageNames;
26754       _scriptNames = _localeStrings.general[locale2].scriptNames || _localeStrings.general[_languageCode].scriptNames;
26755       _usesMetric = _localeCode.slice(-3).toLowerCase() !== "-us";
26756     }
26757     localizer.loadLocale = (locale2, scopeId, directory) => {
26758       if (locale2.toLowerCase() === "en-us")
26759         locale2 = "en";
26760       if (_localeStrings[scopeId] && _localeStrings[scopeId][locale2]) {
26761         return Promise.resolve(locale2);
26762       }
26763       let fileMap = _mainFileFetcher.fileMap();
26764       const key = "locale_".concat(scopeId, "_").concat(locale2);
26765       if (!fileMap[key]) {
26766         fileMap[key] = "".concat(directory, "/").concat(locale2, ".min.json");
26767       }
26768       return _mainFileFetcher.get(key).then((d2) => {
26769         if (!_localeStrings[scopeId])
26770           _localeStrings[scopeId] = {};
26771         _localeStrings[scopeId][locale2] = d2[locale2];
26772         return locale2;
26773       });
26774     };
26775     localizer.pluralRule = function(number3) {
26776       return pluralRule(number3, _localeCode);
26777     };
26778     function pluralRule(number3, localeCode) {
26779       const rules = "Intl" in window && Intl.PluralRules && new Intl.PluralRules(localeCode);
26780       if (rules) {
26781         return rules.select(number3);
26782       }
26783       if (number3 === 1)
26784         return "one";
26785       return "other";
26786     }
26787     localizer.tInfo = function(origStringId, replacements, locale2) {
26788       let stringId = origStringId.trim();
26789       let scopeId = "general";
26790       if (stringId[0] === "_") {
26791         let split = stringId.split(".");
26792         scopeId = split[0].slice(1);
26793         stringId = split.slice(1).join(".");
26794       }
26795       locale2 = locale2 || _localeCode;
26796       let path = stringId.split(".").map((s2) => s2.replace(/<TX_DOT>/g, ".")).reverse();
26797       let stringsKey = locale2;
26798       if (stringsKey.toLowerCase() === "en-us")
26799         stringsKey = "en";
26800       let result = _localeStrings && _localeStrings[scopeId] && _localeStrings[scopeId][stringsKey];
26801       while (result !== void 0 && path.length) {
26802         result = result[path.pop()];
26803       }
26804       if (result !== void 0) {
26805         if (replacements) {
26806           if (typeof result === "object" && Object.keys(result).length) {
26807             const number3 = Object.values(replacements).find(function(value) {
26808               return typeof value === "number";
26809             });
26810             if (number3 !== void 0) {
26811               const rule = pluralRule(number3, locale2);
26812               if (result[rule]) {
26813                 result = result[rule];
26814               } else {
26815                 result = Object.values(result)[0];
26816               }
26817             }
26818           }
26819           if (typeof result === "string") {
26820             for (let key in replacements) {
26821               let value = replacements[key];
26822               if (typeof value === "number") {
26823                 if (value.toLocaleString) {
26824                   value = value.toLocaleString(locale2, {
26825                     style: "decimal",
26826                     useGrouping: true,
26827                     minimumFractionDigits: 0
26828                   });
26829                 } else {
26830                   value = value.toString();
26831                 }
26832               }
26833               const token = "{".concat(key, "}");
26834               const regex = new RegExp(token, "g");
26835               result = result.replace(regex, value);
26836             }
26837           }
26838         }
26839         if (typeof result === "string") {
26840           return {
26841             text: result,
26842             locale: locale2
26843           };
26844         }
26845       }
26846       let index = _localeCodes.indexOf(locale2);
26847       if (index >= 0 && index < _localeCodes.length - 1) {
26848         let fallback = _localeCodes[index + 1];
26849         return localizer.tInfo(origStringId, replacements, fallback);
26850       }
26851       if (replacements && "default" in replacements) {
26852         return {
26853           text: replacements.default,
26854           locale: null
26855         };
26856       }
26857       const missing = "Missing ".concat(locale2, " translation: ").concat(origStringId);
26858       if (typeof console !== "undefined")
26859         console.error(missing);
26860       return {
26861         text: missing,
26862         locale: "en"
26863       };
26864     };
26865     localizer.hasTextForStringId = function(stringId) {
26866       return !!localizer.tInfo(stringId, { default: "nothing found" }).locale;
26867     };
26868     localizer.t = function(stringId, replacements, locale2) {
26869       return localizer.tInfo(stringId, replacements, locale2).text;
26870     };
26871     localizer.t.html = function(stringId, replacements, locale2) {
26872       replacements = Object.assign({}, replacements);
26873       for (var k2 in replacements) {
26874         if (typeof replacements[k2] === "string") {
26875           replacements[k2] = escape_default(replacements[k2]);
26876         }
26877         if (typeof replacements[k2] === "object" && typeof replacements[k2].html === "string") {
26878           replacements[k2] = replacements[k2].html;
26879         }
26880       }
26881       const info = localizer.tInfo(stringId, replacements, locale2);
26882       if (info.text) {
26883         return '<span class="localized-text" lang="'.concat(info.locale || "und", '">').concat(info.text, "</span>");
26884       } else {
26885         return "";
26886       }
26887     };
26888     localizer.t.append = function(stringId, replacements, locale2) {
26889       const ret = function(selection2) {
26890         const info = localizer.tInfo(stringId, replacements, locale2);
26891         return selection2.append("span").attr("class", "localized-text").attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
26892       };
26893       ret.stringId = stringId;
26894       return ret;
26895     };
26896     localizer.languageName = (code, options2) => {
26897       if (_languageNames && _languageNames[code]) {
26898         return _languageNames[code];
26899       }
26900       if (options2 && options2.localOnly)
26901         return null;
26902       const langInfo = _dataLanguages[code];
26903       if (langInfo) {
26904         if (langInfo.nativeName) {
26905           return localizer.t("translate.language_and_code", { language: langInfo.nativeName, code });
26906         } else if (langInfo.base && langInfo.script) {
26907           const base = langInfo.base;
26908           if (_languageNames && _languageNames[base]) {
26909             const scriptCode = langInfo.script;
26910             const script = _scriptNames && _scriptNames[scriptCode] || scriptCode;
26911             return localizer.t("translate.language_and_code", { language: _languageNames[base], code: script });
26912           } else if (_dataLanguages[base] && _dataLanguages[base].nativeName) {
26913             return localizer.t("translate.language_and_code", { language: _dataLanguages[base].nativeName, code });
26914           }
26915         }
26916       }
26917       return code;
26918     };
26919     localizer.floatFormatter = (locale2) => {
26920       if (!("Intl" in window && "NumberFormat" in Intl && "formatToParts" in Intl.NumberFormat.prototype)) {
26921         return (number3, fractionDigits) => {
26922           return fractionDigits === void 0 ? number3.toString() : number3.toFixed(fractionDigits);
26923         };
26924       } else {
26925         return (number3, fractionDigits) => number3.toLocaleString(locale2, {
26926           minimumFractionDigits: fractionDigits,
26927           maximumFractionDigits: fractionDigits === void 0 ? 20 : fractionDigits
26928         });
26929       }
26930     };
26931     localizer.floatParser = (locale2) => {
26932       const polyfill = (string) => +string.trim();
26933       if (!("Intl" in window && "NumberFormat" in Intl))
26934         return polyfill;
26935       const format2 = new Intl.NumberFormat(locale2, { maximumFractionDigits: 20 });
26936       if (!("formatToParts" in format2))
26937         return polyfill;
26938       const parts = format2.formatToParts(-12345.6);
26939       const numerals = Array.from({ length: 10 }).map((_2, i3) => format2.format(i3));
26940       const index = new Map(numerals.map((d2, i3) => [d2, i3]));
26941       const literalPart = parts.find((d2) => d2.type === "literal");
26942       const literal = literalPart && new RegExp("[".concat(literalPart.value, "]"), "g");
26943       const groupPart = parts.find((d2) => d2.type === "group");
26944       const group = groupPart && new RegExp("[".concat(groupPart.value, "]"), "g");
26945       const decimalPart = parts.find((d2) => d2.type === "decimal");
26946       const decimal = decimalPart && new RegExp("[".concat(decimalPart.value, "]"));
26947       const numeral = new RegExp("[".concat(numerals.join(""), "]"), "g");
26948       const getIndex = (d2) => index.get(d2);
26949       return (string) => {
26950         string = string.trim();
26951         if (literal)
26952           string = string.replace(literal, "");
26953         if (group)
26954           string = string.replace(group, "");
26955         if (decimal)
26956           string = string.replace(decimal, ".");
26957         string = string.replace(numeral, getIndex);
26958         return string ? +string : NaN;
26959       };
26960     };
26961     localizer.decimalPlaceCounter = (locale2) => {
26962       var literal, group, decimal;
26963       if ("Intl" in window && "NumberFormat" in Intl) {
26964         const format2 = new Intl.NumberFormat(locale2, { maximumFractionDigits: 20 });
26965         if ("formatToParts" in format2) {
26966           const parts = format2.formatToParts(-12345.6);
26967           const literalPart = parts.find((d2) => d2.type === "literal");
26968           literal = literalPart && new RegExp("[".concat(literalPart.value, "]"), "g");
26969           const groupPart = parts.find((d2) => d2.type === "group");
26970           group = groupPart && new RegExp("[".concat(groupPart.value, "]"), "g");
26971           const decimalPart = parts.find((d2) => d2.type === "decimal");
26972           decimal = decimalPart && new RegExp("[".concat(decimalPart.value, "]"));
26973         }
26974       }
26975       return (string) => {
26976         string = string.trim();
26977         if (literal)
26978           string = string.replace(literal, "");
26979         if (group)
26980           string = string.replace(group, "");
26981         const parts = string.split(decimal || ".");
26982         return parts && parts[1] && parts[1].length || 0;
26983       };
26984     };
26985     return localizer;
26986   }
26987
26988   // modules/presets/collection.js
26989   function presetCollection(collection) {
26990     const MAXRESULTS = 50;
26991     let _this = {};
26992     let _memo = {};
26993     _this.collection = collection;
26994     _this.item = (id2) => {
26995       if (_memo[id2])
26996         return _memo[id2];
26997       const found = _this.collection.find((d2) => d2.id === id2);
26998       if (found)
26999         _memo[id2] = found;
27000       return found;
27001     };
27002     _this.index = (id2) => _this.collection.findIndex((d2) => d2.id === id2);
27003     _this.matchGeometry = (geometry) => {
27004       return presetCollection(
27005         _this.collection.filter((d2) => d2.matchGeometry(geometry))
27006       );
27007     };
27008     _this.matchAllGeometry = (geometries) => {
27009       return presetCollection(
27010         _this.collection.filter((d2) => d2 && d2.matchAllGeometry(geometries))
27011       );
27012     };
27013     _this.matchAnyGeometry = (geometries) => {
27014       return presetCollection(
27015         _this.collection.filter((d2) => geometries.some((geom) => d2.matchGeometry(geom)))
27016       );
27017     };
27018     _this.fallback = (geometry) => {
27019       let id2 = geometry;
27020       if (id2 === "vertex")
27021         id2 = "point";
27022       return _this.item(id2);
27023     };
27024     _this.search = (value, geometry, loc) => {
27025       if (!value)
27026         return _this;
27027       value = value.toLowerCase().trim();
27028       function leading(a2) {
27029         const index = a2.indexOf(value);
27030         return index === 0 || a2[index - 1] === " ";
27031       }
27032       function leadingStrict(a2) {
27033         const index = a2.indexOf(value);
27034         return index === 0;
27035       }
27036       function sortPresets(nameProp, aliasesProp) {
27037         return function sortNames(a2, b2) {
27038           let aCompare = a2[nameProp]();
27039           let bCompare = b2[nameProp]();
27040           if (aliasesProp) {
27041             const findMatchingAlias = (strings) => {
27042               if (strings.some((s2) => s2 === value)) {
27043                 return strings.find((s2) => s2 === value);
27044               } else {
27045                 return strings.filter((s2) => s2.includes(value)).sort((a3, b3) => a3.length - b3.length)[0];
27046               }
27047             };
27048             aCompare = findMatchingAlias([aCompare].concat(a2[aliasesProp]()));
27049             bCompare = findMatchingAlias([bCompare].concat(b2[aliasesProp]()));
27050           }
27051           if (value === aCompare)
27052             return -1;
27053           if (value === bCompare)
27054             return 1;
27055           let i3 = b2.originalScore - a2.originalScore;
27056           if (i3 !== 0)
27057             return i3;
27058           i3 = aCompare.indexOf(value) - bCompare.indexOf(value);
27059           if (i3 !== 0)
27060             return i3;
27061           return aCompare.length - bCompare.length;
27062         };
27063       }
27064       let pool = _this.collection;
27065       if (Array.isArray(loc)) {
27066         const validHere = _sharedLocationManager.locationSetsAt(loc);
27067         pool = pool.filter((a2) => !a2.locationSetID || validHere[a2.locationSetID]);
27068       }
27069       const searchable = pool.filter((a2) => a2.searchable !== false && a2.suggestion !== true);
27070       const suggestions = pool.filter((a2) => a2.suggestion === true);
27071       const leadingNames = searchable.filter((a2) => leading(a2.searchName()) || a2.searchAliases().some(leading)).sort(sortPresets("searchName", "searchAliases"));
27072       const leadingSuggestions = suggestions.filter((a2) => leadingStrict(a2.searchName())).sort(sortPresets("searchName"));
27073       const leadingNamesStripped = searchable.filter((a2) => leading(a2.searchNameStripped()) || a2.searchAliasesStripped().some(leading)).sort(sortPresets("searchNameStripped", "searchAliasesStripped"));
27074       const leadingSuggestionsStripped = suggestions.filter((a2) => leadingStrict(a2.searchNameStripped())).sort(sortPresets("searchNameStripped"));
27075       const leadingTerms = searchable.filter((a2) => (a2.terms() || []).some(leading));
27076       const leadingSuggestionTerms = suggestions.filter((a2) => (a2.terms() || []).some(leading));
27077       const leadingTagValues = searchable.filter((a2) => Object.values(a2.tags || {}).filter((val) => val !== "*").some(leading));
27078       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);
27079       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);
27080       const similarTerms = searchable.filter((a2) => {
27081         return (a2.terms() || []).some((b2) => {
27082           return utilEditDistance(value, b2) + Math.min(value.length - b2.length, 0) < 3;
27083         });
27084       });
27085       let leadingTagKeyValues = [];
27086       if (value.includes("=")) {
27087         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]))));
27088       }
27089       let results = leadingNames.concat(
27090         leadingSuggestions,
27091         leadingNamesStripped,
27092         leadingSuggestionsStripped,
27093         leadingTerms,
27094         leadingSuggestionTerms,
27095         leadingTagValues,
27096         similarName,
27097         similarSuggestions,
27098         similarTerms,
27099         leadingTagKeyValues
27100       ).slice(0, MAXRESULTS - 1);
27101       if (geometry) {
27102         if (typeof geometry === "string") {
27103           results.push(_this.fallback(geometry));
27104         } else {
27105           geometry.forEach((geom) => results.push(_this.fallback(geom)));
27106         }
27107       }
27108       return presetCollection(utilArrayUniq(results));
27109     };
27110     return _this;
27111   }
27112
27113   // modules/presets/category.js
27114   function presetCategory(categoryID, category, allPresets) {
27115     let _this = Object.assign({}, category);
27116     let _searchName;
27117     let _searchNameStripped;
27118     _this.id = categoryID;
27119     _this.members = presetCollection(
27120       (category.members || []).map((presetID) => allPresets[presetID]).filter(Boolean)
27121     );
27122     _this.geometry = _this.members.collection.reduce((acc, preset) => {
27123       for (let i3 in preset.geometry) {
27124         const geometry = preset.geometry[i3];
27125         if (acc.indexOf(geometry) === -1) {
27126           acc.push(geometry);
27127         }
27128       }
27129       return acc;
27130     }, []);
27131     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
27132     _this.matchAllGeometry = (geometries) => _this.members.collection.some((preset) => preset.matchAllGeometry(geometries));
27133     _this.matchScore = () => -1;
27134     _this.name = () => _t("_tagging.presets.categories.".concat(categoryID, ".name"), { "default": categoryID });
27135     _this.nameLabel = () => _t.append("_tagging.presets.categories.".concat(categoryID, ".name"), { "default": categoryID });
27136     _this.terms = () => [];
27137     _this.searchName = () => {
27138       if (!_searchName) {
27139         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
27140       }
27141       return _searchName;
27142     };
27143     _this.searchNameStripped = () => {
27144       if (!_searchNameStripped) {
27145         _searchNameStripped = _this.searchName();
27146         if (_searchNameStripped.normalize)
27147           _searchNameStripped = _searchNameStripped.normalize("NFD");
27148         _searchNameStripped = _searchNameStripped.replace(/[\u0300-\u036f]/g, "");
27149       }
27150       return _searchNameStripped;
27151     };
27152     _this.searchAliases = () => [];
27153     _this.searchAliasesStripped = () => [];
27154     return _this;
27155   }
27156
27157   // modules/presets/field.js
27158   function presetField(fieldID, field, allFields) {
27159     allFields = allFields || {};
27160     let _this = Object.assign({}, field);
27161     _this.id = fieldID;
27162     _this.safeid = utilSafeClassName(fieldID);
27163     _this.matchGeometry = (geom) => !_this.geometry || _this.geometry.indexOf(geom) !== -1;
27164     _this.matchAllGeometry = (geometries) => {
27165       return !_this.geometry || geometries.every((geom) => _this.geometry.indexOf(geom) !== -1);
27166     };
27167     _this.t = (scope, options2) => _t("_tagging.presets.fields.".concat(fieldID, ".").concat(scope), options2);
27168     _this.t.html = (scope, options2) => _t.html("_tagging.presets.fields.".concat(fieldID, ".").concat(scope), options2);
27169     _this.t.append = (scope, options2) => _t.append("_tagging.presets.fields.".concat(fieldID, ".").concat(scope), options2);
27170     _this.hasTextForStringId = (scope) => _mainLocalizer.hasTextForStringId("_tagging.presets.fields.".concat(fieldID, ".").concat(scope));
27171     _this.resolveReference = (which) => {
27172       const referenceRegex = /^\{(.*)\}$/;
27173       const match = (field[which] || "").match(referenceRegex);
27174       if (match) {
27175         const field2 = allFields[match[1]];
27176         if (field2) {
27177           return field2;
27178         }
27179         console.error("Unable to resolve referenced field: ".concat(match[1]));
27180       }
27181       return _this;
27182     };
27183     _this.title = () => _this.overrideLabel || _this.resolveReference("label").t("label", { "default": fieldID });
27184     _this.label = () => _this.overrideLabel ? (selection2) => selection2.text(_this.overrideLabel) : _this.resolveReference("label").t.append("label", { "default": fieldID });
27185     _this.placeholder = () => _this.resolveReference("placeholder").t("placeholder", { "default": "" });
27186     _this.originalTerms = (_this.terms || []).join();
27187     _this.terms = () => _this.resolveReference("label").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
27188     _this.increment = _this.type === "number" ? _this.increment || 1 : void 0;
27189     return _this;
27190   }
27191
27192   // modules/presets/preset.js
27193   var import_lodash = __toESM(require_lodash());
27194   function presetPreset(presetID, preset, addable, allFields, allPresets) {
27195     allFields = allFields || {};
27196     allPresets = allPresets || {};
27197     let _this = Object.assign({}, preset);
27198     let _addable = addable || false;
27199     let _searchName;
27200     let _searchNameStripped;
27201     let _searchAliases;
27202     let _searchAliasesStripped;
27203     const referenceRegex = /^\{(.*)\}$/;
27204     _this.id = presetID;
27205     _this.safeid = utilSafeClassName(presetID);
27206     _this.originalTerms = (_this.terms || []).join();
27207     _this.originalName = _this.name || "";
27208     _this.originalAliases = (_this.aliases || []).join("\n");
27209     _this.originalScore = _this.matchScore || 1;
27210     _this.originalReference = _this.reference || {};
27211     _this.originalFields = _this.fields || [];
27212     _this.originalMoreFields = _this.moreFields || [];
27213     _this.fields = (loc) => resolveFields("fields", loc);
27214     _this.moreFields = (loc) => resolveFields("moreFields", loc);
27215     _this.tags = _this.tags || {};
27216     _this.addTags = _this.addTags || _this.tags;
27217     _this.removeTags = _this.removeTags || _this.addTags;
27218     _this.geometry = _this.geometry || [];
27219     _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
27220     _this.matchAllGeometry = (geoms) => geoms.every(_this.matchGeometry);
27221     _this.matchScore = (entityTags) => {
27222       const tags = _this.tags;
27223       let seen = {};
27224       let score = 0;
27225       for (let k2 in tags) {
27226         seen[k2] = true;
27227         if (entityTags[k2] === tags[k2]) {
27228           score += _this.originalScore;
27229         } else if (tags[k2] === "*" && k2 in entityTags) {
27230           score += _this.originalScore / 2;
27231         } else {
27232           return -1;
27233         }
27234       }
27235       const addTags = _this.addTags;
27236       for (let k2 in addTags) {
27237         if (!seen[k2] && entityTags[k2] === addTags[k2]) {
27238           score += _this.originalScore;
27239         }
27240       }
27241       if (_this.searchable === false) {
27242         score *= 0.999;
27243       }
27244       return score;
27245     };
27246     _this.t = (scope, options2) => {
27247       const textID = "_tagging.presets.presets.".concat(presetID, ".").concat(scope);
27248       return _t(textID, options2);
27249     };
27250     _this.t.append = (scope, options2) => {
27251       const textID = "_tagging.presets.presets.".concat(presetID, ".").concat(scope);
27252       return _t.append(textID, options2);
27253     };
27254     function resolveReference(which) {
27255       const match = (_this[which] || "").match(referenceRegex);
27256       if (match) {
27257         const preset2 = allPresets[match[1]];
27258         if (preset2) {
27259           return preset2;
27260         }
27261         console.error("Unable to resolve referenced preset: ".concat(match[1]));
27262       }
27263       return _this;
27264     }
27265     _this.name = () => {
27266       return resolveReference("originalName").t("name", { "default": _this.originalName || presetID });
27267     };
27268     _this.nameLabel = () => {
27269       return resolveReference("originalName").t.append("name", { "default": _this.originalName || presetID });
27270     };
27271     _this.subtitle = () => {
27272       if (_this.suggestion) {
27273         let path = presetID.split("/");
27274         path.pop();
27275         return _t("_tagging.presets.presets." + path.join("/") + ".name");
27276       }
27277       return null;
27278     };
27279     _this.subtitleLabel = () => {
27280       if (_this.suggestion) {
27281         let path = presetID.split("/");
27282         path.pop();
27283         return _t.append("_tagging.presets.presets." + path.join("/") + ".name");
27284       }
27285       return null;
27286     };
27287     _this.aliases = () => {
27288       return resolveReference("originalName").t("aliases", { "default": _this.originalAliases }).trim().split(/\s*[\r\n]+\s*/);
27289     };
27290     _this.terms = () => {
27291       return resolveReference("originalName").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
27292     };
27293     _this.searchName = () => {
27294       if (!_searchName) {
27295         _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
27296       }
27297       return _searchName;
27298     };
27299     _this.searchNameStripped = () => {
27300       if (!_searchNameStripped) {
27301         _searchNameStripped = stripDiacritics(_this.searchName());
27302       }
27303       return _searchNameStripped;
27304     };
27305     _this.searchAliases = () => {
27306       if (!_searchAliases) {
27307         _searchAliases = _this.aliases().map((alias) => alias.toLowerCase());
27308       }
27309       return _searchAliases;
27310     };
27311     _this.searchAliasesStripped = () => {
27312       if (!_searchAliasesStripped) {
27313         _searchAliasesStripped = _this.searchAliases();
27314         _searchAliasesStripped = _searchAliasesStripped.map(stripDiacritics);
27315       }
27316       return _searchAliasesStripped;
27317     };
27318     _this.isFallback = () => {
27319       const tagCount = Object.keys(_this.tags).length;
27320       return tagCount === 0 || tagCount === 1 && _this.tags.hasOwnProperty("area");
27321     };
27322     _this.addable = function(val) {
27323       if (!arguments.length)
27324         return _addable;
27325       _addable = val;
27326       return _this;
27327     };
27328     _this.reference = () => {
27329       const qid = _this.tags.wikidata || _this.tags["flag:wikidata"] || _this.tags["brand:wikidata"] || _this.tags["network:wikidata"] || _this.tags["operator:wikidata"];
27330       if (qid) {
27331         return { qid };
27332       }
27333       let key = _this.originalReference.key || Object.keys(utilObjectOmit(_this.tags, "name"))[0];
27334       let value = _this.originalReference.value || _this.tags[key];
27335       if (value === "*") {
27336         return { key };
27337       } else {
27338         return { key, value };
27339       }
27340     };
27341     _this.unsetTags = (tags, geometry, ignoringKeys, skipFieldDefaults, loc) => {
27342       let removeTags = ignoringKeys ? utilObjectOmit(_this.removeTags, ignoringKeys) : _this.removeTags;
27343       tags = utilObjectOmit(tags, Object.keys(removeTags));
27344       if (geometry && !skipFieldDefaults) {
27345         _this.fields(loc).forEach((field) => {
27346           if (field.matchGeometry(geometry) && field.key && field.default === tags[field.key] && (!ignoringKeys || ignoringKeys.indexOf(field.key) === -1)) {
27347             delete tags[field.key];
27348           }
27349         });
27350       }
27351       delete tags.area;
27352       return tags;
27353     };
27354     _this.setTags = (tags, geometry, skipFieldDefaults, loc) => {
27355       const addTags = _this.addTags;
27356       tags = Object.assign({}, tags);
27357       for (let k2 in addTags) {
27358         if (addTags[k2] === "*") {
27359           if (_this.tags[k2] || !tags[k2]) {
27360             tags[k2] = "yes";
27361           }
27362         } else {
27363           tags[k2] = addTags[k2];
27364         }
27365       }
27366       if (!addTags.hasOwnProperty("area")) {
27367         delete tags.area;
27368         if (geometry === "area") {
27369           let needsAreaTag = true;
27370           for (let k2 in addTags) {
27371             if (_this.geometry.indexOf("line") === -1 && k2 in osmAreaKeys || k2 in osmAreaKeysExceptions && addTags[k2] in osmAreaKeysExceptions[k2]) {
27372               needsAreaTag = false;
27373               break;
27374             }
27375           }
27376           if (needsAreaTag) {
27377             tags.area = "yes";
27378           }
27379         }
27380       }
27381       if (geometry && !skipFieldDefaults) {
27382         _this.fields(loc).forEach((field) => {
27383           if (field.matchGeometry(geometry) && field.key && !tags[field.key] && field.default) {
27384             tags[field.key] = field.default;
27385           }
27386         });
27387       }
27388       return tags;
27389     };
27390     function resolveFields(which, loc) {
27391       const fieldIDs = which === "fields" ? _this.originalFields : _this.originalMoreFields;
27392       let resolved = [];
27393       fieldIDs.forEach((fieldID) => {
27394         const match = fieldID.match(referenceRegex);
27395         if (match !== null) {
27396           resolved = resolved.concat(inheritFields(allPresets[match[1]], which));
27397         } else if (allFields[fieldID]) {
27398           resolved.push(allFields[fieldID]);
27399         } else {
27400           console.log('Cannot resolve "'.concat(fieldID, '" found in ').concat(_this.id, ".").concat(which));
27401         }
27402       });
27403       if (!resolved.length) {
27404         const endIndex = _this.id.lastIndexOf("/");
27405         const parentID = endIndex && _this.id.substring(0, endIndex);
27406         if (parentID) {
27407           let parent = allPresets[parentID];
27408           if (loc) {
27409             const validHere = _sharedLocationManager.locationSetsAt(loc);
27410             if ((parent == null ? void 0 : parent.locationSetID) && !validHere[parent.locationSetID]) {
27411               const candidateIDs = Object.keys(allPresets).filter((k2) => k2.startsWith(parentID));
27412               parent = allPresets[candidateIDs.find((candidateID) => {
27413                 const candidate = allPresets[candidateID];
27414                 return validHere[candidate.locationSetID] && (0, import_lodash.isEqual)(candidate.tags, parent.tags);
27415               })];
27416             }
27417           }
27418           resolved = inheritFields(parent, which);
27419         }
27420       }
27421       return utilArrayUniq(resolved);
27422       function inheritFields(parent, which2) {
27423         if (!parent)
27424           return [];
27425         if (which2 === "fields") {
27426           return parent.fields().filter(shouldInherit);
27427         } else if (which2 === "moreFields") {
27428           return parent.moreFields();
27429         } else {
27430           return [];
27431         }
27432       }
27433       function shouldInherit(f3) {
27434         if (f3.key && _this.tags[f3.key] !== void 0 && // inherit anyway if multiple values are allowed or just a checkbox
27435         f3.type !== "multiCombo" && f3.type !== "semiCombo" && f3.type !== "manyCombo" && f3.type !== "check")
27436           return false;
27437         return true;
27438       }
27439     }
27440     function stripDiacritics(s2) {
27441       if (s2.normalize)
27442         s2 = s2.normalize("NFD");
27443       s2 = s2.replace(/[\u0300-\u036f]/g, "");
27444       return s2;
27445     }
27446     return _this;
27447   }
27448
27449   // modules/presets/index.js
27450   var _mainPresetIndex = presetIndex();
27451   function presetIndex() {
27452     const dispatch14 = dispatch_default("favoritePreset", "recentsChange");
27453     const MAXRECENTS = 30;
27454     const POINT = presetPreset("point", { name: "Point", tags: {}, geometry: ["point", "vertex"], matchScore: 0.1 });
27455     const LINE = presetPreset("line", { name: "Line", tags: {}, geometry: ["line"], matchScore: 0.1 });
27456     const AREA = presetPreset("area", { name: "Area", tags: { area: "yes" }, geometry: ["area"], matchScore: 0.1 });
27457     const RELATION = presetPreset("relation", { name: "Relation", tags: {}, geometry: ["relation"], matchScore: 0.1 });
27458     let _this = presetCollection([POINT, LINE, AREA, RELATION]);
27459     let _presets = { point: POINT, line: LINE, area: AREA, relation: RELATION };
27460     let _defaults2 = {
27461       point: presetCollection([POINT]),
27462       vertex: presetCollection([POINT]),
27463       line: presetCollection([LINE]),
27464       area: presetCollection([AREA]),
27465       relation: presetCollection([RELATION])
27466     };
27467     let _fields = {};
27468     let _categories = {};
27469     let _universal = [];
27470     let _addablePresetIDs = null;
27471     let _recents;
27472     let _favorites;
27473     let _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
27474     let _loadPromise;
27475     _this.ensureLoaded = () => {
27476       if (_loadPromise)
27477         return _loadPromise;
27478       return _loadPromise = Promise.all([
27479         _mainFileFetcher.get("preset_categories"),
27480         _mainFileFetcher.get("preset_defaults"),
27481         _mainFileFetcher.get("preset_presets"),
27482         _mainFileFetcher.get("preset_fields")
27483       ]).then((vals) => {
27484         _this.merge({
27485           categories: vals[0],
27486           defaults: vals[1],
27487           presets: vals[2],
27488           fields: vals[3]
27489         });
27490         osmSetAreaKeys(_this.areaKeys());
27491         osmSetLineTags(_this.lineTags());
27492         osmSetPointTags(_this.pointTags());
27493         osmSetVertexTags(_this.vertexTags());
27494       });
27495     };
27496     _this.merge = (d2) => {
27497       let newLocationSets = [];
27498       if (d2.fields) {
27499         Object.keys(d2.fields).forEach((fieldID) => {
27500           let f3 = d2.fields[fieldID];
27501           if (f3) {
27502             f3 = presetField(fieldID, f3, _fields);
27503             if (f3.locationSet)
27504               newLocationSets.push(f3);
27505             _fields[fieldID] = f3;
27506           } else {
27507             delete _fields[fieldID];
27508           }
27509         });
27510       }
27511       if (d2.presets) {
27512         Object.keys(d2.presets).forEach((presetID) => {
27513           let p2 = d2.presets[presetID];
27514           if (p2) {
27515             const isAddable = !_addablePresetIDs || _addablePresetIDs.has(presetID);
27516             p2 = presetPreset(presetID, p2, isAddable, _fields, _presets);
27517             if (p2.locationSet)
27518               newLocationSets.push(p2);
27519             _presets[presetID] = p2;
27520           } else {
27521             const existing = _presets[presetID];
27522             if (existing && !existing.isFallback()) {
27523               delete _presets[presetID];
27524             }
27525           }
27526         });
27527       }
27528       if (d2.categories) {
27529         Object.keys(d2.categories).forEach((categoryID) => {
27530           let c2 = d2.categories[categoryID];
27531           if (c2) {
27532             c2 = presetCategory(categoryID, c2, _presets);
27533             if (c2.locationSet)
27534               newLocationSets.push(c2);
27535             _categories[categoryID] = c2;
27536           } else {
27537             delete _categories[categoryID];
27538           }
27539         });
27540       }
27541       _this.collection = Object.values(_presets).concat(Object.values(_categories));
27542       if (d2.defaults) {
27543         Object.keys(d2.defaults).forEach((geometry) => {
27544           const def = d2.defaults[geometry];
27545           if (Array.isArray(def)) {
27546             _defaults2[geometry] = presetCollection(
27547               def.map((id2) => _presets[id2] || _categories[id2]).filter(Boolean)
27548             );
27549           } else {
27550             delete _defaults2[geometry];
27551           }
27552         });
27553       }
27554       _universal = Object.values(_fields).filter((field) => field.universal);
27555       _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
27556       _this.collection.forEach((preset) => {
27557         (preset.geometry || []).forEach((geometry) => {
27558           let g3 = _geometryIndex[geometry];
27559           for (let key in preset.tags) {
27560             g3[key] = g3[key] || {};
27561             let value = preset.tags[key];
27562             (g3[key][value] = g3[key][value] || []).push(preset);
27563           }
27564         });
27565       });
27566       if (d2.featureCollection && Array.isArray(d2.featureCollection.features)) {
27567         _sharedLocationManager.mergeCustomGeoJSON(d2.featureCollection);
27568       }
27569       if (newLocationSets.length) {
27570         _sharedLocationManager.mergeLocationSets(newLocationSets);
27571       }
27572       return _this;
27573     };
27574     _this.match = (entity, resolver) => {
27575       return resolver.transient(entity, "presetMatch", () => {
27576         let geometry = entity.geometry(resolver);
27577         if (geometry === "vertex" && entity.isOnAddressLine(resolver)) {
27578           geometry = "point";
27579         }
27580         const entityExtent = entity.extent(resolver);
27581         return _this.matchTags(entity.tags, geometry, entityExtent.center());
27582       });
27583     };
27584     _this.matchTags = (tags, geometry, loc) => {
27585       const keyIndex = _geometryIndex[geometry];
27586       let bestScore = -1;
27587       let bestMatch;
27588       let matchCandidates = [];
27589       for (let k2 in tags) {
27590         let indexMatches = [];
27591         let valueIndex = keyIndex[k2];
27592         if (!valueIndex)
27593           continue;
27594         let keyValueMatches = valueIndex[tags[k2]];
27595         if (keyValueMatches)
27596           indexMatches.push(...keyValueMatches);
27597         let keyStarMatches = valueIndex["*"];
27598         if (keyStarMatches)
27599           indexMatches.push(...keyStarMatches);
27600         if (indexMatches.length === 0)
27601           continue;
27602         for (let i3 = 0; i3 < indexMatches.length; i3++) {
27603           const candidate = indexMatches[i3];
27604           const score = candidate.matchScore(tags);
27605           if (score === -1) {
27606             continue;
27607           }
27608           matchCandidates.push({ score, candidate });
27609           if (score > bestScore) {
27610             bestScore = score;
27611             bestMatch = candidate;
27612           }
27613         }
27614       }
27615       if (bestMatch && bestMatch.locationSetID && bestMatch.locationSetID !== "+[Q2]" && Array.isArray(loc)) {
27616         const validHere = _sharedLocationManager.locationSetsAt(loc);
27617         if (!validHere[bestMatch.locationSetID]) {
27618           matchCandidates.sort((a2, b2) => a2.score < b2.score ? 1 : -1);
27619           for (let i3 = 0; i3 < matchCandidates.length; i3++) {
27620             const candidateScore = matchCandidates[i3];
27621             if (!candidateScore.candidate.locationSetID || validHere[candidateScore.candidate.locationSetID]) {
27622               bestMatch = candidateScore.candidate;
27623               bestScore = candidateScore.score;
27624               break;
27625             }
27626           }
27627         }
27628       }
27629       if (!bestMatch || bestMatch.isFallback()) {
27630         for (let k2 in tags) {
27631           if (/^addr:/.test(k2) && keyIndex["addr:*"] && keyIndex["addr:*"]["*"]) {
27632             bestMatch = keyIndex["addr:*"]["*"][0];
27633             break;
27634           }
27635         }
27636       }
27637       return bestMatch || _this.fallback(geometry);
27638     };
27639     _this.allowsVertex = (entity, resolver) => {
27640       if (entity.type !== "node")
27641         return false;
27642       if (Object.keys(entity.tags).length === 0)
27643         return true;
27644       return resolver.transient(entity, "vertexMatch", () => {
27645         if (entity.isOnAddressLine(resolver))
27646           return true;
27647         const geometries = osmNodeGeometriesForTags(entity.tags);
27648         if (geometries.vertex)
27649           return true;
27650         if (geometries.point)
27651           return false;
27652         return true;
27653       });
27654     };
27655     _this.areaKeys = () => {
27656       const ignore = {
27657         barrier: true,
27658         highway: true,
27659         footway: true,
27660         railway: true,
27661         junction: true,
27662         traffic_calming: true,
27663         type: true
27664       };
27665       let areaKeys = {};
27666       const presets = _this.collection.filter((p2) => !p2.suggestion && !p2.replacement);
27667       presets.forEach((p2) => {
27668         const keys2 = p2.tags && Object.keys(p2.tags);
27669         const key = keys2 && keys2.length && keys2[0];
27670         if (!key)
27671           return;
27672         if (ignore[key])
27673           return;
27674         if (p2.geometry.indexOf("area") !== -1) {
27675           areaKeys[key] = areaKeys[key] || {};
27676         }
27677       });
27678       presets.forEach((p2) => {
27679         let key;
27680         for (key in p2.addTags) {
27681           const value = p2.addTags[key];
27682           if (key in areaKeys && // probably an area...
27683           p2.geometry.indexOf("line") !== -1 && // but sometimes a line
27684           value !== "*") {
27685             areaKeys[key][value] = true;
27686           }
27687         }
27688       });
27689       return areaKeys;
27690     };
27691     _this.lineTags = () => {
27692       return _this.collection.filter((lineTags, d2) => {
27693         if (d2.suggestion || d2.replacement || d2.searchable === false)
27694           return lineTags;
27695         const keys2 = d2.tags && Object.keys(d2.tags);
27696         const key = keys2 && keys2.length && keys2[0];
27697         if (!key)
27698           return lineTags;
27699         if (d2.geometry.indexOf("line") !== -1) {
27700           lineTags[key] = lineTags[key] || [];
27701           lineTags[key].push(d2.tags);
27702         }
27703         return lineTags;
27704       }, {});
27705     };
27706     _this.pointTags = () => {
27707       return _this.collection.reduce((pointTags, d2) => {
27708         if (d2.suggestion || d2.replacement || d2.searchable === false)
27709           return pointTags;
27710         const keys2 = d2.tags && Object.keys(d2.tags);
27711         const key = keys2 && keys2.length && keys2[0];
27712         if (!key)
27713           return pointTags;
27714         if (d2.geometry.indexOf("point") !== -1) {
27715           pointTags[key] = pointTags[key] || {};
27716           pointTags[key][d2.tags[key]] = true;
27717         }
27718         return pointTags;
27719       }, {});
27720     };
27721     _this.vertexTags = () => {
27722       return _this.collection.reduce((vertexTags, d2) => {
27723         if (d2.suggestion || d2.replacement || d2.searchable === false)
27724           return vertexTags;
27725         const keys2 = d2.tags && Object.keys(d2.tags);
27726         const key = keys2 && keys2.length && keys2[0];
27727         if (!key)
27728           return vertexTags;
27729         if (d2.geometry.indexOf("vertex") !== -1) {
27730           vertexTags[key] = vertexTags[key] || {};
27731           vertexTags[key][d2.tags[key]] = true;
27732         }
27733         return vertexTags;
27734       }, {});
27735     };
27736     _this.field = (id2) => _fields[id2];
27737     _this.universal = () => _universal;
27738     _this.defaults = (geometry, n3, startWithRecents, loc, extraPresets) => {
27739       let recents = [];
27740       if (startWithRecents) {
27741         recents = _this.recent().matchGeometry(geometry).collection.slice(0, 4);
27742       }
27743       let defaults;
27744       if (_addablePresetIDs) {
27745         defaults = Array.from(_addablePresetIDs).map(function(id2) {
27746           var preset = _this.item(id2);
27747           if (preset && preset.matchGeometry(geometry))
27748             return preset;
27749           return null;
27750         }).filter(Boolean);
27751       } else {
27752         defaults = _defaults2[geometry].collection.concat(_this.fallback(geometry));
27753       }
27754       let result = presetCollection(
27755         utilArrayUniq(recents.concat(defaults).concat(extraPresets || [])).slice(0, n3 - 1)
27756       );
27757       if (Array.isArray(loc)) {
27758         const validHere = _sharedLocationManager.locationSetsAt(loc);
27759         result.collection = result.collection.filter((a2) => !a2.locationSetID || validHere[a2.locationSetID]);
27760       }
27761       return result;
27762     };
27763     _this.addablePresetIDs = function(val) {
27764       if (!arguments.length)
27765         return _addablePresetIDs;
27766       if (Array.isArray(val))
27767         val = new Set(val);
27768       _addablePresetIDs = val;
27769       if (_addablePresetIDs) {
27770         _this.collection.forEach((p2) => {
27771           if (p2.addable)
27772             p2.addable(_addablePresetIDs.has(p2.id));
27773         });
27774       } else {
27775         _this.collection.forEach((p2) => {
27776           if (p2.addable)
27777             p2.addable(true);
27778         });
27779       }
27780       return _this;
27781     };
27782     _this.recent = () => {
27783       return presetCollection(
27784         utilArrayUniq(_this.getRecents().map((d2) => d2.preset).filter((d2) => d2.searchable !== false))
27785       );
27786     };
27787     function RibbonItem(preset, source) {
27788       let item = {};
27789       item.preset = preset;
27790       item.source = source;
27791       item.isFavorite = () => item.source === "favorite";
27792       item.isRecent = () => item.source === "recent";
27793       item.matches = (preset2) => item.preset.id === preset2.id;
27794       item.minified = () => ({ pID: item.preset.id });
27795       return item;
27796     }
27797     function ribbonItemForMinified(d2, source) {
27798       if (d2 && d2.pID) {
27799         const preset = _this.item(d2.pID);
27800         if (!preset)
27801           return null;
27802         return RibbonItem(preset, source);
27803       }
27804       return null;
27805     }
27806     _this.getGenericRibbonItems = () => {
27807       return ["point", "line", "area"].map((id2) => RibbonItem(_this.item(id2), "generic"));
27808     };
27809     _this.getAddable = () => {
27810       if (!_addablePresetIDs)
27811         return [];
27812       return _addablePresetIDs.map((id2) => {
27813         const preset = _this.item(id2);
27814         if (preset)
27815           return RibbonItem(preset, "addable");
27816         return null;
27817       }).filter(Boolean);
27818     };
27819     function setRecents(items) {
27820       _recents = items;
27821       const minifiedItems = items.map((d2) => d2.minified());
27822       corePreferences("preset_recents", JSON.stringify(minifiedItems));
27823       dispatch14.call("recentsChange");
27824     }
27825     _this.getRecents = () => {
27826       if (!_recents) {
27827         _recents = (JSON.parse(corePreferences("preset_recents")) || []).reduce((acc, d2) => {
27828           let item = ribbonItemForMinified(d2, "recent");
27829           if (item && item.preset.addable())
27830             acc.push(item);
27831           return acc;
27832         }, []);
27833       }
27834       return _recents;
27835     };
27836     _this.addRecent = (preset, besidePreset, after) => {
27837       const recents = _this.getRecents();
27838       const beforeItem = _this.recentMatching(besidePreset);
27839       let toIndex = recents.indexOf(beforeItem);
27840       if (after)
27841         toIndex += 1;
27842       const newItem = RibbonItem(preset, "recent");
27843       recents.splice(toIndex, 0, newItem);
27844       setRecents(recents);
27845     };
27846     _this.removeRecent = (preset) => {
27847       const item = _this.recentMatching(preset);
27848       if (item) {
27849         let items = _this.getRecents();
27850         items.splice(items.indexOf(item), 1);
27851         setRecents(items);
27852       }
27853     };
27854     _this.recentMatching = (preset) => {
27855       const items = _this.getRecents();
27856       for (let i3 in items) {
27857         if (items[i3].matches(preset)) {
27858           return items[i3];
27859         }
27860       }
27861       return null;
27862     };
27863     _this.moveItem = (items, fromIndex, toIndex) => {
27864       if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length)
27865         return null;
27866       items.splice(toIndex, 0, items.splice(fromIndex, 1)[0]);
27867       return items;
27868     };
27869     _this.moveRecent = (item, beforeItem) => {
27870       const recents = _this.getRecents();
27871       const fromIndex = recents.indexOf(item);
27872       const toIndex = recents.indexOf(beforeItem);
27873       const items = _this.moveItem(recents, fromIndex, toIndex);
27874       if (items)
27875         setRecents(items);
27876     };
27877     _this.setMostRecent = (preset) => {
27878       if (preset.searchable === false)
27879         return;
27880       let items = _this.getRecents();
27881       let item = _this.recentMatching(preset);
27882       if (item) {
27883         items.splice(items.indexOf(item), 1);
27884       } else {
27885         item = RibbonItem(preset, "recent");
27886       }
27887       while (items.length >= MAXRECENTS) {
27888         items.pop();
27889       }
27890       items.unshift(item);
27891       setRecents(items);
27892     };
27893     function setFavorites(items) {
27894       _favorites = items;
27895       const minifiedItems = items.map((d2) => d2.minified());
27896       corePreferences("preset_favorites", JSON.stringify(minifiedItems));
27897       dispatch14.call("favoritePreset");
27898     }
27899     _this.addFavorite = (preset, besidePreset, after) => {
27900       const favorites = _this.getFavorites();
27901       const beforeItem = _this.favoriteMatching(besidePreset);
27902       let toIndex = favorites.indexOf(beforeItem);
27903       if (after)
27904         toIndex += 1;
27905       const newItem = RibbonItem(preset, "favorite");
27906       favorites.splice(toIndex, 0, newItem);
27907       setFavorites(favorites);
27908     };
27909     _this.toggleFavorite = (preset) => {
27910       const favs = _this.getFavorites();
27911       const favorite = _this.favoriteMatching(preset);
27912       if (favorite) {
27913         favs.splice(favs.indexOf(favorite), 1);
27914       } else {
27915         if (favs.length === 10) {
27916           favs.pop();
27917         }
27918         favs.push(RibbonItem(preset, "favorite"));
27919       }
27920       setFavorites(favs);
27921     };
27922     _this.removeFavorite = (preset) => {
27923       const item = _this.favoriteMatching(preset);
27924       if (item) {
27925         const items = _this.getFavorites();
27926         items.splice(items.indexOf(item), 1);
27927         setFavorites(items);
27928       }
27929     };
27930     _this.getFavorites = () => {
27931       if (!_favorites) {
27932         let rawFavorites = JSON.parse(corePreferences("preset_favorites"));
27933         if (!rawFavorites) {
27934           rawFavorites = [];
27935           corePreferences("preset_favorites", JSON.stringify(rawFavorites));
27936         }
27937         _favorites = rawFavorites.reduce((output, d2) => {
27938           const item = ribbonItemForMinified(d2, "favorite");
27939           if (item && item.preset.addable())
27940             output.push(item);
27941           return output;
27942         }, []);
27943       }
27944       return _favorites;
27945     };
27946     _this.favoriteMatching = (preset) => {
27947       const favs = _this.getFavorites();
27948       for (let index in favs) {
27949         if (favs[index].matches(preset)) {
27950           return favs[index];
27951         }
27952       }
27953       return null;
27954     };
27955     return utilRebind(_this, dispatch14, "on");
27956   }
27957
27958   // modules/util/util.js
27959   function utilTagText(entity) {
27960     var obj = entity && entity.tags || {};
27961     return Object.keys(obj).map(function(k2) {
27962       return k2 + "=" + obj[k2];
27963     }).join(", ");
27964   }
27965   function utilTotalExtent(array2, graph) {
27966     var extent = geoExtent();
27967     var val, entity;
27968     for (var i3 = 0; i3 < array2.length; i3++) {
27969       val = array2[i3];
27970       entity = typeof val === "string" ? graph.hasEntity(val) : val;
27971       if (entity) {
27972         extent._extend(entity.extent(graph));
27973       }
27974     }
27975     return extent;
27976   }
27977   function utilTagDiff(oldTags, newTags) {
27978     var tagDiff = [];
27979     var keys2 = utilArrayUnion(Object.keys(oldTags), Object.keys(newTags)).sort();
27980     keys2.forEach(function(k2) {
27981       var oldVal = oldTags[k2];
27982       var newVal = newTags[k2];
27983       if ((oldVal || oldVal === "") && (newVal === void 0 || newVal !== oldVal)) {
27984         tagDiff.push({
27985           type: "-",
27986           key: k2,
27987           oldVal,
27988           newVal,
27989           display: "- " + k2 + "=" + oldVal
27990         });
27991       }
27992       if ((newVal || newVal === "") && (oldVal === void 0 || newVal !== oldVal)) {
27993         tagDiff.push({
27994           type: "+",
27995           key: k2,
27996           oldVal,
27997           newVal,
27998           display: "+ " + k2 + "=" + newVal
27999         });
28000       }
28001     });
28002     return tagDiff;
28003   }
28004   function utilEntitySelector(ids) {
28005     return ids.length ? "." + ids.join(",.") : "nothing";
28006   }
28007   function utilEntityOrMemberSelector(ids, graph) {
28008     var seen = new Set(ids);
28009     ids.forEach(collectShallowDescendants);
28010     return utilEntitySelector(Array.from(seen));
28011     function collectShallowDescendants(id2) {
28012       var entity = graph.hasEntity(id2);
28013       if (!entity || entity.type !== "relation")
28014         return;
28015       entity.members.map(function(member) {
28016         return member.id;
28017       }).forEach(function(id3) {
28018         seen.add(id3);
28019       });
28020     }
28021   }
28022   function utilEntityOrDeepMemberSelector(ids, graph) {
28023     return utilEntitySelector(utilEntityAndDeepMemberIDs(ids, graph));
28024   }
28025   function utilEntityAndDeepMemberIDs(ids, graph) {
28026     var seen = /* @__PURE__ */ new Set();
28027     ids.forEach(collectDeepDescendants);
28028     return Array.from(seen);
28029     function collectDeepDescendants(id2) {
28030       if (seen.has(id2))
28031         return;
28032       seen.add(id2);
28033       var entity = graph.hasEntity(id2);
28034       if (!entity || entity.type !== "relation")
28035         return;
28036       entity.members.map(function(member) {
28037         return member.id;
28038       }).forEach(collectDeepDescendants);
28039     }
28040   }
28041   function utilDeepMemberSelector(ids, graph, skipMultipolgonMembers) {
28042     var idsSet = new Set(ids);
28043     var seen = /* @__PURE__ */ new Set();
28044     var returners = /* @__PURE__ */ new Set();
28045     ids.forEach(collectDeepDescendants);
28046     return utilEntitySelector(Array.from(returners));
28047     function collectDeepDescendants(id2) {
28048       if (seen.has(id2))
28049         return;
28050       seen.add(id2);
28051       if (!idsSet.has(id2)) {
28052         returners.add(id2);
28053       }
28054       var entity = graph.hasEntity(id2);
28055       if (!entity || entity.type !== "relation")
28056         return;
28057       if (skipMultipolgonMembers && entity.isMultipolygon())
28058         return;
28059       entity.members.map(function(member) {
28060         return member.id;
28061       }).forEach(collectDeepDescendants);
28062     }
28063   }
28064   function utilHighlightEntities(ids, highlighted, context) {
28065     context.surface().selectAll(utilEntityOrDeepMemberSelector(ids, context.graph())).classed("highlighted", highlighted);
28066   }
28067   function utilGetAllNodes(ids, graph) {
28068     var seen = /* @__PURE__ */ new Set();
28069     var nodes = /* @__PURE__ */ new Set();
28070     ids.forEach(collectNodes);
28071     return Array.from(nodes);
28072     function collectNodes(id2) {
28073       if (seen.has(id2))
28074         return;
28075       seen.add(id2);
28076       var entity = graph.hasEntity(id2);
28077       if (!entity)
28078         return;
28079       if (entity.type === "node") {
28080         nodes.add(entity);
28081       } else if (entity.type === "way") {
28082         entity.nodes.forEach(collectNodes);
28083       } else {
28084         entity.members.map(function(member) {
28085           return member.id;
28086         }).forEach(collectNodes);
28087       }
28088     }
28089   }
28090   function utilDisplayName(entity) {
28091     var localizedNameKey = "name:" + _mainLocalizer.languageCode().toLowerCase();
28092     var name = entity.tags[localizedNameKey] || entity.tags.name || "";
28093     if (name)
28094       return name;
28095     var tags = {
28096       direction: entity.tags.direction,
28097       from: entity.tags.from,
28098       network: entity.tags.cycle_network || entity.tags.network,
28099       ref: entity.tags.ref,
28100       to: entity.tags.to,
28101       via: entity.tags.via
28102     };
28103     var keyComponents = [];
28104     if (tags.network) {
28105       keyComponents.push("network");
28106     }
28107     if (tags.ref) {
28108       keyComponents.push("ref");
28109     }
28110     if (entity.tags.route) {
28111       if (tags.direction) {
28112         keyComponents.push("direction");
28113       } else if (tags.from && tags.to) {
28114         keyComponents.push("from");
28115         keyComponents.push("to");
28116         if (tags.via) {
28117           keyComponents.push("via");
28118         }
28119       }
28120     }
28121     if (keyComponents.length) {
28122       name = _t("inspector.display_name." + keyComponents.join("_"), tags);
28123     }
28124     return name;
28125   }
28126   function utilDisplayNameForPath(entity) {
28127     var name = utilDisplayName(entity);
28128     var isFirefox = utilDetect().browser.toLowerCase().indexOf("firefox") > -1;
28129     var isNewChromium = Number(utilDetect().version.split(".")[0]) >= 96;
28130     if (!isFirefox && !isNewChromium && name && rtlRegex.test(name)) {
28131       name = fixRTLTextForSvg(name);
28132     }
28133     return name;
28134   }
28135   function utilDisplayType(id2) {
28136     return {
28137       n: _t("inspector.node"),
28138       w: _t("inspector.way"),
28139       r: _t("inspector.relation")
28140     }[id2.charAt(0)];
28141   }
28142   function utilDisplayLabel(entity, graphOrGeometry, verbose) {
28143     var result;
28144     var displayName = utilDisplayName(entity);
28145     var preset = typeof graphOrGeometry === "string" ? _mainPresetIndex.matchTags(entity.tags, graphOrGeometry) : _mainPresetIndex.match(entity, graphOrGeometry);
28146     var presetName = preset && (preset.suggestion ? preset.subtitle() : preset.name());
28147     if (verbose) {
28148       result = [presetName, displayName].filter(Boolean).join(" ");
28149     } else {
28150       result = displayName || presetName;
28151     }
28152     return result || utilDisplayType(entity.id);
28153   }
28154   function utilEntityRoot(entityType) {
28155     return {
28156       node: "n",
28157       way: "w",
28158       relation: "r"
28159     }[entityType];
28160   }
28161   function utilCombinedTags(entityIDs, graph) {
28162     var tags = {};
28163     var tagCounts = {};
28164     var allKeys = /* @__PURE__ */ new Set();
28165     var entities = entityIDs.map(function(entityID) {
28166       return graph.hasEntity(entityID);
28167     }).filter(Boolean);
28168     entities.forEach(function(entity) {
28169       var keys2 = Object.keys(entity.tags).filter(Boolean);
28170       keys2.forEach(function(key2) {
28171         allKeys.add(key2);
28172       });
28173     });
28174     entities.forEach(function(entity) {
28175       allKeys.forEach(function(key2) {
28176         var value = entity.tags[key2];
28177         if (!tags.hasOwnProperty(key2)) {
28178           tags[key2] = value;
28179         } else {
28180           if (!Array.isArray(tags[key2])) {
28181             if (tags[key2] !== value) {
28182               tags[key2] = [tags[key2], value];
28183             }
28184           } else {
28185             if (tags[key2].indexOf(value) === -1) {
28186               tags[key2].push(value);
28187             }
28188           }
28189         }
28190         var tagHash = key2 + "=" + value;
28191         if (!tagCounts[tagHash])
28192           tagCounts[tagHash] = 0;
28193         tagCounts[tagHash] += 1;
28194       });
28195     });
28196     for (var key in tags) {
28197       if (!Array.isArray(tags[key]))
28198         continue;
28199       tags[key] = tags[key].sort(function(val12, val2) {
28200         var key2 = key2;
28201         var count2 = tagCounts[key2 + "=" + val2];
28202         var count1 = tagCounts[key2 + "=" + val12];
28203         if (count2 !== count1) {
28204           return count2 - count1;
28205         }
28206         if (val2 && val12) {
28207           return val12.localeCompare(val2);
28208         }
28209         return val12 ? 1 : -1;
28210       });
28211     }
28212     return tags;
28213   }
28214   function utilStringQs(str2) {
28215     var i3 = 0;
28216     while (i3 < str2.length && (str2[i3] === "?" || str2[i3] === "#"))
28217       i3++;
28218     str2 = str2.slice(i3);
28219     return str2.split("&").reduce(function(obj, pair3) {
28220       var parts = pair3.split("=");
28221       if (parts.length === 2) {
28222         obj[parts[0]] = null === parts[1] ? "" : decodeURIComponent(parts[1]);
28223       }
28224       return obj;
28225     }, {});
28226   }
28227   function utilQsString(obj, noencode) {
28228     function softEncode(s2) {
28229       return encodeURIComponent(s2).replace(/(%2F|%3A|%2C|%7B|%7D)/g, decodeURIComponent);
28230     }
28231     return Object.keys(obj).sort().map(function(key) {
28232       return encodeURIComponent(key) + "=" + (noencode ? softEncode(obj[key]) : encodeURIComponent(obj[key]));
28233     }).join("&");
28234   }
28235   function utilPrefixDOMProperty(property) {
28236     var prefixes2 = ["webkit", "ms", "moz", "o"];
28237     var i3 = -1;
28238     var n3 = prefixes2.length;
28239     var s2 = document.body;
28240     if (property in s2)
28241       return property;
28242     property = property.slice(0, 1).toUpperCase() + property.slice(1);
28243     while (++i3 < n3) {
28244       if (prefixes2[i3] + property in s2) {
28245         return prefixes2[i3] + property;
28246       }
28247     }
28248     return false;
28249   }
28250   function utilPrefixCSSProperty(property) {
28251     var prefixes2 = ["webkit", "ms", "Moz", "O"];
28252     var i3 = -1;
28253     var n3 = prefixes2.length;
28254     var s2 = document.body.style;
28255     if (property.toLowerCase() in s2) {
28256       return property.toLowerCase();
28257     }
28258     while (++i3 < n3) {
28259       if (prefixes2[i3] + property in s2) {
28260         return "-" + prefixes2[i3].toLowerCase() + property.replace(/([A-Z])/g, "-$1").toLowerCase();
28261       }
28262     }
28263     return false;
28264   }
28265   var transformProperty;
28266   function utilSetTransform(el, x2, y2, scale) {
28267     var prop = transformProperty = transformProperty || utilPrefixCSSProperty("Transform");
28268     var translate = utilDetect().opera ? "translate(" + x2 + "px," + y2 + "px)" : "translate3d(" + x2 + "px," + y2 + "px,0)";
28269     return el.style(prop, translate + (scale ? " scale(" + scale + ")" : ""));
28270   }
28271   function utilEditDistance(a2, b2) {
28272     a2 = (0, import_diacritics.remove)(a2.toLowerCase());
28273     b2 = (0, import_diacritics.remove)(b2.toLowerCase());
28274     if (a2.length === 0)
28275       return b2.length;
28276     if (b2.length === 0)
28277       return a2.length;
28278     var matrix = [];
28279     var i3, j3;
28280     for (i3 = 0; i3 <= b2.length; i3++) {
28281       matrix[i3] = [i3];
28282     }
28283     for (j3 = 0; j3 <= a2.length; j3++) {
28284       matrix[0][j3] = j3;
28285     }
28286     for (i3 = 1; i3 <= b2.length; i3++) {
28287       for (j3 = 1; j3 <= a2.length; j3++) {
28288         if (b2.charAt(i3 - 1) === a2.charAt(j3 - 1)) {
28289           matrix[i3][j3] = matrix[i3 - 1][j3 - 1];
28290         } else {
28291           matrix[i3][j3] = Math.min(
28292             matrix[i3 - 1][j3 - 1] + 1,
28293             // substitution
28294             Math.min(
28295               matrix[i3][j3 - 1] + 1,
28296               // insertion
28297               matrix[i3 - 1][j3] + 1
28298             )
28299           );
28300         }
28301       }
28302     }
28303     return matrix[b2.length][a2.length];
28304   }
28305   function utilFastMouse(container) {
28306     var rect = container.getBoundingClientRect();
28307     var rectLeft = rect.left;
28308     var rectTop = rect.top;
28309     var clientLeft = +container.clientLeft;
28310     var clientTop = +container.clientTop;
28311     return function(e3) {
28312       return [
28313         e3.clientX - rectLeft - clientLeft,
28314         e3.clientY - rectTop - clientTop
28315       ];
28316     };
28317   }
28318   function utilAsyncMap(inputs, func, callback) {
28319     var remaining = inputs.length;
28320     var results = [];
28321     var errors = [];
28322     inputs.forEach(function(d2, i3) {
28323       func(d2, function done(err, data) {
28324         errors[i3] = err;
28325         results[i3] = data;
28326         remaining--;
28327         if (!remaining)
28328           callback(errors, results);
28329       });
28330     });
28331   }
28332   function utilWrap(index, length) {
28333     if (index < 0) {
28334       index += Math.ceil(-index / length) * length;
28335     }
28336     return index % length;
28337   }
28338   function utilFunctor(value) {
28339     if (typeof value === "function")
28340       return value;
28341     return function() {
28342       return value;
28343     };
28344   }
28345   function utilNoAuto(selection2) {
28346     var isText = selection2.size() && selection2.node().tagName.toLowerCase() === "textarea";
28347     return selection2.attr("autocomplete", "new-password").attr("autocorrect", "off").attr("autocapitalize", "off").attr("spellcheck", isText ? "true" : "false");
28348   }
28349   function utilHashcode(str2) {
28350     var hash = 0;
28351     if (str2.length === 0) {
28352       return hash;
28353     }
28354     for (var i3 = 0; i3 < str2.length; i3++) {
28355       var char = str2.charCodeAt(i3);
28356       hash = (hash << 5) - hash + char;
28357       hash = hash & hash;
28358     }
28359     return hash;
28360   }
28361   function utilSafeClassName(str2) {
28362     return str2.toLowerCase().replace(/[^a-z0-9]+/g, "_");
28363   }
28364   function utilUniqueDomId(val) {
28365     return "ideditor-" + utilSafeClassName(val.toString()) + "-" + (/* @__PURE__ */ new Date()).getTime().toString();
28366   }
28367   function utilUnicodeCharsCount(str2) {
28368     return Array.from(str2).length;
28369   }
28370   function utilUnicodeCharsTruncated(str2, limit) {
28371     return Array.from(str2).slice(0, limit).join("");
28372   }
28373   function toNumericID(id2) {
28374     var match = id2.match(/^[cnwr](-?\d+)$/);
28375     if (match) {
28376       return parseInt(match[1], 10);
28377     }
28378     return NaN;
28379   }
28380   function compareNumericIDs(left, right) {
28381     if (isNaN(left) && isNaN(right))
28382       return -1;
28383     if (isNaN(left))
28384       return 1;
28385     if (isNaN(right))
28386       return -1;
28387     if (Math.sign(left) !== Math.sign(right))
28388       return -Math.sign(left);
28389     if (Math.sign(left) < 0)
28390       return Math.sign(right - left);
28391     return Math.sign(left - right);
28392   }
28393   function utilCompareIDs(left, right) {
28394     return compareNumericIDs(toNumericID(left), toNumericID(right));
28395   }
28396   function utilOldestID(ids) {
28397     if (ids.length === 0) {
28398       return void 0;
28399     }
28400     var oldestIDIndex = 0;
28401     var oldestID = toNumericID(ids[0]);
28402     for (var i3 = 1; i3 < ids.length; i3++) {
28403       var num = toNumericID(ids[i3]);
28404       if (compareNumericIDs(oldestID, num) === 1) {
28405         oldestIDIndex = i3;
28406         oldestID = num;
28407       }
28408     }
28409     return ids[oldestIDIndex];
28410   }
28411   function utilCleanOsmString(val, maxChars) {
28412     if (val === void 0 || val === null) {
28413       val = "";
28414     } else {
28415       val = val.toString();
28416     }
28417     val = val.trim();
28418     if (val.normalize)
28419       val = val.normalize("NFC");
28420     return utilUnicodeCharsTruncated(val, maxChars);
28421   }
28422
28423   // modules/osm/entity.js
28424   function osmEntity(attrs) {
28425     if (this instanceof osmEntity)
28426       return;
28427     if (attrs && attrs.type) {
28428       return osmEntity[attrs.type].apply(this, arguments);
28429     } else if (attrs && attrs.id) {
28430       return osmEntity[osmEntity.id.type(attrs.id)].apply(this, arguments);
28431     }
28432     return new osmEntity().initialize(arguments);
28433   }
28434   osmEntity.id = function(type2) {
28435     return osmEntity.id.fromOSM(type2, osmEntity.id.next[type2]--);
28436   };
28437   osmEntity.id.next = {
28438     changeset: -1,
28439     node: -1,
28440     way: -1,
28441     relation: -1
28442   };
28443   osmEntity.id.fromOSM = function(type2, id2) {
28444     return type2[0] + id2;
28445   };
28446   osmEntity.id.toOSM = function(id2) {
28447     var match = id2.match(/^[cnwr](-?\d+)$/);
28448     if (match) {
28449       return match[1];
28450     }
28451     return "";
28452   };
28453   osmEntity.id.type = function(id2) {
28454     return { "c": "changeset", "n": "node", "w": "way", "r": "relation" }[id2[0]];
28455   };
28456   osmEntity.key = function(entity) {
28457     return entity.id + "v" + (entity.v || 0);
28458   };
28459   var _deprecatedTagValuesByKey;
28460   osmEntity.deprecatedTagValuesByKey = function(dataDeprecated) {
28461     if (!_deprecatedTagValuesByKey) {
28462       _deprecatedTagValuesByKey = {};
28463       dataDeprecated.forEach(function(d2) {
28464         var oldKeys = Object.keys(d2.old);
28465         if (oldKeys.length === 1) {
28466           var oldKey = oldKeys[0];
28467           var oldValue = d2.old[oldKey];
28468           if (oldValue !== "*") {
28469             if (!_deprecatedTagValuesByKey[oldKey]) {
28470               _deprecatedTagValuesByKey[oldKey] = [oldValue];
28471             } else {
28472               _deprecatedTagValuesByKey[oldKey].push(oldValue);
28473             }
28474           }
28475         }
28476       });
28477     }
28478     return _deprecatedTagValuesByKey;
28479   };
28480   osmEntity.prototype = {
28481     tags: {},
28482     initialize: function(sources) {
28483       for (var i3 = 0; i3 < sources.length; ++i3) {
28484         var source = sources[i3];
28485         for (var prop in source) {
28486           if (Object.prototype.hasOwnProperty.call(source, prop)) {
28487             if (source[prop] === void 0) {
28488               delete this[prop];
28489             } else {
28490               this[prop] = source[prop];
28491             }
28492           }
28493         }
28494       }
28495       if (!this.id && this.type) {
28496         this.id = osmEntity.id(this.type);
28497       }
28498       if (!this.hasOwnProperty("visible")) {
28499         this.visible = true;
28500       }
28501       if (debug) {
28502         Object.freeze(this);
28503         Object.freeze(this.tags);
28504         if (this.loc)
28505           Object.freeze(this.loc);
28506         if (this.nodes)
28507           Object.freeze(this.nodes);
28508         if (this.members)
28509           Object.freeze(this.members);
28510       }
28511       return this;
28512     },
28513     copy: function(resolver, copies) {
28514       if (copies[this.id])
28515         return copies[this.id];
28516       var copy2 = osmEntity(this, { id: void 0, user: void 0, version: void 0 });
28517       copies[this.id] = copy2;
28518       return copy2;
28519     },
28520     osmId: function() {
28521       return osmEntity.id.toOSM(this.id);
28522     },
28523     isNew: function() {
28524       var osmId = osmEntity.id.toOSM(this.id);
28525       return osmId.length === 0 || osmId[0] === "-";
28526     },
28527     update: function(attrs) {
28528       return osmEntity(this, attrs, { v: 1 + (this.v || 0) });
28529     },
28530     mergeTags: function(tags) {
28531       var merged = Object.assign({}, this.tags);
28532       var changed = false;
28533       for (var k2 in tags) {
28534         var t1 = merged[k2];
28535         var t2 = tags[k2];
28536         if (!t1) {
28537           changed = true;
28538           merged[k2] = t2;
28539         } else if (t1 !== t2) {
28540           changed = true;
28541           merged[k2] = utilUnicodeCharsTruncated(
28542             utilArrayUnion(t1.split(/;\s*/), t2.split(/;\s*/)).join(";"),
28543             255
28544             // avoid exceeding character limit; see also context.maxCharsForTagValue()
28545           );
28546         }
28547       }
28548       return changed ? this.update({ tags: merged }) : this;
28549     },
28550     intersects: function(extent, resolver) {
28551       return this.extent(resolver).intersects(extent);
28552     },
28553     hasNonGeometryTags: function() {
28554       return Object.keys(this.tags).some(function(k2) {
28555         return k2 !== "area";
28556       });
28557     },
28558     hasParentRelations: function(resolver) {
28559       return resolver.parentRelations(this).length > 0;
28560     },
28561     hasInterestingTags: function() {
28562       return Object.keys(this.tags).some(osmIsInterestingTag);
28563     },
28564     isHighwayIntersection: function() {
28565       return false;
28566     },
28567     isDegenerate: function() {
28568       return true;
28569     },
28570     deprecatedTags: function(dataDeprecated) {
28571       var tags = this.tags;
28572       if (Object.keys(tags).length === 0)
28573         return [];
28574       var deprecated = [];
28575       dataDeprecated.forEach(function(d2) {
28576         var oldKeys = Object.keys(d2.old);
28577         if (d2.replace) {
28578           var hasExistingValues = Object.keys(d2.replace).some(function(replaceKey) {
28579             if (!tags[replaceKey] || d2.old[replaceKey])
28580               return false;
28581             var replaceValue = d2.replace[replaceKey];
28582             if (replaceValue === "*")
28583               return false;
28584             if (replaceValue === tags[replaceKey])
28585               return false;
28586             return true;
28587           });
28588           if (hasExistingValues)
28589             return;
28590         }
28591         var matchesDeprecatedTags = oldKeys.every(function(oldKey) {
28592           if (!tags[oldKey])
28593             return false;
28594           if (d2.old[oldKey] === "*")
28595             return true;
28596           if (d2.old[oldKey] === tags[oldKey])
28597             return true;
28598           var vals = tags[oldKey].split(";").filter(Boolean);
28599           if (vals.length === 0) {
28600             return false;
28601           } else if (vals.length > 1) {
28602             return vals.indexOf(d2.old[oldKey]) !== -1;
28603           } else {
28604             if (tags[oldKey] === d2.old[oldKey]) {
28605               if (d2.replace && d2.old[oldKey] === d2.replace[oldKey]) {
28606                 var replaceKeys = Object.keys(d2.replace);
28607                 return !replaceKeys.every(function(replaceKey) {
28608                   return tags[replaceKey] === d2.replace[replaceKey];
28609                 });
28610               } else {
28611                 return true;
28612               }
28613             }
28614           }
28615           return false;
28616         });
28617         if (matchesDeprecatedTags) {
28618           deprecated.push(d2);
28619         }
28620       });
28621       return deprecated;
28622     }
28623   };
28624
28625   // modules/osm/lanes.js
28626   function osmLanes(entity) {
28627     if (entity.type !== "way")
28628       return null;
28629     if (!entity.tags.highway)
28630       return null;
28631     var tags = entity.tags;
28632     var isOneWay = entity.isOneWay();
28633     var laneCount = getLaneCount(tags, isOneWay);
28634     var maxspeed = parseMaxspeed(tags);
28635     var laneDirections = parseLaneDirections(tags, isOneWay, laneCount);
28636     var forward = laneDirections.forward;
28637     var backward = laneDirections.backward;
28638     var bothways = laneDirections.bothways;
28639     var turnLanes = {};
28640     turnLanes.unspecified = parseTurnLanes(tags["turn:lanes"]);
28641     turnLanes.forward = parseTurnLanes(tags["turn:lanes:forward"]);
28642     turnLanes.backward = parseTurnLanes(tags["turn:lanes:backward"]);
28643     var maxspeedLanes = {};
28644     maxspeedLanes.unspecified = parseMaxspeedLanes(tags["maxspeed:lanes"], maxspeed);
28645     maxspeedLanes.forward = parseMaxspeedLanes(tags["maxspeed:lanes:forward"], maxspeed);
28646     maxspeedLanes.backward = parseMaxspeedLanes(tags["maxspeed:lanes:backward"], maxspeed);
28647     var psvLanes = {};
28648     psvLanes.unspecified = parseMiscLanes(tags["psv:lanes"]);
28649     psvLanes.forward = parseMiscLanes(tags["psv:lanes:forward"]);
28650     psvLanes.backward = parseMiscLanes(tags["psv:lanes:backward"]);
28651     var busLanes = {};
28652     busLanes.unspecified = parseMiscLanes(tags["bus:lanes"]);
28653     busLanes.forward = parseMiscLanes(tags["bus:lanes:forward"]);
28654     busLanes.backward = parseMiscLanes(tags["bus:lanes:backward"]);
28655     var taxiLanes = {};
28656     taxiLanes.unspecified = parseMiscLanes(tags["taxi:lanes"]);
28657     taxiLanes.forward = parseMiscLanes(tags["taxi:lanes:forward"]);
28658     taxiLanes.backward = parseMiscLanes(tags["taxi:lanes:backward"]);
28659     var hovLanes = {};
28660     hovLanes.unspecified = parseMiscLanes(tags["hov:lanes"]);
28661     hovLanes.forward = parseMiscLanes(tags["hov:lanes:forward"]);
28662     hovLanes.backward = parseMiscLanes(tags["hov:lanes:backward"]);
28663     var hgvLanes = {};
28664     hgvLanes.unspecified = parseMiscLanes(tags["hgv:lanes"]);
28665     hgvLanes.forward = parseMiscLanes(tags["hgv:lanes:forward"]);
28666     hgvLanes.backward = parseMiscLanes(tags["hgv:lanes:backward"]);
28667     var bicyclewayLanes = {};
28668     bicyclewayLanes.unspecified = parseBicycleWay(tags["bicycleway:lanes"]);
28669     bicyclewayLanes.forward = parseBicycleWay(tags["bicycleway:lanes:forward"]);
28670     bicyclewayLanes.backward = parseBicycleWay(tags["bicycleway:lanes:backward"]);
28671     var lanesObj = {
28672       forward: [],
28673       backward: [],
28674       unspecified: []
28675     };
28676     mapToLanesObj(lanesObj, turnLanes, "turnLane");
28677     mapToLanesObj(lanesObj, maxspeedLanes, "maxspeed");
28678     mapToLanesObj(lanesObj, psvLanes, "psv");
28679     mapToLanesObj(lanesObj, busLanes, "bus");
28680     mapToLanesObj(lanesObj, taxiLanes, "taxi");
28681     mapToLanesObj(lanesObj, hovLanes, "hov");
28682     mapToLanesObj(lanesObj, hgvLanes, "hgv");
28683     mapToLanesObj(lanesObj, bicyclewayLanes, "bicycleway");
28684     return {
28685       metadata: {
28686         count: laneCount,
28687         oneway: isOneWay,
28688         forward,
28689         backward,
28690         bothways,
28691         turnLanes,
28692         maxspeed,
28693         maxspeedLanes,
28694         psvLanes,
28695         busLanes,
28696         taxiLanes,
28697         hovLanes,
28698         hgvLanes,
28699         bicyclewayLanes
28700       },
28701       lanes: lanesObj
28702     };
28703   }
28704   function getLaneCount(tags, isOneWay) {
28705     var count;
28706     if (tags.lanes) {
28707       count = parseInt(tags.lanes, 10);
28708       if (count > 0) {
28709         return count;
28710       }
28711     }
28712     switch (tags.highway) {
28713       case "trunk":
28714       case "motorway":
28715         count = isOneWay ? 2 : 4;
28716         break;
28717       default:
28718         count = isOneWay ? 1 : 2;
28719         break;
28720     }
28721     return count;
28722   }
28723   function parseMaxspeed(tags) {
28724     var maxspeed = tags.maxspeed;
28725     if (!maxspeed)
28726       return;
28727     var maxspeedRegex = /^([0-9][\.0-9]+?)(?:[ ]?(?:km\/h|kmh|kph|mph|knots))?$/;
28728     if (!maxspeedRegex.test(maxspeed))
28729       return;
28730     return parseInt(maxspeed, 10);
28731   }
28732   function parseLaneDirections(tags, isOneWay, laneCount) {
28733     var forward = parseInt(tags["lanes:forward"], 10);
28734     var backward = parseInt(tags["lanes:backward"], 10);
28735     var bothways = parseInt(tags["lanes:both_ways"], 10) > 0 ? 1 : 0;
28736     if (parseInt(tags.oneway, 10) === -1) {
28737       forward = 0;
28738       bothways = 0;
28739       backward = laneCount;
28740     } else if (isOneWay) {
28741       forward = laneCount;
28742       bothways = 0;
28743       backward = 0;
28744     } else if (isNaN(forward) && isNaN(backward)) {
28745       backward = Math.floor((laneCount - bothways) / 2);
28746       forward = laneCount - bothways - backward;
28747     } else if (isNaN(forward)) {
28748       if (backward > laneCount - bothways) {
28749         backward = laneCount - bothways;
28750       }
28751       forward = laneCount - bothways - backward;
28752     } else if (isNaN(backward)) {
28753       if (forward > laneCount - bothways) {
28754         forward = laneCount - bothways;
28755       }
28756       backward = laneCount - bothways - forward;
28757     }
28758     return {
28759       forward,
28760       backward,
28761       bothways
28762     };
28763   }
28764   function parseTurnLanes(tag) {
28765     if (!tag)
28766       return;
28767     var validValues = [
28768       "left",
28769       "slight_left",
28770       "sharp_left",
28771       "through",
28772       "right",
28773       "slight_right",
28774       "sharp_right",
28775       "reverse",
28776       "merge_to_left",
28777       "merge_to_right",
28778       "none"
28779     ];
28780     return tag.split("|").map(function(s2) {
28781       if (s2 === "")
28782         s2 = "none";
28783       return s2.split(";").map(function(d2) {
28784         return validValues.indexOf(d2) === -1 ? "unknown" : d2;
28785       });
28786     });
28787   }
28788   function parseMaxspeedLanes(tag, maxspeed) {
28789     if (!tag)
28790       return;
28791     return tag.split("|").map(function(s2) {
28792       if (s2 === "none")
28793         return s2;
28794       var m2 = parseInt(s2, 10);
28795       if (s2 === "" || m2 === maxspeed)
28796         return null;
28797       return isNaN(m2) ? "unknown" : m2;
28798     });
28799   }
28800   function parseMiscLanes(tag) {
28801     if (!tag)
28802       return;
28803     var validValues = [
28804       "yes",
28805       "no",
28806       "designated"
28807     ];
28808     return tag.split("|").map(function(s2) {
28809       if (s2 === "")
28810         s2 = "no";
28811       return validValues.indexOf(s2) === -1 ? "unknown" : s2;
28812     });
28813   }
28814   function parseBicycleWay(tag) {
28815     if (!tag)
28816       return;
28817     var validValues = [
28818       "yes",
28819       "no",
28820       "designated",
28821       "lane"
28822     ];
28823     return tag.split("|").map(function(s2) {
28824       if (s2 === "")
28825         s2 = "no";
28826       return validValues.indexOf(s2) === -1 ? "unknown" : s2;
28827     });
28828   }
28829   function mapToLanesObj(lanesObj, data, key) {
28830     if (data.forward) {
28831       data.forward.forEach(function(l2, i3) {
28832         if (!lanesObj.forward[i3])
28833           lanesObj.forward[i3] = {};
28834         lanesObj.forward[i3][key] = l2;
28835       });
28836     }
28837     if (data.backward) {
28838       data.backward.forEach(function(l2, i3) {
28839         if (!lanesObj.backward[i3])
28840           lanesObj.backward[i3] = {};
28841         lanesObj.backward[i3][key] = l2;
28842       });
28843     }
28844     if (data.unspecified) {
28845       data.unspecified.forEach(function(l2, i3) {
28846         if (!lanesObj.unspecified[i3])
28847           lanesObj.unspecified[i3] = {};
28848         lanesObj.unspecified[i3][key] = l2;
28849       });
28850     }
28851   }
28852
28853   // modules/osm/way.js
28854   function osmWay() {
28855     if (!(this instanceof osmWay)) {
28856       return new osmWay().initialize(arguments);
28857     } else if (arguments.length) {
28858       this.initialize(arguments);
28859     }
28860   }
28861   osmEntity.way = osmWay;
28862   osmWay.prototype = Object.create(osmEntity.prototype);
28863   Object.assign(osmWay.prototype, {
28864     type: "way",
28865     nodes: [],
28866     copy: function(resolver, copies) {
28867       if (copies[this.id])
28868         return copies[this.id];
28869       var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
28870       var nodes = this.nodes.map(function(id2) {
28871         return resolver.entity(id2).copy(resolver, copies).id;
28872       });
28873       copy2 = copy2.update({ nodes });
28874       copies[this.id] = copy2;
28875       return copy2;
28876     },
28877     extent: function(resolver) {
28878       return resolver.transient(this, "extent", function() {
28879         var extent = geoExtent();
28880         for (var i3 = 0; i3 < this.nodes.length; i3++) {
28881           var node = resolver.hasEntity(this.nodes[i3]);
28882           if (node) {
28883             extent._extend(node.extent());
28884           }
28885         }
28886         return extent;
28887       });
28888     },
28889     first: function() {
28890       return this.nodes[0];
28891     },
28892     last: function() {
28893       return this.nodes[this.nodes.length - 1];
28894     },
28895     contains: function(node) {
28896       return this.nodes.indexOf(node) >= 0;
28897     },
28898     affix: function(node) {
28899       if (this.nodes[0] === node)
28900         return "prefix";
28901       if (this.nodes[this.nodes.length - 1] === node)
28902         return "suffix";
28903     },
28904     layer: function() {
28905       if (isFinite(this.tags.layer)) {
28906         return Math.max(-10, Math.min(+this.tags.layer, 10));
28907       }
28908       if (this.tags.covered === "yes")
28909         return -1;
28910       if (this.tags.location === "overground")
28911         return 1;
28912       if (this.tags.location === "underground")
28913         return -1;
28914       if (this.tags.location === "underwater")
28915         return -10;
28916       if (this.tags.power === "line")
28917         return 10;
28918       if (this.tags.power === "minor_line")
28919         return 10;
28920       if (this.tags.aerialway)
28921         return 10;
28922       if (this.tags.bridge)
28923         return 1;
28924       if (this.tags.cutting)
28925         return -1;
28926       if (this.tags.tunnel)
28927         return -1;
28928       if (this.tags.waterway)
28929         return -1;
28930       if (this.tags.man_made === "pipeline")
28931         return -10;
28932       if (this.tags.boundary)
28933         return -10;
28934       return 0;
28935     },
28936     // the approximate width of the line based on its tags except its `width` tag
28937     impliedLineWidthMeters: function() {
28938       var averageWidths = {
28939         highway: {
28940           // width is for single lane
28941           motorway: 5,
28942           motorway_link: 5,
28943           trunk: 4.5,
28944           trunk_link: 4.5,
28945           primary: 4,
28946           secondary: 4,
28947           tertiary: 4,
28948           primary_link: 4,
28949           secondary_link: 4,
28950           tertiary_link: 4,
28951           unclassified: 4,
28952           road: 4,
28953           living_street: 4,
28954           bus_guideway: 4,
28955           pedestrian: 4,
28956           residential: 3.5,
28957           service: 3.5,
28958           track: 3,
28959           cycleway: 2.5,
28960           bridleway: 2,
28961           corridor: 2,
28962           steps: 2,
28963           path: 1.5,
28964           footway: 1.5
28965         },
28966         railway: {
28967           // width includes ties and rail bed, not just track gauge
28968           rail: 2.5,
28969           light_rail: 2.5,
28970           tram: 2.5,
28971           subway: 2.5,
28972           monorail: 2.5,
28973           funicular: 2.5,
28974           disused: 2.5,
28975           preserved: 2.5,
28976           miniature: 1.5,
28977           narrow_gauge: 1.5
28978         },
28979         waterway: {
28980           river: 50,
28981           canal: 25,
28982           stream: 5,
28983           tidal_channel: 5,
28984           fish_pass: 2.5,
28985           drain: 2.5,
28986           ditch: 1.5
28987         }
28988       };
28989       for (var key in averageWidths) {
28990         if (this.tags[key] && averageWidths[key][this.tags[key]]) {
28991           var width = averageWidths[key][this.tags[key]];
28992           if (key === "highway") {
28993             var laneCount = this.tags.lanes && parseInt(this.tags.lanes, 10);
28994             if (!laneCount)
28995               laneCount = this.isOneWay() ? 1 : 2;
28996             return width * laneCount;
28997           }
28998           return width;
28999         }
29000       }
29001       return null;
29002     },
29003     isOneWay: function() {
29004       var values = {
29005         "yes": true,
29006         "1": true,
29007         "-1": true,
29008         "reversible": true,
29009         "alternating": true,
29010         "no": false,
29011         "0": false
29012       };
29013       if (values[this.tags.oneway] !== void 0) {
29014         return values[this.tags.oneway];
29015       }
29016       for (var key in this.tags) {
29017         if (key in osmOneWayTags && this.tags[key] in osmOneWayTags[key]) {
29018           return true;
29019         }
29020       }
29021       return false;
29022     },
29023     // Some identifier for tag that implies that this way is "sided",
29024     // i.e. the right side is the 'inside' (e.g. the right side of a
29025     // natural=cliff is lower).
29026     sidednessIdentifier: function() {
29027       for (const realKey in this.tags) {
29028         const value = this.tags[realKey];
29029         const key = osmRemoveLifecyclePrefix(realKey);
29030         if (key in osmRightSideIsInsideTags && value in osmRightSideIsInsideTags[key]) {
29031           if (osmRightSideIsInsideTags[key][value] === true) {
29032             return key;
29033           } else {
29034             return osmRightSideIsInsideTags[key][value];
29035           }
29036         }
29037       }
29038       return null;
29039     },
29040     isSided: function() {
29041       if (this.tags.two_sided === "yes") {
29042         return false;
29043       }
29044       return this.sidednessIdentifier() !== null;
29045     },
29046     lanes: function() {
29047       return osmLanes(this);
29048     },
29049     isClosed: function() {
29050       return this.nodes.length > 1 && this.first() === this.last();
29051     },
29052     isConvex: function(resolver) {
29053       if (!this.isClosed() || this.isDegenerate())
29054         return null;
29055       var nodes = utilArrayUniq(resolver.childNodes(this));
29056       var coords = nodes.map(function(n3) {
29057         return n3.loc;
29058       });
29059       var curr = 0;
29060       var prev = 0;
29061       for (var i3 = 0; i3 < coords.length; i3++) {
29062         var o2 = coords[(i3 + 1) % coords.length];
29063         var a2 = coords[i3];
29064         var b2 = coords[(i3 + 2) % coords.length];
29065         var res = geoVecCross(a2, b2, o2);
29066         curr = res > 0 ? 1 : res < 0 ? -1 : 0;
29067         if (curr === 0) {
29068           continue;
29069         } else if (prev && curr !== prev) {
29070           return false;
29071         }
29072         prev = curr;
29073       }
29074       return true;
29075     },
29076     // returns an object with the tag that implies this is an area, if any
29077     tagSuggestingArea: function() {
29078       return osmTagSuggestingArea(this.tags);
29079     },
29080     isArea: function() {
29081       if (this.tags.area === "yes")
29082         return true;
29083       if (!this.isClosed() || this.tags.area === "no")
29084         return false;
29085       return this.tagSuggestingArea() !== null;
29086     },
29087     isDegenerate: function() {
29088       return new Set(this.nodes).size < (this.isArea() ? 3 : 2);
29089     },
29090     areAdjacent: function(n1, n22) {
29091       for (var i3 = 0; i3 < this.nodes.length; i3++) {
29092         if (this.nodes[i3] === n1) {
29093           if (this.nodes[i3 - 1] === n22)
29094             return true;
29095           if (this.nodes[i3 + 1] === n22)
29096             return true;
29097         }
29098       }
29099       return false;
29100     },
29101     geometry: function(graph) {
29102       return graph.transient(this, "geometry", function() {
29103         return this.isArea() ? "area" : "line";
29104       });
29105     },
29106     // returns an array of objects representing the segments between the nodes in this way
29107     segments: function(graph) {
29108       function segmentExtent(graph2) {
29109         var n1 = graph2.hasEntity(this.nodes[0]);
29110         var n22 = graph2.hasEntity(this.nodes[1]);
29111         return n1 && n22 && geoExtent([
29112           [
29113             Math.min(n1.loc[0], n22.loc[0]),
29114             Math.min(n1.loc[1], n22.loc[1])
29115           ],
29116           [
29117             Math.max(n1.loc[0], n22.loc[0]),
29118             Math.max(n1.loc[1], n22.loc[1])
29119           ]
29120         ]);
29121       }
29122       return graph.transient(this, "segments", function() {
29123         var segments = [];
29124         for (var i3 = 0; i3 < this.nodes.length - 1; i3++) {
29125           segments.push({
29126             id: this.id + "-" + i3,
29127             wayId: this.id,
29128             index: i3,
29129             nodes: [this.nodes[i3], this.nodes[i3 + 1]],
29130             extent: segmentExtent
29131           });
29132         }
29133         return segments;
29134       });
29135     },
29136     // If this way is not closed, append the beginning node to the end of the nodelist to close it.
29137     close: function() {
29138       if (this.isClosed() || !this.nodes.length)
29139         return this;
29140       var nodes = this.nodes.slice();
29141       nodes = nodes.filter(noRepeatNodes);
29142       nodes.push(nodes[0]);
29143       return this.update({ nodes });
29144     },
29145     // If this way is closed, remove any connector nodes from the end of the nodelist to unclose it.
29146     unclose: function() {
29147       if (!this.isClosed())
29148         return this;
29149       var nodes = this.nodes.slice();
29150       var connector = this.first();
29151       var i3 = nodes.length - 1;
29152       while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
29153         nodes.splice(i3, 1);
29154         i3 = nodes.length - 1;
29155       }
29156       nodes = nodes.filter(noRepeatNodes);
29157       return this.update({ nodes });
29158     },
29159     // Adds a node (id) in front of the node which is currently at position index.
29160     // If index is undefined, the node will be added to the end of the way for linear ways,
29161     //   or just before the final connecting node for circular ways.
29162     // Consecutive duplicates are eliminated including existing ones.
29163     // Circularity is always preserved when adding a node.
29164     addNode: function(id2, index) {
29165       var nodes = this.nodes.slice();
29166       var isClosed = this.isClosed();
29167       var max3 = isClosed ? nodes.length - 1 : nodes.length;
29168       if (index === void 0) {
29169         index = max3;
29170       }
29171       if (index < 0 || index > max3) {
29172         throw new RangeError("index " + index + " out of range 0.." + max3);
29173       }
29174       if (isClosed) {
29175         var connector = this.first();
29176         var i3 = 1;
29177         while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
29178           nodes.splice(i3, 1);
29179           if (index > i3)
29180             index--;
29181         }
29182         i3 = nodes.length - 1;
29183         while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
29184           nodes.splice(i3, 1);
29185           if (index > i3)
29186             index--;
29187           i3 = nodes.length - 1;
29188         }
29189       }
29190       nodes.splice(index, 0, id2);
29191       nodes = nodes.filter(noRepeatNodes);
29192       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29193         nodes.push(nodes[0]);
29194       }
29195       return this.update({ nodes });
29196     },
29197     // Replaces the node which is currently at position index with the given node (id).
29198     // Consecutive duplicates are eliminated including existing ones.
29199     // Circularity is preserved when updating a node.
29200     updateNode: function(id2, index) {
29201       var nodes = this.nodes.slice();
29202       var isClosed = this.isClosed();
29203       var max3 = nodes.length - 1;
29204       if (index === void 0 || index < 0 || index > max3) {
29205         throw new RangeError("index " + index + " out of range 0.." + max3);
29206       }
29207       if (isClosed) {
29208         var connector = this.first();
29209         var i3 = 1;
29210         while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
29211           nodes.splice(i3, 1);
29212           if (index > i3)
29213             index--;
29214         }
29215         i3 = nodes.length - 1;
29216         while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
29217           nodes.splice(i3, 1);
29218           if (index === i3)
29219             index = 0;
29220           i3 = nodes.length - 1;
29221         }
29222       }
29223       nodes.splice(index, 1, id2);
29224       nodes = nodes.filter(noRepeatNodes);
29225       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29226         nodes.push(nodes[0]);
29227       }
29228       return this.update({ nodes });
29229     },
29230     // Replaces each occurrence of node id needle with replacement.
29231     // Consecutive duplicates are eliminated including existing ones.
29232     // Circularity is preserved.
29233     replaceNode: function(needleID, replacementID) {
29234       var nodes = this.nodes.slice();
29235       var isClosed = this.isClosed();
29236       for (var i3 = 0; i3 < nodes.length; i3++) {
29237         if (nodes[i3] === needleID) {
29238           nodes[i3] = replacementID;
29239         }
29240       }
29241       nodes = nodes.filter(noRepeatNodes);
29242       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29243         nodes.push(nodes[0]);
29244       }
29245       return this.update({ nodes });
29246     },
29247     // Removes each occurrence of node id.
29248     // Consecutive duplicates are eliminated including existing ones.
29249     // Circularity is preserved.
29250     removeNode: function(id2) {
29251       var nodes = this.nodes.slice();
29252       var isClosed = this.isClosed();
29253       nodes = nodes.filter(function(node) {
29254         return node !== id2;
29255       }).filter(noRepeatNodes);
29256       if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29257         nodes.push(nodes[0]);
29258       }
29259       return this.update({ nodes });
29260     },
29261     asJXON: function(changeset_id) {
29262       var r2 = {
29263         way: {
29264           "@id": this.osmId(),
29265           "@version": this.version || 0,
29266           nd: this.nodes.map(function(id2) {
29267             return { keyAttributes: { ref: osmEntity.id.toOSM(id2) } };
29268           }, this),
29269           tag: Object.keys(this.tags).map(function(k2) {
29270             return { keyAttributes: { k: k2, v: this.tags[k2] } };
29271           }, this)
29272         }
29273       };
29274       if (changeset_id) {
29275         r2.way["@changeset"] = changeset_id;
29276       }
29277       return r2;
29278     },
29279     asGeoJSON: function(resolver) {
29280       return resolver.transient(this, "GeoJSON", function() {
29281         var coordinates = resolver.childNodes(this).map(function(n3) {
29282           return n3.loc;
29283         });
29284         if (this.isArea() && this.isClosed()) {
29285           return {
29286             type: "Polygon",
29287             coordinates: [coordinates]
29288           };
29289         } else {
29290           return {
29291             type: "LineString",
29292             coordinates
29293           };
29294         }
29295       });
29296     },
29297     area: function(resolver) {
29298       return resolver.transient(this, "area", function() {
29299         var nodes = resolver.childNodes(this);
29300         var json = {
29301           type: "Polygon",
29302           coordinates: [nodes.map(function(n3) {
29303             return n3.loc;
29304           })]
29305         };
29306         if (!this.isClosed() && nodes.length) {
29307           json.coordinates[0].push(nodes[0].loc);
29308         }
29309         var area = area_default(json);
29310         if (area > 2 * Math.PI) {
29311           json.coordinates[0] = json.coordinates[0].reverse();
29312           area = area_default(json);
29313         }
29314         return isNaN(area) ? 0 : area;
29315       });
29316     }
29317   });
29318   function noRepeatNodes(node, i3, arr) {
29319     return i3 === 0 || node !== arr[i3 - 1];
29320   }
29321
29322   // modules/osm/multipolygon.js
29323   function osmOldMultipolygonOuterMemberOfRelation(entity, graph) {
29324     if (entity.type !== "relation" || !entity.isMultipolygon() || Object.keys(entity.tags).filter(osmIsInterestingTag).length > 1) {
29325       return false;
29326     }
29327     var outerMember;
29328     for (var memberIndex in entity.members) {
29329       var member = entity.members[memberIndex];
29330       if (!member.role || member.role === "outer") {
29331         if (outerMember)
29332           return false;
29333         if (member.type !== "way")
29334           return false;
29335         if (!graph.hasEntity(member.id))
29336           return false;
29337         outerMember = graph.entity(member.id);
29338         if (Object.keys(outerMember.tags).filter(osmIsInterestingTag).length === 0) {
29339           return false;
29340         }
29341       }
29342     }
29343     return outerMember;
29344   }
29345   function osmIsOldMultipolygonOuterMember(entity, graph) {
29346     if (entity.type !== "way" || Object.keys(entity.tags).filter(osmIsInterestingTag).length === 0) {
29347       return false;
29348     }
29349     var parents = graph.parentRelations(entity);
29350     if (parents.length !== 1)
29351       return false;
29352     var parent = parents[0];
29353     if (!parent.isMultipolygon() || Object.keys(parent.tags).filter(osmIsInterestingTag).length > 1) {
29354       return false;
29355     }
29356     var members = parent.members, member;
29357     for (var i3 = 0; i3 < members.length; i3++) {
29358       member = members[i3];
29359       if (member.id === entity.id && member.role && member.role !== "outer") {
29360         return false;
29361       }
29362       if (member.id !== entity.id && (!member.role || member.role === "outer")) {
29363         return false;
29364       }
29365     }
29366     return parent;
29367   }
29368   function osmOldMultipolygonOuterMember(entity, graph) {
29369     if (entity.type !== "way")
29370       return false;
29371     var parents = graph.parentRelations(entity);
29372     if (parents.length !== 1)
29373       return false;
29374     var parent = parents[0];
29375     if (!parent.isMultipolygon() || Object.keys(parent.tags).filter(osmIsInterestingTag).length > 1) {
29376       return false;
29377     }
29378     var members = parent.members, member, outerMember;
29379     for (var i3 = 0; i3 < members.length; i3++) {
29380       member = members[i3];
29381       if (!member.role || member.role === "outer") {
29382         if (outerMember)
29383           return false;
29384         outerMember = member;
29385       }
29386     }
29387     if (!outerMember)
29388       return false;
29389     var outerEntity = graph.hasEntity(outerMember.id);
29390     if (!outerEntity || !Object.keys(outerEntity.tags).filter(osmIsInterestingTag).length) {
29391       return false;
29392     }
29393     return outerEntity;
29394   }
29395   function osmJoinWays(toJoin, graph) {
29396     function resolve(member) {
29397       return graph.childNodes(graph.entity(member.id));
29398     }
29399     function reverse(item2) {
29400       var action = actionReverse(item2.id, { reverseOneway: true });
29401       sequences.actions.push(action);
29402       return item2 instanceof osmWay ? action(graph).entity(item2.id) : item2;
29403     }
29404     toJoin = toJoin.filter(function(member) {
29405       return member.type === "way" && graph.hasEntity(member.id);
29406     });
29407     var i3;
29408     var joinAsMembers = true;
29409     for (i3 = 0; i3 < toJoin.length; i3++) {
29410       if (toJoin[i3] instanceof osmWay) {
29411         joinAsMembers = false;
29412         break;
29413       }
29414     }
29415     var sequences = [];
29416     sequences.actions = [];
29417     while (toJoin.length) {
29418       var item = toJoin.shift();
29419       var currWays = [item];
29420       var currNodes = resolve(item).slice();
29421       while (toJoin.length) {
29422         var start2 = currNodes[0];
29423         var end = currNodes[currNodes.length - 1];
29424         var fn = null;
29425         var nodes = null;
29426         for (i3 = 0; i3 < toJoin.length; i3++) {
29427           item = toJoin[i3];
29428           nodes = resolve(item);
29429           if (joinAsMembers && currWays.length === 1 && nodes[0] !== end && nodes[nodes.length - 1] !== end && (nodes[nodes.length - 1] === start2 || nodes[0] === start2)) {
29430             currWays[0] = reverse(currWays[0]);
29431             currNodes.reverse();
29432             start2 = currNodes[0];
29433             end = currNodes[currNodes.length - 1];
29434           }
29435           if (nodes[0] === end) {
29436             fn = currNodes.push;
29437             nodes = nodes.slice(1);
29438             break;
29439           } else if (nodes[nodes.length - 1] === end) {
29440             fn = currNodes.push;
29441             nodes = nodes.slice(0, -1).reverse();
29442             item = reverse(item);
29443             break;
29444           } else if (nodes[nodes.length - 1] === start2) {
29445             fn = currNodes.unshift;
29446             nodes = nodes.slice(0, -1);
29447             break;
29448           } else if (nodes[0] === start2) {
29449             fn = currNodes.unshift;
29450             nodes = nodes.slice(1).reverse();
29451             item = reverse(item);
29452             break;
29453           } else {
29454             fn = nodes = null;
29455           }
29456         }
29457         if (!nodes) {
29458           break;
29459         }
29460         fn.apply(currWays, [item]);
29461         fn.apply(currNodes, nodes);
29462         toJoin.splice(i3, 1);
29463       }
29464       currWays.nodes = currNodes;
29465       sequences.push(currWays);
29466     }
29467     return sequences;
29468   }
29469
29470   // modules/actions/add_member.js
29471   function actionAddMember(relationId, member, memberIndex, insertPair) {
29472     return function action(graph) {
29473       var relation = graph.entity(relationId);
29474       var isPTv2 = /stop|platform/.test(member.role);
29475       if ((isNaN(memberIndex) || insertPair) && member.type === "way" && !isPTv2) {
29476         graph = addWayMember(relation, graph);
29477       } else {
29478         if (isPTv2 && isNaN(memberIndex)) {
29479           memberIndex = 0;
29480         }
29481         graph = graph.replace(relation.addMember(member, memberIndex));
29482       }
29483       return graph;
29484     };
29485     function addWayMember(relation, graph) {
29486       var groups, tempWay, insertPairIsReversed, item, i3, j3, k2;
29487       var PTv2members = [];
29488       var members = [];
29489       for (i3 = 0; i3 < relation.members.length; i3++) {
29490         var m2 = relation.members[i3];
29491         if (/stop|platform/.test(m2.role)) {
29492           PTv2members.push(m2);
29493         } else {
29494           members.push(m2);
29495         }
29496       }
29497       relation = relation.update({ members });
29498       if (insertPair) {
29499         tempWay = osmWay({ id: "wTemp", nodes: insertPair.nodes });
29500         graph = graph.replace(tempWay);
29501         var tempMember = { id: tempWay.id, type: "way", role: member.role };
29502         var tempRelation = relation.replaceMember({ id: insertPair.originalID }, tempMember, true);
29503         groups = utilArrayGroupBy(tempRelation.members, "type");
29504         groups.way = groups.way || [];
29505         var originalWay = graph.entity(insertPair.originalID);
29506         var insertedWay = graph.entity(insertPair.insertedID);
29507         insertPairIsReversed = originalWay.nodes.length > 0 && insertedWay.nodes.length > 0 && insertedWay.nodes[insertedWay.nodes.length - 1] === originalWay.nodes[0] && originalWay.nodes[originalWay.nodes.length - 1] !== insertedWay.nodes[0];
29508       } else {
29509         groups = utilArrayGroupBy(relation.members, "type");
29510         groups.way = groups.way || [];
29511         groups.way.push(member);
29512       }
29513       members = withIndex(groups.way);
29514       var joined = osmJoinWays(members, graph);
29515       for (i3 = 0; i3 < joined.length; i3++) {
29516         var segment = joined[i3];
29517         var nodes = segment.nodes.slice();
29518         var startIndex = segment[0].index;
29519         for (j3 = 0; j3 < members.length; j3++) {
29520           if (members[j3].index === startIndex) {
29521             break;
29522           }
29523         }
29524         for (k2 = 0; k2 < segment.length; k2++) {
29525           item = segment[k2];
29526           var way = graph.entity(item.id);
29527           if (tempWay && item.id === tempWay.id) {
29528             var reverse = nodes[0].id !== insertPair.nodes[0] ^ insertPairIsReversed;
29529             if (reverse) {
29530               item.pair = [
29531                 { id: insertPair.insertedID, type: "way", role: item.role },
29532                 { id: insertPair.originalID, type: "way", role: item.role }
29533               ];
29534             } else {
29535               item.pair = [
29536                 { id: insertPair.originalID, type: "way", role: item.role },
29537                 { id: insertPair.insertedID, type: "way", role: item.role }
29538               ];
29539             }
29540           }
29541           if (k2 > 0) {
29542             if (j3 + k2 >= members.length || item.index !== members[j3 + k2].index) {
29543               moveMember(members, item.index, j3 + k2);
29544             }
29545           }
29546           nodes.splice(0, way.nodes.length - 1);
29547         }
29548       }
29549       if (tempWay) {
29550         graph = graph.remove(tempWay);
29551       }
29552       var wayMembers = [];
29553       for (i3 = 0; i3 < members.length; i3++) {
29554         item = members[i3];
29555         if (item.index === -1)
29556           continue;
29557         if (item.pair) {
29558           wayMembers.push(item.pair[0]);
29559           wayMembers.push(item.pair[1]);
29560         } else {
29561           wayMembers.push(utilObjectOmit(item, ["index"]));
29562         }
29563       }
29564       var newMembers = PTv2members.concat(groups.node || [], wayMembers, groups.relation || []);
29565       return graph.replace(relation.update({ members: newMembers }));
29566       function moveMember(arr, findIndex, toIndex) {
29567         var i4;
29568         for (i4 = 0; i4 < arr.length; i4++) {
29569           if (arr[i4].index === findIndex) {
29570             break;
29571           }
29572         }
29573         var item2 = Object.assign({}, arr[i4]);
29574         arr[i4].index = -1;
29575         item2.index = toIndex;
29576         arr.splice(toIndex, 0, item2);
29577       }
29578       function withIndex(arr) {
29579         var result = new Array(arr.length);
29580         for (var i4 = 0; i4 < arr.length; i4++) {
29581           result[i4] = Object.assign({}, arr[i4]);
29582           result[i4].index = i4;
29583         }
29584         return result;
29585       }
29586     }
29587   }
29588
29589   // modules/actions/add_midpoint.js
29590   function actionAddMidpoint(midpoint, node) {
29591     return function(graph) {
29592       graph = graph.replace(node.move(midpoint.loc));
29593       var parents = utilArrayIntersection(
29594         graph.parentWays(graph.entity(midpoint.edge[0])),
29595         graph.parentWays(graph.entity(midpoint.edge[1]))
29596       );
29597       parents.forEach(function(way) {
29598         for (var i3 = 0; i3 < way.nodes.length - 1; i3++) {
29599           if (geoEdgeEqual([way.nodes[i3], way.nodes[i3 + 1]], midpoint.edge)) {
29600             graph = graph.replace(graph.entity(way.id).addNode(node.id, i3 + 1));
29601             return;
29602           }
29603         }
29604       });
29605       return graph;
29606     };
29607   }
29608
29609   // modules/actions/add_vertex.js
29610   function actionAddVertex(wayId, nodeId, index) {
29611     return function(graph) {
29612       return graph.replace(graph.entity(wayId).addNode(nodeId, index));
29613     };
29614   }
29615
29616   // modules/actions/change_member.js
29617   function actionChangeMember(relationId, member, memberIndex) {
29618     return function(graph) {
29619       return graph.replace(graph.entity(relationId).updateMember(member, memberIndex));
29620     };
29621   }
29622
29623   // modules/actions/change_preset.js
29624   function actionChangePreset(entityID, oldPreset, newPreset, skipFieldDefaults) {
29625     return function action(graph) {
29626       var entity = graph.entity(entityID);
29627       var geometry = entity.geometry(graph);
29628       var tags = entity.tags;
29629       const loc = entity.extent(graph).center();
29630       var preserveKeys;
29631       if (newPreset) {
29632         preserveKeys = [];
29633         if (newPreset.addTags) {
29634           preserveKeys = preserveKeys.concat(Object.keys(newPreset.addTags));
29635         }
29636         if (oldPreset && !oldPreset.id.startsWith(newPreset.id)) {
29637           newPreset.fields(loc).concat(newPreset.moreFields(loc)).filter((f3) => f3.matchGeometry(geometry)).map((f3) => f3.key).filter(Boolean).forEach((key) => preserveKeys.push(key));
29638         }
29639       }
29640       if (oldPreset)
29641         tags = oldPreset.unsetTags(tags, geometry, preserveKeys, false, loc);
29642       if (newPreset)
29643         tags = newPreset.setTags(tags, geometry, skipFieldDefaults, loc);
29644       return graph.replace(entity.update({ tags }));
29645     };
29646   }
29647
29648   // modules/actions/change_tags.js
29649   function actionChangeTags(entityId, tags) {
29650     return function(graph) {
29651       var entity = graph.entity(entityId);
29652       return graph.replace(entity.update({ tags }));
29653     };
29654   }
29655
29656   // modules/osm/node.js
29657   var cardinal = {
29658     north: 0,
29659     n: 0,
29660     northnortheast: 22,
29661     nne: 22,
29662     northeast: 45,
29663     ne: 45,
29664     eastnortheast: 67,
29665     ene: 67,
29666     east: 90,
29667     e: 90,
29668     eastsoutheast: 112,
29669     ese: 112,
29670     southeast: 135,
29671     se: 135,
29672     southsoutheast: 157,
29673     sse: 157,
29674     south: 180,
29675     s: 180,
29676     southsouthwest: 202,
29677     ssw: 202,
29678     southwest: 225,
29679     sw: 225,
29680     westsouthwest: 247,
29681     wsw: 247,
29682     west: 270,
29683     w: 270,
29684     westnorthwest: 292,
29685     wnw: 292,
29686     northwest: 315,
29687     nw: 315,
29688     northnorthwest: 337,
29689     nnw: 337
29690   };
29691   function osmNode() {
29692     if (!(this instanceof osmNode)) {
29693       return new osmNode().initialize(arguments);
29694     } else if (arguments.length) {
29695       this.initialize(arguments);
29696     }
29697   }
29698   osmEntity.node = osmNode;
29699   osmNode.prototype = Object.create(osmEntity.prototype);
29700   Object.assign(osmNode.prototype, {
29701     type: "node",
29702     loc: [9999, 9999],
29703     extent: function() {
29704       return new geoExtent(this.loc);
29705     },
29706     geometry: function(graph) {
29707       return graph.transient(this, "geometry", function() {
29708         return graph.isPoi(this) ? "point" : "vertex";
29709       });
29710     },
29711     move: function(loc) {
29712       return this.update({ loc });
29713     },
29714     isDegenerate: function() {
29715       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);
29716     },
29717     // Inspect tags and geometry to determine which direction(s) this node/vertex points
29718     directions: function(resolver, projection2) {
29719       var val;
29720       var i3;
29721       if (this.isHighwayIntersection(resolver) && (this.tags.stop || "").toLowerCase() === "all") {
29722         val = "all";
29723       } else {
29724         val = (this.tags.direction || "").toLowerCase();
29725         var re3 = /:direction$/i;
29726         var keys2 = Object.keys(this.tags);
29727         for (i3 = 0; i3 < keys2.length; i3++) {
29728           if (re3.test(keys2[i3])) {
29729             val = this.tags[keys2[i3]].toLowerCase();
29730             break;
29731           }
29732         }
29733       }
29734       if (val === "")
29735         return [];
29736       var values = val.split(";");
29737       var results = [];
29738       values.forEach(function(v2) {
29739         if (cardinal[v2] !== void 0) {
29740           v2 = cardinal[v2];
29741         }
29742         if (v2 !== "" && !isNaN(+v2)) {
29743           results.push(+v2);
29744           return;
29745         }
29746         var lookBackward = this.tags["traffic_sign:backward"] || v2 === "backward" || v2 === "both" || v2 === "all";
29747         var lookForward = this.tags["traffic_sign:forward"] || v2 === "forward" || v2 === "both" || v2 === "all";
29748         if (!lookForward && !lookBackward)
29749           return;
29750         var nodeIds = {};
29751         resolver.parentWays(this).forEach(function(parent) {
29752           var nodes = parent.nodes;
29753           for (i3 = 0; i3 < nodes.length; i3++) {
29754             if (nodes[i3] === this.id) {
29755               if (lookForward && i3 > 0) {
29756                 nodeIds[nodes[i3 - 1]] = true;
29757               }
29758               if (lookBackward && i3 < nodes.length - 1) {
29759                 nodeIds[nodes[i3 + 1]] = true;
29760               }
29761             }
29762           }
29763         }, this);
29764         Object.keys(nodeIds).forEach(function(nodeId) {
29765           results.push(
29766             geoAngle(this, resolver.entity(nodeId), projection2) * (180 / Math.PI) + 90
29767           );
29768         }, this);
29769       }, this);
29770       return utilArrayUniq(results);
29771     },
29772     isCrossing: function() {
29773       return this.tags.highway === "crossing" || this.tags.railway && this.tags.railway.indexOf("crossing") !== -1;
29774     },
29775     isEndpoint: function(resolver) {
29776       return resolver.transient(this, "isEndpoint", function() {
29777         var id2 = this.id;
29778         return resolver.parentWays(this).filter(function(parent) {
29779           return !parent.isClosed() && !!parent.affix(id2);
29780         }).length > 0;
29781       });
29782     },
29783     isConnected: function(resolver) {
29784       return resolver.transient(this, "isConnected", function() {
29785         var parents = resolver.parentWays(this);
29786         if (parents.length > 1) {
29787           for (var i3 in parents) {
29788             if (parents[i3].geometry(resolver) === "line" && parents[i3].hasInterestingTags())
29789               return true;
29790           }
29791         } else if (parents.length === 1) {
29792           var way = parents[0];
29793           var nodes = way.nodes.slice();
29794           if (way.isClosed()) {
29795             nodes.pop();
29796           }
29797           return nodes.indexOf(this.id) !== nodes.lastIndexOf(this.id);
29798         }
29799         return false;
29800       });
29801     },
29802     parentIntersectionWays: function(resolver) {
29803       return resolver.transient(this, "parentIntersectionWays", function() {
29804         return resolver.parentWays(this).filter(function(parent) {
29805           return (parent.tags.highway || parent.tags.waterway || parent.tags.railway || parent.tags.aeroway) && parent.geometry(resolver) === "line";
29806         });
29807       });
29808     },
29809     isIntersection: function(resolver) {
29810       return this.parentIntersectionWays(resolver).length > 1;
29811     },
29812     isHighwayIntersection: function(resolver) {
29813       return resolver.transient(this, "isHighwayIntersection", function() {
29814         return resolver.parentWays(this).filter(function(parent) {
29815           return parent.tags.highway && parent.geometry(resolver) === "line";
29816         }).length > 1;
29817       });
29818     },
29819     isOnAddressLine: function(resolver) {
29820       return resolver.transient(this, "isOnAddressLine", function() {
29821         return resolver.parentWays(this).filter(function(parent) {
29822           return parent.tags.hasOwnProperty("addr:interpolation") && parent.geometry(resolver) === "line";
29823         }).length > 0;
29824       });
29825     },
29826     asJXON: function(changeset_id) {
29827       var r2 = {
29828         node: {
29829           "@id": this.osmId(),
29830           "@lon": this.loc[0],
29831           "@lat": this.loc[1],
29832           "@version": this.version || 0,
29833           tag: Object.keys(this.tags).map(function(k2) {
29834             return { keyAttributes: { k: k2, v: this.tags[k2] } };
29835           }, this)
29836         }
29837       };
29838       if (changeset_id)
29839         r2.node["@changeset"] = changeset_id;
29840       return r2;
29841     },
29842     asGeoJSON: function() {
29843       return {
29844         type: "Point",
29845         coordinates: this.loc
29846       };
29847     }
29848   });
29849
29850   // modules/actions/circularize.js
29851   function actionCircularize(wayId, projection2, maxAngle) {
29852     maxAngle = (maxAngle || 20) * Math.PI / 180;
29853     var action = function(graph, t2) {
29854       if (t2 === null || !isFinite(t2))
29855         t2 = 1;
29856       t2 = Math.min(Math.max(+t2, 0), 1);
29857       var way = graph.entity(wayId);
29858       var origNodes = {};
29859       graph.childNodes(way).forEach(function(node2) {
29860         if (!origNodes[node2.id])
29861           origNodes[node2.id] = node2;
29862       });
29863       if (!way.isConvex(graph)) {
29864         graph = action.makeConvex(graph);
29865       }
29866       var nodes = utilArrayUniq(graph.childNodes(way));
29867       var keyNodes = nodes.filter(function(n3) {
29868         return graph.parentWays(n3).length !== 1;
29869       });
29870       var points = nodes.map(function(n3) {
29871         return projection2(n3.loc);
29872       });
29873       var keyPoints = keyNodes.map(function(n3) {
29874         return projection2(n3.loc);
29875       });
29876       var centroid = points.length === 2 ? geoVecInterp(points[0], points[1], 0.5) : centroid_default2(points);
29877       var radius = median(points, function(p2) {
29878         return geoVecLength(centroid, p2);
29879       });
29880       var sign2 = area_default3(points) > 0 ? 1 : -1;
29881       var ids, i3, j3, k2;
29882       if (!keyNodes.length) {
29883         keyNodes = [nodes[0]];
29884         keyPoints = [points[0]];
29885       }
29886       if (keyNodes.length === 1) {
29887         var index = nodes.indexOf(keyNodes[0]);
29888         var oppositeIndex = Math.floor((index + nodes.length / 2) % nodes.length);
29889         keyNodes.push(nodes[oppositeIndex]);
29890         keyPoints.push(points[oppositeIndex]);
29891       }
29892       for (i3 = 0; i3 < keyPoints.length; i3++) {
29893         var nextKeyNodeIndex = (i3 + 1) % keyNodes.length;
29894         var startNode = keyNodes[i3];
29895         var endNode = keyNodes[nextKeyNodeIndex];
29896         var startNodeIndex = nodes.indexOf(startNode);
29897         var endNodeIndex = nodes.indexOf(endNode);
29898         var numberNewPoints = -1;
29899         var indexRange = endNodeIndex - startNodeIndex;
29900         var nearNodes = {};
29901         var inBetweenNodes = [];
29902         var startAngle, endAngle, totalAngle, eachAngle;
29903         var angle2, loc, node, origNode;
29904         if (indexRange < 0) {
29905           indexRange += nodes.length;
29906         }
29907         var distance = geoVecLength(centroid, keyPoints[i3]) || 1e-4;
29908         keyPoints[i3] = [
29909           centroid[0] + (keyPoints[i3][0] - centroid[0]) / distance * radius,
29910           centroid[1] + (keyPoints[i3][1] - centroid[1]) / distance * radius
29911         ];
29912         loc = projection2.invert(keyPoints[i3]);
29913         node = keyNodes[i3];
29914         origNode = origNodes[node.id];
29915         node = node.move(geoVecInterp(origNode.loc, loc, t2));
29916         graph = graph.replace(node);
29917         startAngle = Math.atan2(keyPoints[i3][1] - centroid[1], keyPoints[i3][0] - centroid[0]);
29918         endAngle = Math.atan2(keyPoints[nextKeyNodeIndex][1] - centroid[1], keyPoints[nextKeyNodeIndex][0] - centroid[0]);
29919         totalAngle = endAngle - startAngle;
29920         if (totalAngle * sign2 > 0) {
29921           totalAngle = -sign2 * (2 * Math.PI - Math.abs(totalAngle));
29922         }
29923         do {
29924           numberNewPoints++;
29925           eachAngle = totalAngle / (indexRange + numberNewPoints);
29926         } while (Math.abs(eachAngle) > maxAngle);
29927         for (j3 = 1; j3 < indexRange; j3++) {
29928           angle2 = startAngle + j3 * eachAngle;
29929           loc = projection2.invert([
29930             centroid[0] + Math.cos(angle2) * radius,
29931             centroid[1] + Math.sin(angle2) * radius
29932           ]);
29933           node = nodes[(j3 + startNodeIndex) % nodes.length];
29934           origNode = origNodes[node.id];
29935           nearNodes[node.id] = angle2;
29936           node = node.move(geoVecInterp(origNode.loc, loc, t2));
29937           graph = graph.replace(node);
29938         }
29939         for (j3 = 0; j3 < numberNewPoints; j3++) {
29940           angle2 = startAngle + (indexRange + j3) * eachAngle;
29941           loc = projection2.invert([
29942             centroid[0] + Math.cos(angle2) * radius,
29943             centroid[1] + Math.sin(angle2) * radius
29944           ]);
29945           var min3 = Infinity;
29946           for (var nodeId in nearNodes) {
29947             var nearAngle = nearNodes[nodeId];
29948             var dist = Math.abs(nearAngle - angle2);
29949             if (dist < min3) {
29950               min3 = dist;
29951               origNode = origNodes[nodeId];
29952             }
29953           }
29954           node = osmNode({ loc: geoVecInterp(origNode.loc, loc, t2) });
29955           graph = graph.replace(node);
29956           nodes.splice(endNodeIndex + j3, 0, node);
29957           inBetweenNodes.push(node.id);
29958         }
29959         if (indexRange === 1 && inBetweenNodes.length) {
29960           var startIndex1 = way.nodes.lastIndexOf(startNode.id);
29961           var endIndex1 = way.nodes.lastIndexOf(endNode.id);
29962           var wayDirection1 = endIndex1 - startIndex1;
29963           if (wayDirection1 < -1) {
29964             wayDirection1 = 1;
29965           }
29966           var parentWays = graph.parentWays(keyNodes[i3]);
29967           for (j3 = 0; j3 < parentWays.length; j3++) {
29968             var sharedWay = parentWays[j3];
29969             if (sharedWay === way)
29970               continue;
29971             if (sharedWay.areAdjacent(startNode.id, endNode.id)) {
29972               var startIndex2 = sharedWay.nodes.lastIndexOf(startNode.id);
29973               var endIndex2 = sharedWay.nodes.lastIndexOf(endNode.id);
29974               var wayDirection2 = endIndex2 - startIndex2;
29975               var insertAt = endIndex2;
29976               if (wayDirection2 < -1) {
29977                 wayDirection2 = 1;
29978               }
29979               if (wayDirection1 !== wayDirection2) {
29980                 inBetweenNodes.reverse();
29981                 insertAt = startIndex2;
29982               }
29983               for (k2 = 0; k2 < inBetweenNodes.length; k2++) {
29984                 sharedWay = sharedWay.addNode(inBetweenNodes[k2], insertAt + k2);
29985               }
29986               graph = graph.replace(sharedWay);
29987             }
29988           }
29989         }
29990       }
29991       ids = nodes.map(function(n3) {
29992         return n3.id;
29993       });
29994       ids.push(ids[0]);
29995       way = way.update({ nodes: ids });
29996       graph = graph.replace(way);
29997       return graph;
29998     };
29999     action.makeConvex = function(graph) {
30000       var way = graph.entity(wayId);
30001       var nodes = utilArrayUniq(graph.childNodes(way));
30002       var points = nodes.map(function(n3) {
30003         return projection2(n3.loc);
30004       });
30005       var sign2 = area_default3(points) > 0 ? 1 : -1;
30006       var hull = hull_default(points);
30007       var i3, j3;
30008       if (sign2 === -1) {
30009         nodes.reverse();
30010         points.reverse();
30011       }
30012       for (i3 = 0; i3 < hull.length - 1; i3++) {
30013         var startIndex = points.indexOf(hull[i3]);
30014         var endIndex = points.indexOf(hull[i3 + 1]);
30015         var indexRange = endIndex - startIndex;
30016         if (indexRange < 0) {
30017           indexRange += nodes.length;
30018         }
30019         for (j3 = 1; j3 < indexRange; j3++) {
30020           var point2 = geoVecInterp(hull[i3], hull[i3 + 1], j3 / indexRange);
30021           var node = nodes[(j3 + startIndex) % nodes.length].move(projection2.invert(point2));
30022           graph = graph.replace(node);
30023         }
30024       }
30025       return graph;
30026     };
30027     action.disabled = function(graph) {
30028       if (!graph.entity(wayId).isClosed()) {
30029         return "not_closed";
30030       }
30031       var way = graph.entity(wayId);
30032       var nodes = utilArrayUniq(graph.childNodes(way));
30033       var points = nodes.map(function(n3) {
30034         return projection2(n3.loc);
30035       });
30036       var hull = hull_default(points);
30037       var epsilonAngle = Math.PI / 180;
30038       if (hull.length !== points.length || hull.length < 3) {
30039         return false;
30040       }
30041       var centroid = centroid_default2(points);
30042       var radius = geoVecLengthSquare(centroid, points[0]);
30043       var i3, actualPoint;
30044       for (i3 = 0; i3 < hull.length; i3++) {
30045         actualPoint = hull[i3];
30046         var actualDist = geoVecLengthSquare(actualPoint, centroid);
30047         var diff = Math.abs(actualDist - radius);
30048         if (diff > 0.05 * radius) {
30049           return false;
30050         }
30051       }
30052       for (i3 = 0; i3 < hull.length; i3++) {
30053         actualPoint = hull[i3];
30054         var nextPoint = hull[(i3 + 1) % hull.length];
30055         var startAngle = Math.atan2(actualPoint[1] - centroid[1], actualPoint[0] - centroid[0]);
30056         var endAngle = Math.atan2(nextPoint[1] - centroid[1], nextPoint[0] - centroid[0]);
30057         var angle2 = endAngle - startAngle;
30058         if (angle2 < 0) {
30059           angle2 = -angle2;
30060         }
30061         if (angle2 > Math.PI) {
30062           angle2 = 2 * Math.PI - angle2;
30063         }
30064         if (angle2 > maxAngle + epsilonAngle) {
30065           return false;
30066         }
30067       }
30068       return "already_circular";
30069     };
30070     action.transitionable = true;
30071     return action;
30072   }
30073
30074   // modules/actions/delete_way.js
30075   function actionDeleteWay(wayID) {
30076     function canDeleteNode(node, graph) {
30077       if (graph.parentWays(node).length || graph.parentRelations(node).length)
30078         return false;
30079       var geometries = osmNodeGeometriesForTags(node.tags);
30080       if (geometries.point)
30081         return false;
30082       if (geometries.vertex)
30083         return true;
30084       return !node.hasInterestingTags();
30085     }
30086     var action = function(graph) {
30087       var way = graph.entity(wayID);
30088       graph.parentRelations(way).forEach(function(parent) {
30089         parent = parent.removeMembersWithID(wayID);
30090         graph = graph.replace(parent);
30091         if (parent.isDegenerate()) {
30092           graph = actionDeleteRelation(parent.id)(graph);
30093         }
30094       });
30095       new Set(way.nodes).forEach(function(nodeID) {
30096         graph = graph.replace(way.removeNode(nodeID));
30097         var node = graph.entity(nodeID);
30098         if (canDeleteNode(node, graph)) {
30099           graph = graph.remove(node);
30100         }
30101       });
30102       return graph.remove(way);
30103     };
30104     return action;
30105   }
30106
30107   // modules/actions/delete_multiple.js
30108   function actionDeleteMultiple(ids) {
30109     var actions = {
30110       way: actionDeleteWay,
30111       node: actionDeleteNode,
30112       relation: actionDeleteRelation
30113     };
30114     var action = function(graph) {
30115       ids.forEach(function(id2) {
30116         if (graph.hasEntity(id2)) {
30117           graph = actions[graph.entity(id2).type](id2)(graph);
30118         }
30119       });
30120       return graph;
30121     };
30122     return action;
30123   }
30124
30125   // modules/actions/delete_relation.js
30126   function actionDeleteRelation(relationID, allowUntaggedMembers) {
30127     function canDeleteEntity(entity, graph) {
30128       return !graph.parentWays(entity).length && !graph.parentRelations(entity).length && (!entity.hasInterestingTags() && !allowUntaggedMembers);
30129     }
30130     var action = function(graph) {
30131       var relation = graph.entity(relationID);
30132       graph.parentRelations(relation).forEach(function(parent) {
30133         parent = parent.removeMembersWithID(relationID);
30134         graph = graph.replace(parent);
30135         if (parent.isDegenerate()) {
30136           graph = actionDeleteRelation(parent.id)(graph);
30137         }
30138       });
30139       var memberIDs = utilArrayUniq(relation.members.map(function(m2) {
30140         return m2.id;
30141       }));
30142       memberIDs.forEach(function(memberID) {
30143         graph = graph.replace(relation.removeMembersWithID(memberID));
30144         var entity = graph.entity(memberID);
30145         if (canDeleteEntity(entity, graph)) {
30146           graph = actionDeleteMultiple([memberID])(graph);
30147         }
30148       });
30149       return graph.remove(relation);
30150     };
30151     return action;
30152   }
30153
30154   // modules/actions/delete_node.js
30155   function actionDeleteNode(nodeId) {
30156     var action = function(graph) {
30157       var node = graph.entity(nodeId);
30158       graph.parentWays(node).forEach(function(parent) {
30159         parent = parent.removeNode(nodeId);
30160         graph = graph.replace(parent);
30161         if (parent.isDegenerate()) {
30162           graph = actionDeleteWay(parent.id)(graph);
30163         }
30164       });
30165       graph.parentRelations(node).forEach(function(parent) {
30166         parent = parent.removeMembersWithID(nodeId);
30167         graph = graph.replace(parent);
30168         if (parent.isDegenerate()) {
30169           graph = actionDeleteRelation(parent.id)(graph);
30170         }
30171       });
30172       return graph.remove(node);
30173     };
30174     return action;
30175   }
30176
30177   // modules/actions/connect.js
30178   function actionConnect(nodeIDs) {
30179     var action = function(graph) {
30180       var survivor;
30181       var node;
30182       var parents;
30183       var i3, j3;
30184       nodeIDs.reverse();
30185       var interestingIDs = [];
30186       for (i3 = 0; i3 < nodeIDs.length; i3++) {
30187         node = graph.entity(nodeIDs[i3]);
30188         if (node.hasInterestingTags()) {
30189           if (!node.isNew()) {
30190             interestingIDs.push(node.id);
30191           }
30192         }
30193       }
30194       survivor = graph.entity(utilOldestID(interestingIDs.length > 0 ? interestingIDs : nodeIDs));
30195       for (i3 = 0; i3 < nodeIDs.length; i3++) {
30196         node = graph.entity(nodeIDs[i3]);
30197         if (node.id === survivor.id)
30198           continue;
30199         parents = graph.parentWays(node);
30200         for (j3 = 0; j3 < parents.length; j3++) {
30201           graph = graph.replace(parents[j3].replaceNode(node.id, survivor.id));
30202         }
30203         parents = graph.parentRelations(node);
30204         for (j3 = 0; j3 < parents.length; j3++) {
30205           graph = graph.replace(parents[j3].replaceMember(node, survivor));
30206         }
30207         survivor = survivor.mergeTags(node.tags);
30208         graph = actionDeleteNode(node.id)(graph);
30209       }
30210       graph = graph.replace(survivor);
30211       parents = graph.parentWays(survivor);
30212       for (i3 = 0; i3 < parents.length; i3++) {
30213         if (parents[i3].isDegenerate()) {
30214           graph = actionDeleteWay(parents[i3].id)(graph);
30215         }
30216       }
30217       return graph;
30218     };
30219     action.disabled = function(graph) {
30220       var seen = {};
30221       var restrictionIDs = [];
30222       var survivor;
30223       var node, way;
30224       var relations, relation, role;
30225       var i3, j3, k2;
30226       survivor = graph.entity(utilOldestID(nodeIDs));
30227       for (i3 = 0; i3 < nodeIDs.length; i3++) {
30228         node = graph.entity(nodeIDs[i3]);
30229         relations = graph.parentRelations(node);
30230         for (j3 = 0; j3 < relations.length; j3++) {
30231           relation = relations[j3];
30232           role = relation.memberById(node.id).role || "";
30233           if (relation.hasFromViaTo()) {
30234             restrictionIDs.push(relation.id);
30235           }
30236           if (seen[relation.id] !== void 0 && seen[relation.id] !== role) {
30237             return "relation";
30238           } else {
30239             seen[relation.id] = role;
30240           }
30241         }
30242       }
30243       for (i3 = 0; i3 < nodeIDs.length; i3++) {
30244         node = graph.entity(nodeIDs[i3]);
30245         var parents = graph.parentWays(node);
30246         for (j3 = 0; j3 < parents.length; j3++) {
30247           var parent = parents[j3];
30248           relations = graph.parentRelations(parent);
30249           for (k2 = 0; k2 < relations.length; k2++) {
30250             relation = relations[k2];
30251             if (relation.hasFromViaTo()) {
30252               restrictionIDs.push(relation.id);
30253             }
30254           }
30255         }
30256       }
30257       restrictionIDs = utilArrayUniq(restrictionIDs);
30258       for (i3 = 0; i3 < restrictionIDs.length; i3++) {
30259         relation = graph.entity(restrictionIDs[i3]);
30260         if (!relation.isComplete(graph))
30261           continue;
30262         var memberWays = relation.members.filter(function(m2) {
30263           return m2.type === "way";
30264         }).map(function(m2) {
30265           return graph.entity(m2.id);
30266         });
30267         memberWays = utilArrayUniq(memberWays);
30268         var f3 = relation.memberByRole("from");
30269         var t2 = relation.memberByRole("to");
30270         var isUturn = f3.id === t2.id;
30271         var nodes = { from: [], via: [], to: [], keyfrom: [], keyto: [] };
30272         for (j3 = 0; j3 < relation.members.length; j3++) {
30273           collectNodes(relation.members[j3], nodes);
30274         }
30275         nodes.keyfrom = utilArrayUniq(nodes.keyfrom.filter(hasDuplicates));
30276         nodes.keyto = utilArrayUniq(nodes.keyto.filter(hasDuplicates));
30277         var filter2 = keyNodeFilter(nodes.keyfrom, nodes.keyto);
30278         nodes.from = nodes.from.filter(filter2);
30279         nodes.via = nodes.via.filter(filter2);
30280         nodes.to = nodes.to.filter(filter2);
30281         var connectFrom = false;
30282         var connectVia = false;
30283         var connectTo = false;
30284         var connectKeyFrom = false;
30285         var connectKeyTo = false;
30286         for (j3 = 0; j3 < nodeIDs.length; j3++) {
30287           var n3 = nodeIDs[j3];
30288           if (nodes.from.indexOf(n3) !== -1) {
30289             connectFrom = true;
30290           }
30291           if (nodes.via.indexOf(n3) !== -1) {
30292             connectVia = true;
30293           }
30294           if (nodes.to.indexOf(n3) !== -1) {
30295             connectTo = true;
30296           }
30297           if (nodes.keyfrom.indexOf(n3) !== -1) {
30298             connectKeyFrom = true;
30299           }
30300           if (nodes.keyto.indexOf(n3) !== -1) {
30301             connectKeyTo = true;
30302           }
30303         }
30304         if (connectFrom && connectTo && !isUturn) {
30305           return "restriction";
30306         }
30307         if (connectFrom && connectVia) {
30308           return "restriction";
30309         }
30310         if (connectTo && connectVia) {
30311           return "restriction";
30312         }
30313         if (connectKeyFrom || connectKeyTo) {
30314           if (nodeIDs.length !== 2) {
30315             return "restriction";
30316           }
30317           var n0 = null;
30318           var n1 = null;
30319           for (j3 = 0; j3 < memberWays.length; j3++) {
30320             way = memberWays[j3];
30321             if (way.contains(nodeIDs[0])) {
30322               n0 = nodeIDs[0];
30323             }
30324             if (way.contains(nodeIDs[1])) {
30325               n1 = nodeIDs[1];
30326             }
30327           }
30328           if (n0 && n1) {
30329             var ok = false;
30330             for (j3 = 0; j3 < memberWays.length; j3++) {
30331               way = memberWays[j3];
30332               if (way.areAdjacent(n0, n1)) {
30333                 ok = true;
30334                 break;
30335               }
30336             }
30337             if (!ok) {
30338               return "restriction";
30339             }
30340           }
30341         }
30342         for (j3 = 0; j3 < memberWays.length; j3++) {
30343           way = memberWays[j3].update({});
30344           for (k2 = 0; k2 < nodeIDs.length; k2++) {
30345             if (nodeIDs[k2] === survivor.id)
30346               continue;
30347             if (way.areAdjacent(nodeIDs[k2], survivor.id)) {
30348               way = way.removeNode(nodeIDs[k2]);
30349             } else {
30350               way = way.replaceNode(nodeIDs[k2], survivor.id);
30351             }
30352           }
30353           if (way.isDegenerate()) {
30354             return "restriction";
30355           }
30356         }
30357       }
30358       return false;
30359       function hasDuplicates(n4, i4, arr) {
30360         return arr.indexOf(n4) !== arr.lastIndexOf(n4);
30361       }
30362       function keyNodeFilter(froms, tos) {
30363         return function(n4) {
30364           return froms.indexOf(n4) === -1 && tos.indexOf(n4) === -1;
30365         };
30366       }
30367       function collectNodes(member, collection) {
30368         var entity = graph.hasEntity(member.id);
30369         if (!entity)
30370           return;
30371         var role2 = member.role || "";
30372         if (!collection[role2]) {
30373           collection[role2] = [];
30374         }
30375         if (member.type === "node") {
30376           collection[role2].push(member.id);
30377           if (role2 === "via") {
30378             collection.keyfrom.push(member.id);
30379             collection.keyto.push(member.id);
30380           }
30381         } else if (member.type === "way") {
30382           collection[role2].push.apply(collection[role2], entity.nodes);
30383           if (role2 === "from" || role2 === "via") {
30384             collection.keyfrom.push(entity.first());
30385             collection.keyfrom.push(entity.last());
30386           }
30387           if (role2 === "to" || role2 === "via") {
30388             collection.keyto.push(entity.first());
30389             collection.keyto.push(entity.last());
30390           }
30391         }
30392       }
30393     };
30394     return action;
30395   }
30396
30397   // modules/actions/copy_entities.js
30398   function actionCopyEntities(ids, fromGraph) {
30399     var _copies = {};
30400     var action = function(graph) {
30401       ids.forEach(function(id3) {
30402         fromGraph.entity(id3).copy(fromGraph, _copies);
30403       });
30404       for (var id2 in _copies) {
30405         graph = graph.replace(_copies[id2]);
30406       }
30407       return graph;
30408     };
30409     action.copies = function() {
30410       return _copies;
30411     };
30412     return action;
30413   }
30414
30415   // modules/actions/delete_member.js
30416   function actionDeleteMember(relationId, memberIndex) {
30417     return function(graph) {
30418       var relation = graph.entity(relationId).removeMember(memberIndex);
30419       graph = graph.replace(relation);
30420       if (relation.isDegenerate()) {
30421         graph = actionDeleteRelation(relation.id)(graph);
30422       }
30423       return graph;
30424     };
30425   }
30426
30427   // modules/actions/discard_tags.js
30428   function actionDiscardTags(difference, discardTags) {
30429     discardTags = discardTags || {};
30430     return (graph) => {
30431       difference.modified().forEach(checkTags);
30432       difference.created().forEach(checkTags);
30433       return graph;
30434       function checkTags(entity) {
30435         const keys2 = Object.keys(entity.tags);
30436         let didDiscard = false;
30437         let tags = {};
30438         for (let i3 = 0; i3 < keys2.length; i3++) {
30439           const k2 = keys2[i3];
30440           if (discardTags[k2] || !entity.tags[k2]) {
30441             didDiscard = true;
30442           } else {
30443             tags[k2] = entity.tags[k2];
30444           }
30445         }
30446         if (didDiscard) {
30447           graph = graph.replace(entity.update({ tags }));
30448         }
30449       }
30450     };
30451   }
30452
30453   // modules/actions/disconnect.js
30454   function actionDisconnect(nodeId, newNodeId) {
30455     var wayIds;
30456     var disconnectableRelationTypes = {
30457       "associatedStreet": true,
30458       "enforcement": true,
30459       "site": true
30460     };
30461     var action = function(graph) {
30462       var node = graph.entity(nodeId);
30463       var connections = action.connections(graph);
30464       connections.forEach(function(connection) {
30465         var way = graph.entity(connection.wayID);
30466         var newNode = osmNode({ id: newNodeId, loc: node.loc, tags: node.tags });
30467         graph = graph.replace(newNode);
30468         if (connection.index === 0 && way.isArea()) {
30469           graph = graph.replace(way.replaceNode(way.nodes[0], newNode.id));
30470         } else if (way.isClosed() && connection.index === way.nodes.length - 1) {
30471           graph = graph.replace(way.unclose().addNode(newNode.id));
30472         } else {
30473           graph = graph.replace(way.updateNode(newNode.id, connection.index));
30474         }
30475       });
30476       return graph;
30477     };
30478     action.connections = function(graph) {
30479       var candidates = [];
30480       var keeping = false;
30481       var parentWays = graph.parentWays(graph.entity(nodeId));
30482       var way, waynode;
30483       for (var i3 = 0; i3 < parentWays.length; i3++) {
30484         way = parentWays[i3];
30485         if (wayIds && wayIds.indexOf(way.id) === -1) {
30486           keeping = true;
30487           continue;
30488         }
30489         if (way.isArea() && way.nodes[0] === nodeId) {
30490           candidates.push({ wayID: way.id, index: 0 });
30491         } else {
30492           for (var j3 = 0; j3 < way.nodes.length; j3++) {
30493             waynode = way.nodes[j3];
30494             if (waynode === nodeId) {
30495               if (way.isClosed() && parentWays.length > 1 && wayIds && wayIds.indexOf(way.id) !== -1 && j3 === way.nodes.length - 1) {
30496                 continue;
30497               }
30498               candidates.push({ wayID: way.id, index: j3 });
30499             }
30500           }
30501         }
30502       }
30503       return keeping ? candidates : candidates.slice(1);
30504     };
30505     action.disabled = function(graph) {
30506       var connections = action.connections(graph);
30507       if (connections.length === 0)
30508         return "not_connected";
30509       var parentWays = graph.parentWays(graph.entity(nodeId));
30510       var seenRelationIds = {};
30511       var sharedRelation;
30512       parentWays.forEach(function(way) {
30513         var relations = graph.parentRelations(way);
30514         relations.filter((relation) => !disconnectableRelationTypes[relation.tags.type]).forEach(function(relation) {
30515           if (relation.id in seenRelationIds) {
30516             if (wayIds) {
30517               if (wayIds.indexOf(way.id) !== -1 || wayIds.indexOf(seenRelationIds[relation.id]) !== -1) {
30518                 sharedRelation = relation;
30519               }
30520             } else {
30521               sharedRelation = relation;
30522             }
30523           } else {
30524             seenRelationIds[relation.id] = way.id;
30525           }
30526         });
30527       });
30528       if (sharedRelation)
30529         return "relation";
30530     };
30531     action.limitWays = function(val) {
30532       if (!arguments.length)
30533         return wayIds;
30534       wayIds = val;
30535       return action;
30536     };
30537     return action;
30538   }
30539
30540   // modules/actions/extract.js
30541   function actionExtract(entityID, projection2) {
30542     var extractedNodeID;
30543     var action = function(graph) {
30544       var entity = graph.entity(entityID);
30545       if (entity.type === "node") {
30546         return extractFromNode(entity, graph);
30547       }
30548       return extractFromWayOrRelation(entity, graph);
30549     };
30550     function extractFromNode(node, graph) {
30551       extractedNodeID = node.id;
30552       var replacement = osmNode({ loc: node.loc });
30553       graph = graph.replace(replacement);
30554       graph = graph.parentWays(node).reduce(function(accGraph, parentWay) {
30555         return accGraph.replace(parentWay.replaceNode(entityID, replacement.id));
30556       }, graph);
30557       return graph.parentRelations(node).reduce(function(accGraph, parentRel) {
30558         return accGraph.replace(parentRel.replaceMember(node, replacement));
30559       }, graph);
30560     }
30561     function extractFromWayOrRelation(entity, graph) {
30562       var fromGeometry = entity.geometry(graph);
30563       var keysToCopyAndRetain = ["source", "wheelchair"];
30564       var keysToRetain = ["area"];
30565       var buildingKeysToRetain = ["architect", "building", "height", "layer"];
30566       var extractedLoc = path_default(projection2).centroid(entity.asGeoJSON(graph));
30567       extractedLoc = extractedLoc && projection2.invert(extractedLoc);
30568       if (!extractedLoc || !isFinite(extractedLoc[0]) || !isFinite(extractedLoc[1])) {
30569         extractedLoc = entity.extent(graph).center();
30570       }
30571       var indoorAreaValues = {
30572         area: true,
30573         corridor: true,
30574         elevator: true,
30575         level: true,
30576         room: true
30577       };
30578       var isBuilding = entity.tags.building && entity.tags.building !== "no" || entity.tags["building:part"] && entity.tags["building:part"] !== "no";
30579       var isIndoorArea = fromGeometry === "area" && entity.tags.indoor && indoorAreaValues[entity.tags.indoor];
30580       var entityTags = Object.assign({}, entity.tags);
30581       var pointTags = {};
30582       for (var key in entityTags) {
30583         if (entity.type === "relation" && key === "type") {
30584           continue;
30585         }
30586         if (keysToRetain.indexOf(key) !== -1) {
30587           continue;
30588         }
30589         if (isBuilding) {
30590           if (buildingKeysToRetain.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/))
30591             continue;
30592         }
30593         if (isIndoorArea && key === "indoor") {
30594           continue;
30595         }
30596         pointTags[key] = entityTags[key];
30597         if (keysToCopyAndRetain.indexOf(key) !== -1 || key.match(/^addr:.{1,}/)) {
30598           continue;
30599         } else if (isIndoorArea && key === "level") {
30600           continue;
30601         }
30602         delete entityTags[key];
30603       }
30604       if (!isBuilding && !isIndoorArea && fromGeometry === "area") {
30605         entityTags.area = "yes";
30606       }
30607       var replacement = osmNode({ loc: extractedLoc, tags: pointTags });
30608       graph = graph.replace(replacement);
30609       extractedNodeID = replacement.id;
30610       return graph.replace(entity.update({ tags: entityTags }));
30611     }
30612     action.getExtractedNodeID = function() {
30613       return extractedNodeID;
30614     };
30615     return action;
30616   }
30617
30618   // modules/actions/join.js
30619   function actionJoin(ids) {
30620     function groupEntitiesByGeometry(graph) {
30621       var entities = ids.map(function(id2) {
30622         return graph.entity(id2);
30623       });
30624       return Object.assign(
30625         { line: [] },
30626         utilArrayGroupBy(entities, function(entity) {
30627           return entity.geometry(graph);
30628         })
30629       );
30630     }
30631     var action = function(graph) {
30632       var ways = ids.map(graph.entity, graph);
30633       var survivorID = utilOldestID(ways.map((way) => way.id));
30634       ways.sort(function(a2, b2) {
30635         var aSided = a2.isSided();
30636         var bSided = b2.isSided();
30637         return aSided && !bSided ? -1 : bSided && !aSided ? 1 : 0;
30638       });
30639       var sequences = osmJoinWays(ways, graph);
30640       var joined = sequences[0];
30641       graph = sequences.actions.reduce(function(g3, action2) {
30642         return action2(g3);
30643       }, graph);
30644       var survivor = graph.entity(survivorID);
30645       survivor = survivor.update({ nodes: joined.nodes.map(function(n3) {
30646         return n3.id;
30647       }) });
30648       graph = graph.replace(survivor);
30649       joined.forEach(function(way) {
30650         if (way.id === survivorID)
30651           return;
30652         graph.parentRelations(way).forEach(function(parent) {
30653           graph = graph.replace(parent.replaceMember(way, survivor));
30654         });
30655         survivor = survivor.mergeTags(way.tags);
30656         graph = graph.replace(survivor);
30657         graph = actionDeleteWay(way.id)(graph);
30658       });
30659       function checkForSimpleMultipolygon() {
30660         if (!survivor.isClosed())
30661           return;
30662         var multipolygons = graph.parentMultipolygons(survivor).filter(function(multipolygon2) {
30663           return multipolygon2.members.length === 1;
30664         });
30665         if (multipolygons.length !== 1)
30666           return;
30667         var multipolygon = multipolygons[0];
30668         for (var key in survivor.tags) {
30669           if (multipolygon.tags[key] && // don't collapse if tags cannot be cleanly merged
30670           multipolygon.tags[key] !== survivor.tags[key])
30671             return;
30672         }
30673         survivor = survivor.mergeTags(multipolygon.tags);
30674         graph = graph.replace(survivor);
30675         graph = actionDeleteRelation(
30676           multipolygon.id,
30677           true
30678           /* allow untagged members */
30679         )(graph);
30680         var tags = Object.assign({}, survivor.tags);
30681         if (survivor.geometry(graph) !== "area") {
30682           tags.area = "yes";
30683         }
30684         delete tags.type;
30685         survivor = survivor.update({ tags });
30686         graph = graph.replace(survivor);
30687       }
30688       checkForSimpleMultipolygon();
30689       return graph;
30690     };
30691     action.resultingWayNodesLength = function(graph) {
30692       return ids.reduce(function(count, id2) {
30693         return count + graph.entity(id2).nodes.length;
30694       }, 0) - ids.length - 1;
30695     };
30696     action.disabled = function(graph) {
30697       var geometries = groupEntitiesByGeometry(graph);
30698       if (ids.length < 2 || ids.length !== geometries.line.length) {
30699         return "not_eligible";
30700       }
30701       var joined = osmJoinWays(ids.map(graph.entity, graph), graph);
30702       if (joined.length > 1) {
30703         return "not_adjacent";
30704       }
30705       var i3;
30706       var sortedParentRelations = function(id2) {
30707         return graph.parentRelations(graph.entity(id2)).filter((rel) => !rel.isRestriction() && !rel.isConnectivity()).sort((a2, b2) => a2.id - b2.id);
30708       };
30709       var relsA = sortedParentRelations(ids[0]);
30710       for (i3 = 1; i3 < ids.length; i3++) {
30711         var relsB = sortedParentRelations(ids[i3]);
30712         if (!utilArrayIdentical(relsA, relsB)) {
30713           return "conflicting_relations";
30714         }
30715       }
30716       for (i3 = 0; i3 < ids.length - 1; i3++) {
30717         for (var j3 = i3 + 1; j3 < ids.length; j3++) {
30718           var path1 = graph.childNodes(graph.entity(ids[i3])).map(function(e3) {
30719             return e3.loc;
30720           });
30721           var path2 = graph.childNodes(graph.entity(ids[j3])).map(function(e3) {
30722             return e3.loc;
30723           });
30724           var intersections = geoPathIntersections(path1, path2);
30725           var common = utilArrayIntersection(
30726             joined[0].nodes.map(function(n3) {
30727               return n3.loc.toString();
30728             }),
30729             intersections.map(function(n3) {
30730               return n3.toString();
30731             })
30732           );
30733           if (common.length !== intersections.length) {
30734             return "paths_intersect";
30735           }
30736         }
30737       }
30738       var nodeIds = joined[0].nodes.map(function(n3) {
30739         return n3.id;
30740       }).slice(1, -1);
30741       var relation;
30742       var tags = {};
30743       var conflicting = false;
30744       joined[0].forEach(function(way) {
30745         var parents = graph.parentRelations(way);
30746         parents.forEach(function(parent) {
30747           if ((parent.isRestriction() || parent.isConnectivity()) && parent.members.some(function(m2) {
30748             return nodeIds.indexOf(m2.id) >= 0;
30749           })) {
30750             relation = parent;
30751           }
30752         });
30753         for (var k2 in way.tags) {
30754           if (!(k2 in tags)) {
30755             tags[k2] = way.tags[k2];
30756           } else if (tags[k2] && osmIsInterestingTag(k2) && tags[k2] !== way.tags[k2]) {
30757             conflicting = true;
30758           }
30759         }
30760       });
30761       if (relation) {
30762         return relation.isRestriction() ? "restriction" : "connectivity";
30763       }
30764       if (conflicting) {
30765         return "conflicting_tags";
30766       }
30767     };
30768     return action;
30769   }
30770
30771   // modules/actions/merge.js
30772   function actionMerge(ids) {
30773     function groupEntitiesByGeometry(graph) {
30774       var entities = ids.map(function(id2) {
30775         return graph.entity(id2);
30776       });
30777       return Object.assign(
30778         { point: [], area: [], line: [], relation: [] },
30779         utilArrayGroupBy(entities, function(entity) {
30780           return entity.geometry(graph);
30781         })
30782       );
30783     }
30784     var action = function(graph) {
30785       var geometries = groupEntitiesByGeometry(graph);
30786       var target = geometries.area[0] || geometries.line[0];
30787       var points = geometries.point;
30788       points.forEach(function(point2) {
30789         target = target.mergeTags(point2.tags);
30790         graph = graph.replace(target);
30791         graph.parentRelations(point2).forEach(function(parent) {
30792           graph = graph.replace(parent.replaceMember(point2, target));
30793         });
30794         var nodes = utilArrayUniq(graph.childNodes(target));
30795         var removeNode = point2;
30796         if (!point2.isNew()) {
30797           var inserted = false;
30798           var canBeReplaced = function(node2) {
30799             return !(graph.parentWays(node2).length > 1 || graph.parentRelations(node2).length);
30800           };
30801           var replaceNode = function(node2) {
30802             graph = graph.replace(point2.update({ tags: node2.tags, loc: node2.loc }));
30803             target = target.replaceNode(node2.id, point2.id);
30804             graph = graph.replace(target);
30805             removeNode = node2;
30806             inserted = true;
30807           };
30808           var i3;
30809           var node;
30810           for (i3 = 0; i3 < nodes.length; i3++) {
30811             node = nodes[i3];
30812             if (canBeReplaced(node) && node.isNew()) {
30813               replaceNode(node);
30814               break;
30815             }
30816           }
30817           if (!inserted && point2.hasInterestingTags()) {
30818             for (i3 = 0; i3 < nodes.length; i3++) {
30819               node = nodes[i3];
30820               if (canBeReplaced(node) && !node.hasInterestingTags()) {
30821                 replaceNode(node);
30822                 break;
30823               }
30824             }
30825             if (!inserted) {
30826               for (i3 = 0; i3 < nodes.length; i3++) {
30827                 node = nodes[i3];
30828                 if (canBeReplaced(node) && utilCompareIDs(point2.id, node.id) < 0) {
30829                   replaceNode(node);
30830                   break;
30831                 }
30832               }
30833             }
30834           }
30835         }
30836         graph = graph.remove(removeNode);
30837       });
30838       if (target.tags.area === "yes") {
30839         var tags = Object.assign({}, target.tags);
30840         delete tags.area;
30841         if (osmTagSuggestingArea(tags)) {
30842           target = target.update({ tags });
30843           graph = graph.replace(target);
30844         }
30845       }
30846       return graph;
30847     };
30848     action.disabled = function(graph) {
30849       var geometries = groupEntitiesByGeometry(graph);
30850       if (geometries.point.length === 0 || geometries.area.length + geometries.line.length !== 1 || geometries.relation.length !== 0) {
30851         return "not_eligible";
30852       }
30853     };
30854     return action;
30855   }
30856
30857   // modules/actions/merge_nodes.js
30858   function actionMergeNodes(nodeIDs, loc) {
30859     function chooseLoc(graph) {
30860       if (!nodeIDs.length)
30861         return null;
30862       var sum = [0, 0];
30863       var interestingCount = 0;
30864       var interestingLoc;
30865       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
30866         var node = graph.entity(nodeIDs[i3]);
30867         if (node.hasInterestingTags()) {
30868           interestingLoc = ++interestingCount === 1 ? node.loc : null;
30869         }
30870         sum = geoVecAdd(sum, node.loc);
30871       }
30872       return interestingLoc || geoVecScale(sum, 1 / nodeIDs.length);
30873     }
30874     var action = function(graph) {
30875       if (nodeIDs.length < 2)
30876         return graph;
30877       var toLoc = loc;
30878       if (!toLoc) {
30879         toLoc = chooseLoc(graph);
30880       }
30881       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
30882         var node = graph.entity(nodeIDs[i3]);
30883         if (node.loc !== toLoc) {
30884           graph = graph.replace(node.move(toLoc));
30885         }
30886       }
30887       return actionConnect(nodeIDs)(graph);
30888     };
30889     action.disabled = function(graph) {
30890       if (nodeIDs.length < 2)
30891         return "not_eligible";
30892       for (var i3 = 0; i3 < nodeIDs.length; i3++) {
30893         var entity = graph.entity(nodeIDs[i3]);
30894         if (entity.type !== "node")
30895           return "not_eligible";
30896       }
30897       return actionConnect(nodeIDs).disabled(graph);
30898     };
30899     return action;
30900   }
30901
30902   // modules/osm/changeset.js
30903   function osmChangeset() {
30904     if (!(this instanceof osmChangeset)) {
30905       return new osmChangeset().initialize(arguments);
30906     } else if (arguments.length) {
30907       this.initialize(arguments);
30908     }
30909   }
30910   osmEntity.changeset = osmChangeset;
30911   osmChangeset.prototype = Object.create(osmEntity.prototype);
30912   Object.assign(osmChangeset.prototype, {
30913     type: "changeset",
30914     extent: function() {
30915       return new geoExtent();
30916     },
30917     geometry: function() {
30918       return "changeset";
30919     },
30920     asJXON: function() {
30921       return {
30922         osm: {
30923           changeset: {
30924             tag: Object.keys(this.tags).map(function(k2) {
30925               return { "@k": k2, "@v": this.tags[k2] };
30926             }, this),
30927             "@version": 0.6,
30928             "@generator": "iD"
30929           }
30930         }
30931       };
30932     },
30933     // Generate [osmChange](http://wiki.openstreetmap.org/wiki/OsmChange)
30934     // XML. Returns a string.
30935     osmChangeJXON: function(changes) {
30936       var changeset_id = this.id;
30937       function nest(x2, order) {
30938         var groups = {};
30939         for (var i3 = 0; i3 < x2.length; i3++) {
30940           var tagName = Object.keys(x2[i3])[0];
30941           if (!groups[tagName])
30942             groups[tagName] = [];
30943           groups[tagName].push(x2[i3][tagName]);
30944         }
30945         var ordered = {};
30946         order.forEach(function(o2) {
30947           if (groups[o2])
30948             ordered[o2] = groups[o2];
30949         });
30950         return ordered;
30951       }
30952       function sort(changes2) {
30953         function resolve(item) {
30954           return relations.find(function(relation2) {
30955             return item.keyAttributes.type === "relation" && item.keyAttributes.ref === relation2["@id"];
30956           });
30957         }
30958         function isNew(item) {
30959           return !sorted[item["@id"]] && !processing.find(function(proc) {
30960             return proc["@id"] === item["@id"];
30961           });
30962         }
30963         var processing = [];
30964         var sorted = {};
30965         var relations = changes2.relation;
30966         if (!relations)
30967           return changes2;
30968         for (var i3 = 0; i3 < relations.length; i3++) {
30969           var relation = relations[i3];
30970           if (!sorted[relation["@id"]]) {
30971             processing.push(relation);
30972           }
30973           while (processing.length > 0) {
30974             var next = processing[0], deps = next.member.map(resolve).filter(Boolean).filter(isNew);
30975             if (deps.length === 0) {
30976               sorted[next["@id"]] = next;
30977               processing.shift();
30978             } else {
30979               processing = deps.concat(processing);
30980             }
30981           }
30982         }
30983         changes2.relation = Object.values(sorted);
30984         return changes2;
30985       }
30986       function rep2(entity) {
30987         return entity.asJXON(changeset_id);
30988       }
30989       return {
30990         osmChange: {
30991           "@version": 0.6,
30992           "@generator": "iD",
30993           "create": sort(nest(changes.created.map(rep2), ["node", "way", "relation"])),
30994           "modify": nest(changes.modified.map(rep2), ["node", "way", "relation"]),
30995           "delete": Object.assign(nest(changes.deleted.map(rep2), ["relation", "way", "node"]), { "@if-unused": true })
30996         }
30997       };
30998     },
30999     asGeoJSON: function() {
31000       return {};
31001     }
31002   });
31003
31004   // modules/osm/note.js
31005   function osmNote() {
31006     if (!(this instanceof osmNote)) {
31007       return new osmNote().initialize(arguments);
31008     } else if (arguments.length) {
31009       this.initialize(arguments);
31010     }
31011   }
31012   osmNote.id = function() {
31013     return osmNote.id.next--;
31014   };
31015   osmNote.id.next = -1;
31016   Object.assign(osmNote.prototype, {
31017     type: "note",
31018     initialize: function(sources) {
31019       for (var i3 = 0; i3 < sources.length; ++i3) {
31020         var source = sources[i3];
31021         for (var prop in source) {
31022           if (Object.prototype.hasOwnProperty.call(source, prop)) {
31023             if (source[prop] === void 0) {
31024               delete this[prop];
31025             } else {
31026               this[prop] = source[prop];
31027             }
31028           }
31029         }
31030       }
31031       if (!this.id) {
31032         this.id = osmNote.id().toString();
31033       }
31034       return this;
31035     },
31036     extent: function() {
31037       return new geoExtent(this.loc);
31038     },
31039     update: function(attrs) {
31040       return osmNote(this, attrs);
31041     },
31042     isNew: function() {
31043       return this.id < 0;
31044     },
31045     move: function(loc) {
31046       return this.update({ loc });
31047     }
31048   });
31049
31050   // modules/osm/relation.js
31051   function osmRelation() {
31052     if (!(this instanceof osmRelation)) {
31053       return new osmRelation().initialize(arguments);
31054     } else if (arguments.length) {
31055       this.initialize(arguments);
31056     }
31057   }
31058   osmEntity.relation = osmRelation;
31059   osmRelation.prototype = Object.create(osmEntity.prototype);
31060   osmRelation.creationOrder = function(a2, b2) {
31061     var aId = parseInt(osmEntity.id.toOSM(a2.id), 10);
31062     var bId = parseInt(osmEntity.id.toOSM(b2.id), 10);
31063     if (aId < 0 || bId < 0)
31064       return aId - bId;
31065     return bId - aId;
31066   };
31067   Object.assign(osmRelation.prototype, {
31068     type: "relation",
31069     members: [],
31070     copy: function(resolver, copies) {
31071       if (copies[this.id])
31072         return copies[this.id];
31073       var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
31074       var members = this.members.map(function(member) {
31075         return Object.assign({}, member, { id: resolver.entity(member.id).copy(resolver, copies).id });
31076       });
31077       copy2 = copy2.update({ members });
31078       copies[this.id] = copy2;
31079       return copy2;
31080     },
31081     extent: function(resolver, memo) {
31082       return resolver.transient(this, "extent", function() {
31083         if (memo && memo[this.id])
31084           return geoExtent();
31085         memo = memo || {};
31086         memo[this.id] = true;
31087         var extent = geoExtent();
31088         for (var i3 = 0; i3 < this.members.length; i3++) {
31089           var member = resolver.hasEntity(this.members[i3].id);
31090           if (member) {
31091             extent._extend(member.extent(resolver, memo));
31092           }
31093         }
31094         return extent;
31095       });
31096     },
31097     geometry: function(graph) {
31098       return graph.transient(this, "geometry", function() {
31099         return this.isMultipolygon() ? "area" : "relation";
31100       });
31101     },
31102     isDegenerate: function() {
31103       return this.members.length === 0;
31104     },
31105     // Return an array of members, each extended with an 'index' property whose value
31106     // is the member index.
31107     indexedMembers: function() {
31108       var result = new Array(this.members.length);
31109       for (var i3 = 0; i3 < this.members.length; i3++) {
31110         result[i3] = Object.assign({}, this.members[i3], { index: i3 });
31111       }
31112       return result;
31113     },
31114     // Return the first member with the given role. A copy of the member object
31115     // is returned, extended with an 'index' property whose value is the member index.
31116     memberByRole: function(role) {
31117       for (var i3 = 0; i3 < this.members.length; i3++) {
31118         if (this.members[i3].role === role) {
31119           return Object.assign({}, this.members[i3], { index: i3 });
31120         }
31121       }
31122     },
31123     // Same as memberByRole, but returns all members with the given role
31124     membersByRole: function(role) {
31125       var result = [];
31126       for (var i3 = 0; i3 < this.members.length; i3++) {
31127         if (this.members[i3].role === role) {
31128           result.push(Object.assign({}, this.members[i3], { index: i3 }));
31129         }
31130       }
31131       return result;
31132     },
31133     // Return the first member with the given id. A copy of the member object
31134     // is returned, extended with an 'index' property whose value is the member index.
31135     memberById: function(id2) {
31136       for (var i3 = 0; i3 < this.members.length; i3++) {
31137         if (this.members[i3].id === id2) {
31138           return Object.assign({}, this.members[i3], { index: i3 });
31139         }
31140       }
31141     },
31142     // Return the first member with the given id and role. A copy of the member object
31143     // is returned, extended with an 'index' property whose value is the member index.
31144     memberByIdAndRole: function(id2, role) {
31145       for (var i3 = 0; i3 < this.members.length; i3++) {
31146         if (this.members[i3].id === id2 && this.members[i3].role === role) {
31147           return Object.assign({}, this.members[i3], { index: i3 });
31148         }
31149       }
31150     },
31151     addMember: function(member, index) {
31152       var members = this.members.slice();
31153       members.splice(index === void 0 ? members.length : index, 0, member);
31154       return this.update({ members });
31155     },
31156     updateMember: function(member, index) {
31157       var members = this.members.slice();
31158       members.splice(index, 1, Object.assign({}, members[index], member));
31159       return this.update({ members });
31160     },
31161     removeMember: function(index) {
31162       var members = this.members.slice();
31163       members.splice(index, 1);
31164       return this.update({ members });
31165     },
31166     removeMembersWithID: function(id2) {
31167       var members = this.members.filter(function(m2) {
31168         return m2.id !== id2;
31169       });
31170       return this.update({ members });
31171     },
31172     moveMember: function(fromIndex, toIndex) {
31173       var members = this.members.slice();
31174       members.splice(toIndex, 0, members.splice(fromIndex, 1)[0]);
31175       return this.update({ members });
31176     },
31177     // Wherever a member appears with id `needle.id`, replace it with a member
31178     // with id `replacement.id`, type `replacement.type`, and the original role,
31179     // By default, adding a duplicate member (by id and role) is prevented.
31180     // Return an updated relation.
31181     replaceMember: function(needle, replacement, keepDuplicates) {
31182       if (!this.memberById(needle.id))
31183         return this;
31184       var members = [];
31185       for (var i3 = 0; i3 < this.members.length; i3++) {
31186         var member = this.members[i3];
31187         if (member.id !== needle.id) {
31188           members.push(member);
31189         } else if (keepDuplicates || !this.memberByIdAndRole(replacement.id, member.role)) {
31190           members.push({ id: replacement.id, type: replacement.type, role: member.role });
31191         }
31192       }
31193       return this.update({ members });
31194     },
31195     asJXON: function(changeset_id) {
31196       var r2 = {
31197         relation: {
31198           "@id": this.osmId(),
31199           "@version": this.version || 0,
31200           member: this.members.map(function(member) {
31201             return {
31202               keyAttributes: {
31203                 type: member.type,
31204                 role: member.role,
31205                 ref: osmEntity.id.toOSM(member.id)
31206               }
31207             };
31208           }, this),
31209           tag: Object.keys(this.tags).map(function(k2) {
31210             return { keyAttributes: { k: k2, v: this.tags[k2] } };
31211           }, this)
31212         }
31213       };
31214       if (changeset_id) {
31215         r2.relation["@changeset"] = changeset_id;
31216       }
31217       return r2;
31218     },
31219     asGeoJSON: function(resolver) {
31220       return resolver.transient(this, "GeoJSON", function() {
31221         if (this.isMultipolygon()) {
31222           return {
31223             type: "MultiPolygon",
31224             coordinates: this.multipolygon(resolver)
31225           };
31226         } else {
31227           return {
31228             type: "FeatureCollection",
31229             properties: this.tags,
31230             features: this.members.map(function(member) {
31231               return Object.assign({ role: member.role }, resolver.entity(member.id).asGeoJSON(resolver));
31232             })
31233           };
31234         }
31235       });
31236     },
31237     area: function(resolver) {
31238       return resolver.transient(this, "area", function() {
31239         return area_default(this.asGeoJSON(resolver));
31240       });
31241     },
31242     isMultipolygon: function() {
31243       return this.tags.type === "multipolygon";
31244     },
31245     isComplete: function(resolver) {
31246       for (var i3 = 0; i3 < this.members.length; i3++) {
31247         if (!resolver.hasEntity(this.members[i3].id)) {
31248           return false;
31249         }
31250       }
31251       return true;
31252     },
31253     hasFromViaTo: function() {
31254       return this.members.some(function(m2) {
31255         return m2.role === "from";
31256       }) && this.members.some(function(m2) {
31257         return m2.role === "via";
31258       }) && this.members.some(function(m2) {
31259         return m2.role === "to";
31260       });
31261     },
31262     isRestriction: function() {
31263       return !!(this.tags.type && this.tags.type.match(/^restriction:?/));
31264     },
31265     isValidRestriction: function() {
31266       if (!this.isRestriction())
31267         return false;
31268       var froms = this.members.filter(function(m2) {
31269         return m2.role === "from";
31270       });
31271       var vias = this.members.filter(function(m2) {
31272         return m2.role === "via";
31273       });
31274       var tos = this.members.filter(function(m2) {
31275         return m2.role === "to";
31276       });
31277       if (froms.length !== 1 && this.tags.restriction !== "no_entry")
31278         return false;
31279       if (froms.some(function(m2) {
31280         return m2.type !== "way";
31281       }))
31282         return false;
31283       if (tos.length !== 1 && this.tags.restriction !== "no_exit")
31284         return false;
31285       if (tos.some(function(m2) {
31286         return m2.type !== "way";
31287       }))
31288         return false;
31289       if (vias.length === 0)
31290         return false;
31291       if (vias.length > 1 && vias.some(function(m2) {
31292         return m2.type !== "way";
31293       }))
31294         return false;
31295       return true;
31296     },
31297     isConnectivity: function() {
31298       return !!(this.tags.type && this.tags.type.match(/^connectivity:?/));
31299     },
31300     // Returns an array [A0, ... An], each Ai being an array of node arrays [Nds0, ... Ndsm],
31301     // where Nds0 is an outer ring and subsequent Ndsi's (if any i > 0) being inner rings.
31302     //
31303     // This corresponds to the structure needed for rendering a multipolygon path using a
31304     // `evenodd` fill rule, as well as the structure of a GeoJSON MultiPolygon geometry.
31305     //
31306     // In the case of invalid geometries, this function will still return a result which
31307     // includes the nodes of all way members, but some Nds may be unclosed and some inner
31308     // rings not matched with the intended outer ring.
31309     //
31310     multipolygon: function(resolver) {
31311       var outers = this.members.filter(function(m2) {
31312         return "outer" === (m2.role || "outer");
31313       });
31314       var inners = this.members.filter(function(m2) {
31315         return "inner" === m2.role;
31316       });
31317       outers = osmJoinWays(outers, resolver);
31318       inners = osmJoinWays(inners, resolver);
31319       var sequenceToLineString = function(sequence) {
31320         if (sequence.nodes.length > 2 && sequence.nodes[0] !== sequence.nodes[sequence.nodes.length - 1]) {
31321           sequence.nodes.push(sequence.nodes[0]);
31322         }
31323         return sequence.nodes.map(function(node) {
31324           return node.loc;
31325         });
31326       };
31327       outers = outers.map(sequenceToLineString);
31328       inners = inners.map(sequenceToLineString);
31329       var result = outers.map(function(o3) {
31330         return [area_default({ type: "Polygon", coordinates: [o3] }) > 2 * Math.PI ? o3.reverse() : o3];
31331       });
31332       function findOuter(inner2) {
31333         var o3, outer;
31334         for (o3 = 0; o3 < outers.length; o3++) {
31335           outer = outers[o3];
31336           if (geoPolygonContainsPolygon(outer, inner2)) {
31337             return o3;
31338           }
31339         }
31340         for (o3 = 0; o3 < outers.length; o3++) {
31341           outer = outers[o3];
31342           if (geoPolygonIntersectsPolygon(outer, inner2, false)) {
31343             return o3;
31344           }
31345         }
31346       }
31347       for (var i3 = 0; i3 < inners.length; i3++) {
31348         var inner = inners[i3];
31349         if (area_default({ type: "Polygon", coordinates: [inner] }) < 2 * Math.PI) {
31350           inner = inner.reverse();
31351         }
31352         var o2 = findOuter(inners[i3]);
31353         if (o2 !== void 0) {
31354           result[o2].push(inners[i3]);
31355         } else {
31356           result.push([inners[i3]]);
31357         }
31358       }
31359       return result;
31360     }
31361   });
31362
31363   // modules/osm/qa_item.js
31364   var QAItem = class _QAItem {
31365     constructor(loc, service, itemType, id2, props) {
31366       this.loc = loc;
31367       this.service = service.title;
31368       this.itemType = itemType;
31369       this.id = id2 ? id2 : "".concat(_QAItem.id());
31370       this.update(props);
31371       if (service && typeof service.getIcon === "function") {
31372         this.icon = service.getIcon(itemType);
31373       }
31374     }
31375     update(props) {
31376       const { loc, service, itemType, id: id2 } = this;
31377       Object.keys(props).forEach((prop) => this[prop] = props[prop]);
31378       this.loc = loc;
31379       this.service = service;
31380       this.itemType = itemType;
31381       this.id = id2;
31382       return this;
31383     }
31384     // Generic handling for newly created QAItems
31385     static id() {
31386       return this.nextId--;
31387     }
31388   };
31389   QAItem.nextId = -1;
31390
31391   // modules/actions/split.js
31392   function actionSplit(nodeIds, newWayIds) {
31393     if (typeof nodeIds === "string")
31394       nodeIds = [nodeIds];
31395     var _wayIDs;
31396     var _keepHistoryOn = "longest";
31397     var _createdWayIDs = [];
31398     function dist(graph, nA, nB) {
31399       var locA = graph.entity(nA).loc;
31400       var locB = graph.entity(nB).loc;
31401       var epsilon3 = 1e-6;
31402       return locA && locB ? geoSphericalDistance(locA, locB) : epsilon3;
31403     }
31404     function splitArea(nodes, idxA, graph) {
31405       var lengths = new Array(nodes.length);
31406       var length;
31407       var i3;
31408       var best = 0;
31409       var idxB;
31410       function wrap2(index) {
31411         return utilWrap(index, nodes.length);
31412       }
31413       length = 0;
31414       for (i3 = wrap2(idxA + 1); i3 !== idxA; i3 = wrap2(i3 + 1)) {
31415         length += dist(graph, nodes[i3], nodes[wrap2(i3 - 1)]);
31416         lengths[i3] = length;
31417       }
31418       length = 0;
31419       for (i3 = wrap2(idxA - 1); i3 !== idxA; i3 = wrap2(i3 - 1)) {
31420         length += dist(graph, nodes[i3], nodes[wrap2(i3 + 1)]);
31421         if (length < lengths[i3]) {
31422           lengths[i3] = length;
31423         }
31424       }
31425       for (i3 = 0; i3 < nodes.length; i3++) {
31426         var cost = lengths[i3] / dist(graph, nodes[idxA], nodes[i3]);
31427         if (cost > best) {
31428           idxB = i3;
31429           best = cost;
31430         }
31431       }
31432       return idxB;
31433     }
31434     function totalLengthBetweenNodes(graph, nodes) {
31435       var totalLength = 0;
31436       for (var i3 = 0; i3 < nodes.length - 1; i3++) {
31437         totalLength += dist(graph, nodes[i3], nodes[i3 + 1]);
31438       }
31439       return totalLength;
31440     }
31441     function split(graph, nodeId, wayA, newWayId) {
31442       var wayB = osmWay({ id: newWayId, tags: wayA.tags });
31443       var origNodes = wayA.nodes.slice();
31444       var nodesA;
31445       var nodesB;
31446       var isArea = wayA.isArea();
31447       var isOuter = osmIsOldMultipolygonOuterMember(wayA, graph);
31448       if (wayA.isClosed()) {
31449         var nodes = wayA.nodes.slice(0, -1);
31450         var idxA = nodes.indexOf(nodeId);
31451         var idxB = splitArea(nodes, idxA, graph);
31452         if (idxB < idxA) {
31453           nodesA = nodes.slice(idxA).concat(nodes.slice(0, idxB + 1));
31454           nodesB = nodes.slice(idxB, idxA + 1);
31455         } else {
31456           nodesA = nodes.slice(idxA, idxB + 1);
31457           nodesB = nodes.slice(idxB).concat(nodes.slice(0, idxA + 1));
31458         }
31459       } else {
31460         var idx = wayA.nodes.indexOf(nodeId, 1);
31461         nodesA = wayA.nodes.slice(0, idx + 1);
31462         nodesB = wayA.nodes.slice(idx);
31463       }
31464       var lengthA = totalLengthBetweenNodes(graph, nodesA);
31465       var lengthB = totalLengthBetweenNodes(graph, nodesB);
31466       if (_keepHistoryOn === "longest" && lengthB > lengthA) {
31467         wayA = wayA.update({ nodes: nodesB });
31468         wayB = wayB.update({ nodes: nodesA });
31469         var temp = lengthA;
31470         lengthA = lengthB;
31471         lengthB = temp;
31472       } else {
31473         wayA = wayA.update({ nodes: nodesA });
31474         wayB = wayB.update({ nodes: nodesB });
31475       }
31476       if (wayA.tags.step_count) {
31477         var stepCount = Number(wayA.tags.step_count);
31478         if (stepCount && // ensure a number
31479         isFinite(stepCount) && // ensure positive
31480         stepCount > 0 && // ensure integer
31481         Math.round(stepCount) === stepCount) {
31482           var tagsA = Object.assign({}, wayA.tags);
31483           var tagsB = Object.assign({}, wayB.tags);
31484           var ratioA = lengthA / (lengthA + lengthB);
31485           var countA = Math.round(stepCount * ratioA);
31486           tagsA.step_count = countA.toString();
31487           tagsB.step_count = (stepCount - countA).toString();
31488           wayA = wayA.update({ tags: tagsA });
31489           wayB = wayB.update({ tags: tagsB });
31490         }
31491       }
31492       graph = graph.replace(wayA);
31493       graph = graph.replace(wayB);
31494       graph.parentRelations(wayA).forEach(function(relation) {
31495         var member;
31496         if (relation.hasFromViaTo()) {
31497           var f3 = relation.memberByRole("from");
31498           var v2 = relation.membersByRole("via");
31499           var t2 = relation.memberByRole("to");
31500           var i3;
31501           if (f3.id === wayA.id || t2.id === wayA.id) {
31502             var keepB = false;
31503             if (v2.length === 1 && v2[0].type === "node") {
31504               keepB = wayB.contains(v2[0].id);
31505             } else {
31506               for (i3 = 0; i3 < v2.length; i3++) {
31507                 if (v2[i3].type === "way") {
31508                   var wayVia = graph.hasEntity(v2[i3].id);
31509                   if (wayVia && utilArrayIntersection(wayB.nodes, wayVia.nodes).length) {
31510                     keepB = true;
31511                     break;
31512                   }
31513                 }
31514               }
31515             }
31516             if (keepB) {
31517               relation = relation.replaceMember(wayA, wayB);
31518               graph = graph.replace(relation);
31519             }
31520           } else {
31521             for (i3 = 0; i3 < v2.length; i3++) {
31522               if (v2[i3].type === "way" && v2[i3].id === wayA.id) {
31523                 member = {
31524                   id: wayB.id,
31525                   type: "way",
31526                   role: "via"
31527                 };
31528                 graph = actionAddMember(relation.id, member, v2[i3].index + 1)(graph);
31529                 break;
31530               }
31531             }
31532           }
31533         } else {
31534           if (relation === isOuter) {
31535             graph = graph.replace(relation.mergeTags(wayA.tags));
31536             graph = graph.replace(wayA.update({ tags: {} }));
31537             graph = graph.replace(wayB.update({ tags: {} }));
31538           }
31539           member = {
31540             id: wayB.id,
31541             type: "way",
31542             role: relation.memberById(wayA.id).role
31543           };
31544           var insertPair = {
31545             originalID: wayA.id,
31546             insertedID: wayB.id,
31547             nodes: origNodes
31548           };
31549           graph = actionAddMember(relation.id, member, void 0, insertPair)(graph);
31550         }
31551       });
31552       if (!isOuter && isArea) {
31553         var multipolygon = osmRelation({
31554           tags: Object.assign({}, wayA.tags, { type: "multipolygon" }),
31555           members: [
31556             { id: wayA.id, role: "outer", type: "way" },
31557             { id: wayB.id, role: "outer", type: "way" }
31558           ]
31559         });
31560         graph = graph.replace(multipolygon);
31561         graph = graph.replace(wayA.update({ tags: {} }));
31562         graph = graph.replace(wayB.update({ tags: {} }));
31563       }
31564       _createdWayIDs.push(wayB.id);
31565       return graph;
31566     }
31567     var action = function(graph) {
31568       _createdWayIDs = [];
31569       var newWayIndex = 0;
31570       for (var i3 = 0; i3 < nodeIds.length; i3++) {
31571         var nodeId = nodeIds[i3];
31572         var candidates = action.waysForNode(nodeId, graph);
31573         for (var j3 = 0; j3 < candidates.length; j3++) {
31574           graph = split(graph, nodeId, candidates[j3], newWayIds && newWayIds[newWayIndex]);
31575           newWayIndex += 1;
31576         }
31577       }
31578       return graph;
31579     };
31580     action.getCreatedWayIDs = function() {
31581       return _createdWayIDs;
31582     };
31583     action.waysForNode = function(nodeId, graph) {
31584       var node = graph.entity(nodeId);
31585       var splittableParents = graph.parentWays(node).filter(isSplittable);
31586       if (!_wayIDs) {
31587         var hasLine = splittableParents.some(function(parent) {
31588           return parent.geometry(graph) === "line";
31589         });
31590         if (hasLine) {
31591           return splittableParents.filter(function(parent) {
31592             return parent.geometry(graph) === "line";
31593           });
31594         }
31595       }
31596       return splittableParents;
31597       function isSplittable(parent) {
31598         if (_wayIDs && _wayIDs.indexOf(parent.id) === -1)
31599           return false;
31600         if (parent.isClosed())
31601           return true;
31602         for (var i3 = 1; i3 < parent.nodes.length - 1; i3++) {
31603           if (parent.nodes[i3] === nodeId)
31604             return true;
31605         }
31606         return false;
31607       }
31608     };
31609     action.ways = function(graph) {
31610       return utilArrayUniq([].concat.apply([], nodeIds.map(function(nodeId) {
31611         return action.waysForNode(nodeId, graph);
31612       })));
31613     };
31614     action.disabled = function(graph) {
31615       for (var i3 = 0; i3 < nodeIds.length; i3++) {
31616         var nodeId = nodeIds[i3];
31617         var candidates = action.waysForNode(nodeId, graph);
31618         if (candidates.length === 0 || _wayIDs && _wayIDs.length !== candidates.length) {
31619           return "not_eligible";
31620         }
31621       }
31622     };
31623     action.limitWays = function(val) {
31624       if (!arguments.length)
31625         return _wayIDs;
31626       _wayIDs = val;
31627       return action;
31628     };
31629     action.keepHistoryOn = function(val) {
31630       if (!arguments.length)
31631         return _keepHistoryOn;
31632       _keepHistoryOn = val;
31633       return action;
31634     };
31635     return action;
31636   }
31637
31638   // modules/core/graph.js
31639   function coreGraph(other, mutable) {
31640     if (!(this instanceof coreGraph))
31641       return new coreGraph(other, mutable);
31642     if (other instanceof coreGraph) {
31643       var base = other.base();
31644       this.entities = Object.assign(Object.create(base.entities), other.entities);
31645       this._parentWays = Object.assign(Object.create(base.parentWays), other._parentWays);
31646       this._parentRels = Object.assign(Object.create(base.parentRels), other._parentRels);
31647     } else {
31648       this.entities = /* @__PURE__ */ Object.create({});
31649       this._parentWays = /* @__PURE__ */ Object.create({});
31650       this._parentRels = /* @__PURE__ */ Object.create({});
31651       this.rebase(other || [], [this]);
31652     }
31653     this.transients = {};
31654     this._childNodes = {};
31655     this.frozen = !mutable;
31656   }
31657   coreGraph.prototype = {
31658     hasEntity: function(id2) {
31659       return this.entities[id2];
31660     },
31661     entity: function(id2) {
31662       var entity = this.entities[id2];
31663       if (!entity) {
31664         entity = this.entities.__proto__[id2];
31665       }
31666       if (!entity) {
31667         throw new Error("entity " + id2 + " not found");
31668       }
31669       return entity;
31670     },
31671     geometry: function(id2) {
31672       return this.entity(id2).geometry(this);
31673     },
31674     transient: function(entity, key, fn) {
31675       var id2 = entity.id;
31676       var transients = this.transients[id2] || (this.transients[id2] = {});
31677       if (transients[key] !== void 0) {
31678         return transients[key];
31679       }
31680       transients[key] = fn.call(entity);
31681       return transients[key];
31682     },
31683     parentWays: function(entity) {
31684       var parents = this._parentWays[entity.id];
31685       var result = [];
31686       if (parents) {
31687         parents.forEach(function(id2) {
31688           result.push(this.entity(id2));
31689         }, this);
31690       }
31691       return result;
31692     },
31693     isPoi: function(entity) {
31694       var parents = this._parentWays[entity.id];
31695       return !parents || parents.size === 0;
31696     },
31697     isShared: function(entity) {
31698       var parents = this._parentWays[entity.id];
31699       return parents && parents.size > 1;
31700     },
31701     parentRelations: function(entity) {
31702       var parents = this._parentRels[entity.id];
31703       var result = [];
31704       if (parents) {
31705         parents.forEach(function(id2) {
31706           result.push(this.entity(id2));
31707         }, this);
31708       }
31709       return result;
31710     },
31711     parentMultipolygons: function(entity) {
31712       return this.parentRelations(entity).filter(function(relation) {
31713         return relation.isMultipolygon();
31714       });
31715     },
31716     childNodes: function(entity) {
31717       if (this._childNodes[entity.id])
31718         return this._childNodes[entity.id];
31719       if (!entity.nodes)
31720         return [];
31721       var nodes = [];
31722       for (var i3 = 0; i3 < entity.nodes.length; i3++) {
31723         nodes[i3] = this.entity(entity.nodes[i3]);
31724       }
31725       if (debug)
31726         Object.freeze(nodes);
31727       this._childNodes[entity.id] = nodes;
31728       return this._childNodes[entity.id];
31729     },
31730     base: function() {
31731       return {
31732         "entities": Object.getPrototypeOf(this.entities),
31733         "parentWays": Object.getPrototypeOf(this._parentWays),
31734         "parentRels": Object.getPrototypeOf(this._parentRels)
31735       };
31736     },
31737     // Unlike other graph methods, rebase mutates in place. This is because it
31738     // is used only during the history operation that merges newly downloaded
31739     // data into each state. To external consumers, it should appear as if the
31740     // graph always contained the newly downloaded data.
31741     rebase: function(entities, stack, force) {
31742       var base = this.base();
31743       var i3, j3, k2, id2;
31744       for (i3 = 0; i3 < entities.length; i3++) {
31745         var entity = entities[i3];
31746         if (!entity.visible || !force && base.entities[entity.id])
31747           continue;
31748         base.entities[entity.id] = entity;
31749         this._updateCalculated(void 0, entity, base.parentWays, base.parentRels);
31750         if (entity.type === "way") {
31751           for (j3 = 0; j3 < entity.nodes.length; j3++) {
31752             id2 = entity.nodes[j3];
31753             for (k2 = 1; k2 < stack.length; k2++) {
31754               var ents = stack[k2].entities;
31755               if (ents.hasOwnProperty(id2) && ents[id2] === void 0) {
31756                 delete ents[id2];
31757               }
31758             }
31759           }
31760         }
31761       }
31762       for (i3 = 0; i3 < stack.length; i3++) {
31763         stack[i3]._updateRebased();
31764       }
31765     },
31766     _updateRebased: function() {
31767       var base = this.base();
31768       Object.keys(this._parentWays).forEach(function(child) {
31769         if (base.parentWays[child]) {
31770           base.parentWays[child].forEach(function(id2) {
31771             if (!this.entities.hasOwnProperty(id2)) {
31772               this._parentWays[child].add(id2);
31773             }
31774           }, this);
31775         }
31776       }, this);
31777       Object.keys(this._parentRels).forEach(function(child) {
31778         if (base.parentRels[child]) {
31779           base.parentRels[child].forEach(function(id2) {
31780             if (!this.entities.hasOwnProperty(id2)) {
31781               this._parentRels[child].add(id2);
31782             }
31783           }, this);
31784         }
31785       }, this);
31786       this.transients = {};
31787     },
31788     // Updates calculated properties (parentWays, parentRels) for the specified change
31789     _updateCalculated: function(oldentity, entity, parentWays, parentRels) {
31790       parentWays = parentWays || this._parentWays;
31791       parentRels = parentRels || this._parentRels;
31792       var type2 = entity && entity.type || oldentity && oldentity.type;
31793       var removed, added, i3;
31794       if (type2 === "way") {
31795         if (oldentity && entity) {
31796           removed = utilArrayDifference(oldentity.nodes, entity.nodes);
31797           added = utilArrayDifference(entity.nodes, oldentity.nodes);
31798         } else if (oldentity) {
31799           removed = oldentity.nodes;
31800           added = [];
31801         } else if (entity) {
31802           removed = [];
31803           added = entity.nodes;
31804         }
31805         for (i3 = 0; i3 < removed.length; i3++) {
31806           parentWays[removed[i3]] = new Set(parentWays[removed[i3]]);
31807           parentWays[removed[i3]].delete(oldentity.id);
31808         }
31809         for (i3 = 0; i3 < added.length; i3++) {
31810           parentWays[added[i3]] = new Set(parentWays[added[i3]]);
31811           parentWays[added[i3]].add(entity.id);
31812         }
31813       } else if (type2 === "relation") {
31814         var oldentityMemberIDs = oldentity ? oldentity.members.map(function(m2) {
31815           return m2.id;
31816         }) : [];
31817         var entityMemberIDs = entity ? entity.members.map(function(m2) {
31818           return m2.id;
31819         }) : [];
31820         if (oldentity && entity) {
31821           removed = utilArrayDifference(oldentityMemberIDs, entityMemberIDs);
31822           added = utilArrayDifference(entityMemberIDs, oldentityMemberIDs);
31823         } else if (oldentity) {
31824           removed = oldentityMemberIDs;
31825           added = [];
31826         } else if (entity) {
31827           removed = [];
31828           added = entityMemberIDs;
31829         }
31830         for (i3 = 0; i3 < removed.length; i3++) {
31831           parentRels[removed[i3]] = new Set(parentRels[removed[i3]]);
31832           parentRels[removed[i3]].delete(oldentity.id);
31833         }
31834         for (i3 = 0; i3 < added.length; i3++) {
31835           parentRels[added[i3]] = new Set(parentRels[added[i3]]);
31836           parentRels[added[i3]].add(entity.id);
31837         }
31838       }
31839     },
31840     replace: function(entity) {
31841       if (this.entities[entity.id] === entity)
31842         return this;
31843       return this.update(function() {
31844         this._updateCalculated(this.entities[entity.id], entity);
31845         this.entities[entity.id] = entity;
31846       });
31847     },
31848     remove: function(entity) {
31849       return this.update(function() {
31850         this._updateCalculated(entity, void 0);
31851         this.entities[entity.id] = void 0;
31852       });
31853     },
31854     revert: function(id2) {
31855       var baseEntity = this.base().entities[id2];
31856       var headEntity = this.entities[id2];
31857       if (headEntity === baseEntity)
31858         return this;
31859       return this.update(function() {
31860         this._updateCalculated(headEntity, baseEntity);
31861         delete this.entities[id2];
31862       });
31863     },
31864     update: function() {
31865       var graph = this.frozen ? coreGraph(this, true) : this;
31866       for (var i3 = 0; i3 < arguments.length; i3++) {
31867         arguments[i3].call(graph, graph);
31868       }
31869       if (this.frozen)
31870         graph.frozen = true;
31871       return graph;
31872     },
31873     // Obliterates any existing entities
31874     load: function(entities) {
31875       var base = this.base();
31876       this.entities = Object.create(base.entities);
31877       for (var i3 in entities) {
31878         this.entities[i3] = entities[i3];
31879         this._updateCalculated(base.entities[i3], this.entities[i3]);
31880       }
31881       return this;
31882     }
31883   };
31884
31885   // modules/osm/intersection.js
31886   function osmTurn(turn) {
31887     if (!(this instanceof osmTurn)) {
31888       return new osmTurn(turn);
31889     }
31890     Object.assign(this, turn);
31891   }
31892   function osmIntersection(graph, startVertexId, maxDistance) {
31893     maxDistance = maxDistance || 30;
31894     var vgraph = coreGraph();
31895     var i3, j3, k2;
31896     function memberOfRestriction(entity) {
31897       return graph.parentRelations(entity).some(function(r2) {
31898         return r2.isRestriction();
31899       });
31900     }
31901     function isRoad(way2) {
31902       if (way2.isArea() || way2.isDegenerate())
31903         return false;
31904       var roads = {
31905         "motorway": true,
31906         "motorway_link": true,
31907         "trunk": true,
31908         "trunk_link": true,
31909         "primary": true,
31910         "primary_link": true,
31911         "secondary": true,
31912         "secondary_link": true,
31913         "tertiary": true,
31914         "tertiary_link": true,
31915         "residential": true,
31916         "unclassified": true,
31917         "living_street": true,
31918         "service": true,
31919         "road": true,
31920         "track": true
31921       };
31922       return roads[way2.tags.highway];
31923     }
31924     var startNode = graph.entity(startVertexId);
31925     var checkVertices = [startNode];
31926     var checkWays;
31927     var vertices = [];
31928     var vertexIds = [];
31929     var vertex;
31930     var ways = [];
31931     var wayIds = [];
31932     var way;
31933     var nodes = [];
31934     var node;
31935     var parents = [];
31936     var parent;
31937     var actions = [];
31938     while (checkVertices.length) {
31939       vertex = checkVertices.pop();
31940       checkWays = graph.parentWays(vertex);
31941       var hasWays = false;
31942       for (i3 = 0; i3 < checkWays.length; i3++) {
31943         way = checkWays[i3];
31944         if (!isRoad(way) && !memberOfRestriction(way))
31945           continue;
31946         ways.push(way);
31947         hasWays = true;
31948         nodes = utilArrayUniq(graph.childNodes(way));
31949         for (j3 = 0; j3 < nodes.length; j3++) {
31950           node = nodes[j3];
31951           if (node === vertex)
31952             continue;
31953           if (vertices.indexOf(node) !== -1)
31954             continue;
31955           if (geoSphericalDistance(node.loc, startNode.loc) > maxDistance)
31956             continue;
31957           var hasParents = false;
31958           parents = graph.parentWays(node);
31959           for (k2 = 0; k2 < parents.length; k2++) {
31960             parent = parents[k2];
31961             if (parent === way)
31962               continue;
31963             if (ways.indexOf(parent) !== -1)
31964               continue;
31965             if (!isRoad(parent))
31966               continue;
31967             hasParents = true;
31968             break;
31969           }
31970           if (hasParents) {
31971             checkVertices.push(node);
31972           }
31973         }
31974       }
31975       if (hasWays) {
31976         vertices.push(vertex);
31977       }
31978     }
31979     vertices = utilArrayUniq(vertices);
31980     ways = utilArrayUniq(ways);
31981     ways.forEach(function(way2) {
31982       graph.childNodes(way2).forEach(function(node2) {
31983         vgraph = vgraph.replace(node2);
31984       });
31985       vgraph = vgraph.replace(way2);
31986       graph.parentRelations(way2).forEach(function(relation) {
31987         if (relation.isRestriction()) {
31988           if (relation.isValidRestriction(graph)) {
31989             vgraph = vgraph.replace(relation);
31990           } else if (relation.isComplete(graph)) {
31991             actions.push(actionDeleteRelation(relation.id));
31992           }
31993         }
31994       });
31995     });
31996     ways.forEach(function(w2) {
31997       var way2 = vgraph.entity(w2.id);
31998       if (way2.tags.oneway === "-1") {
31999         var action = actionReverse(way2.id, { reverseOneway: true });
32000         actions.push(action);
32001         vgraph = action(vgraph);
32002       }
32003     });
32004     var origCount = osmEntity.id.next.way;
32005     vertices.forEach(function(v2) {
32006       var splitAll = actionSplit([v2.id]).keepHistoryOn("first");
32007       if (!splitAll.disabled(vgraph)) {
32008         splitAll.ways(vgraph).forEach(function(way2) {
32009           var splitOne = actionSplit([v2.id]).limitWays([way2.id]).keepHistoryOn("first");
32010           actions.push(splitOne);
32011           vgraph = splitOne(vgraph);
32012         });
32013       }
32014     });
32015     osmEntity.id.next.way = origCount;
32016     vertexIds = vertices.map(function(v2) {
32017       return v2.id;
32018     });
32019     vertices = [];
32020     ways = [];
32021     vertexIds.forEach(function(id2) {
32022       var vertex2 = vgraph.entity(id2);
32023       var parents2 = vgraph.parentWays(vertex2);
32024       vertices.push(vertex2);
32025       ways = ways.concat(parents2);
32026     });
32027     vertices = utilArrayUniq(vertices);
32028     ways = utilArrayUniq(ways);
32029     vertexIds = vertices.map(function(v2) {
32030       return v2.id;
32031     });
32032     wayIds = ways.map(function(w2) {
32033       return w2.id;
32034     });
32035     function withMetadata(way2, vertexIds2) {
32036       var __oneWay = way2.isOneWay();
32037       var __first = vertexIds2.indexOf(way2.first()) !== -1;
32038       var __last = vertexIds2.indexOf(way2.last()) !== -1;
32039       var __via = __first && __last;
32040       var __from = __first && !__oneWay || __last;
32041       var __to = __first || __last && !__oneWay;
32042       return way2.update({
32043         __first,
32044         __last,
32045         __from,
32046         __via,
32047         __to,
32048         __oneWay
32049       });
32050     }
32051     ways = [];
32052     wayIds.forEach(function(id2) {
32053       var way2 = withMetadata(vgraph.entity(id2), vertexIds);
32054       vgraph = vgraph.replace(way2);
32055       ways.push(way2);
32056     });
32057     var keepGoing;
32058     var removeWayIds = [];
32059     var removeVertexIds = [];
32060     do {
32061       keepGoing = false;
32062       checkVertices = vertexIds.slice();
32063       for (i3 = 0; i3 < checkVertices.length; i3++) {
32064         var vertexId = checkVertices[i3];
32065         vertex = vgraph.hasEntity(vertexId);
32066         if (!vertex) {
32067           if (vertexIds.indexOf(vertexId) !== -1) {
32068             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
32069           }
32070           removeVertexIds.push(vertexId);
32071           continue;
32072         }
32073         parents = vgraph.parentWays(vertex);
32074         if (parents.length < 3) {
32075           if (vertexIds.indexOf(vertexId) !== -1) {
32076             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
32077           }
32078         }
32079         if (parents.length === 2) {
32080           var a2 = parents[0];
32081           var b2 = parents[1];
32082           var aIsLeaf = a2 && !a2.__via;
32083           var bIsLeaf = b2 && !b2.__via;
32084           var leaf, survivor;
32085           if (aIsLeaf && !bIsLeaf) {
32086             leaf = a2;
32087             survivor = b2;
32088           } else if (!aIsLeaf && bIsLeaf) {
32089             leaf = b2;
32090             survivor = a2;
32091           }
32092           if (leaf && survivor) {
32093             survivor = withMetadata(survivor, vertexIds);
32094             vgraph = vgraph.replace(survivor).remove(leaf);
32095             removeWayIds.push(leaf.id);
32096             keepGoing = true;
32097           }
32098         }
32099         parents = vgraph.parentWays(vertex);
32100         if (parents.length < 2) {
32101           if (vertexIds.indexOf(vertexId) !== -1) {
32102             vertexIds.splice(vertexIds.indexOf(vertexId), 1);
32103           }
32104           removeVertexIds.push(vertexId);
32105           keepGoing = true;
32106         }
32107         if (parents.length < 1) {
32108           vgraph = vgraph.remove(vertex);
32109         }
32110       }
32111     } while (keepGoing);
32112     vertices = vertices.filter(function(vertex2) {
32113       return removeVertexIds.indexOf(vertex2.id) === -1;
32114     }).map(function(vertex2) {
32115       return vgraph.entity(vertex2.id);
32116     });
32117     ways = ways.filter(function(way2) {
32118       return removeWayIds.indexOf(way2.id) === -1;
32119     }).map(function(way2) {
32120       return vgraph.entity(way2.id);
32121     });
32122     var intersection = {
32123       graph: vgraph,
32124       actions,
32125       vertices,
32126       ways
32127     };
32128     intersection.turns = function(fromWayId, maxViaWay) {
32129       if (!fromWayId)
32130         return [];
32131       if (!maxViaWay)
32132         maxViaWay = 0;
32133       var vgraph2 = intersection.graph;
32134       var keyVertexIds = intersection.vertices.map(function(v2) {
32135         return v2.id;
32136       });
32137       var start2 = vgraph2.entity(fromWayId);
32138       if (!start2 || !(start2.__from || start2.__via))
32139         return [];
32140       var maxPathLength = maxViaWay * 2 + 3;
32141       var turns = [];
32142       step(start2);
32143       return turns;
32144       function step(entity, currPath, currRestrictions, matchedRestriction) {
32145         currPath = (currPath || []).slice();
32146         if (currPath.length >= maxPathLength)
32147           return;
32148         currPath.push(entity.id);
32149         currRestrictions = (currRestrictions || []).slice();
32150         if (entity.type === "node") {
32151           stepNode(entity, currPath, currRestrictions);
32152         } else {
32153           stepWay(entity, currPath, currRestrictions, matchedRestriction);
32154         }
32155       }
32156       function stepNode(entity, currPath, currRestrictions) {
32157         var i4, j4;
32158         var parents2 = vgraph2.parentWays(entity);
32159         var nextWays = [];
32160         for (i4 = 0; i4 < parents2.length; i4++) {
32161           var way2 = parents2[i4];
32162           if (way2.__oneWay && way2.nodes[0] !== entity.id)
32163             continue;
32164           if (currPath.indexOf(way2.id) !== -1 && currPath.length >= 3)
32165             continue;
32166           var restrict = null;
32167           for (j4 = 0; j4 < currRestrictions.length; j4++) {
32168             var restriction = currRestrictions[j4];
32169             var f3 = restriction.memberByRole("from");
32170             var v2 = restriction.membersByRole("via");
32171             var t2 = restriction.memberByRole("to");
32172             var isNo = /^no_/.test(restriction.tags.restriction);
32173             var isOnly = /^only_/.test(restriction.tags.restriction);
32174             if (!(isNo || isOnly)) {
32175               continue;
32176             }
32177             var matchesFrom = f3.id === fromWayId;
32178             var matchesViaTo = false;
32179             var isAlongOnlyPath = false;
32180             if (t2.id === way2.id) {
32181               if (v2.length === 1 && v2[0].type === "node") {
32182                 matchesViaTo = v2[0].id === entity.id && (matchesFrom && currPath.length === 2 || !matchesFrom && currPath.length > 2);
32183               } else {
32184                 var pathVias = [];
32185                 for (k2 = 2; k2 < currPath.length; k2 += 2) {
32186                   pathVias.push(currPath[k2]);
32187                 }
32188                 var restrictionVias = [];
32189                 for (k2 = 0; k2 < v2.length; k2++) {
32190                   if (v2[k2].type === "way") {
32191                     restrictionVias.push(v2[k2].id);
32192                   }
32193                 }
32194                 var diff = utilArrayDifference(pathVias, restrictionVias);
32195                 matchesViaTo = !diff.length;
32196               }
32197             } else if (isOnly) {
32198               for (k2 = 0; k2 < v2.length; k2++) {
32199                 if (v2[k2].type === "way" && v2[k2].id === way2.id) {
32200                   isAlongOnlyPath = true;
32201                   break;
32202                 }
32203               }
32204             }
32205             if (matchesViaTo) {
32206               if (isOnly) {
32207                 restrict = { id: restriction.id, direct: matchesFrom, from: f3.id, only: true, end: true };
32208               } else {
32209                 restrict = { id: restriction.id, direct: matchesFrom, from: f3.id, no: true, end: true };
32210               }
32211             } else {
32212               if (isAlongOnlyPath) {
32213                 restrict = { id: restriction.id, direct: false, from: f3.id, only: true, end: false };
32214               } else if (isOnly) {
32215                 restrict = { id: restriction.id, direct: false, from: f3.id, no: true, end: true };
32216               }
32217             }
32218             if (restrict && restrict.direct)
32219               break;
32220           }
32221           nextWays.push({ way: way2, restrict });
32222         }
32223         nextWays.forEach(function(nextWay) {
32224           step(nextWay.way, currPath, currRestrictions, nextWay.restrict);
32225         });
32226       }
32227       function stepWay(entity, currPath, currRestrictions, matchedRestriction) {
32228         var i4;
32229         if (currPath.length >= 3) {
32230           var turnPath = currPath.slice();
32231           if (matchedRestriction && matchedRestriction.direct === false) {
32232             for (i4 = 0; i4 < turnPath.length; i4++) {
32233               if (turnPath[i4] === matchedRestriction.from) {
32234                 turnPath = turnPath.slice(i4);
32235                 break;
32236               }
32237             }
32238           }
32239           var turn = pathToTurn(turnPath);
32240           if (turn) {
32241             if (matchedRestriction) {
32242               turn.restrictionID = matchedRestriction.id;
32243               turn.no = matchedRestriction.no;
32244               turn.only = matchedRestriction.only;
32245               turn.direct = matchedRestriction.direct;
32246             }
32247             turns.push(osmTurn(turn));
32248           }
32249           if (currPath[0] === currPath[2])
32250             return;
32251         }
32252         if (matchedRestriction && matchedRestriction.end)
32253           return;
32254         var n1 = vgraph2.entity(entity.first());
32255         var n22 = vgraph2.entity(entity.last());
32256         var dist = geoSphericalDistance(n1.loc, n22.loc);
32257         var nextNodes = [];
32258         if (currPath.length > 1) {
32259           if (dist > maxDistance)
32260             return;
32261           if (!entity.__via)
32262             return;
32263         }
32264         if (!entity.__oneWay && // bidirectional..
32265         keyVertexIds.indexOf(n1.id) !== -1 && // key vertex..
32266         currPath.indexOf(n1.id) === -1) {
32267           nextNodes.push(n1);
32268         }
32269         if (keyVertexIds.indexOf(n22.id) !== -1 && // key vertex..
32270         currPath.indexOf(n22.id) === -1) {
32271           nextNodes.push(n22);
32272         }
32273         nextNodes.forEach(function(nextNode) {
32274           var fromRestrictions = vgraph2.parentRelations(entity).filter(function(r2) {
32275             if (!r2.isRestriction())
32276               return false;
32277             var f3 = r2.memberByRole("from");
32278             if (!f3 || f3.id !== entity.id)
32279               return false;
32280             var isOnly = /^only_/.test(r2.tags.restriction);
32281             if (!isOnly)
32282               return true;
32283             var isOnlyVia = false;
32284             var v2 = r2.membersByRole("via");
32285             if (v2.length === 1 && v2[0].type === "node") {
32286               isOnlyVia = v2[0].id === nextNode.id;
32287             } else {
32288               for (var i5 = 0; i5 < v2.length; i5++) {
32289                 if (v2[i5].type !== "way")
32290                   continue;
32291                 var viaWay = vgraph2.entity(v2[i5].id);
32292                 if (viaWay.first() === nextNode.id || viaWay.last() === nextNode.id) {
32293                   isOnlyVia = true;
32294                   break;
32295                 }
32296               }
32297             }
32298             return isOnlyVia;
32299           });
32300           step(nextNode, currPath, currRestrictions.concat(fromRestrictions), false);
32301         });
32302       }
32303       function pathToTurn(path) {
32304         if (path.length < 3)
32305           return;
32306         var fromWayId2, fromNodeId, fromVertexId;
32307         var toWayId, toNodeId, toVertexId;
32308         var viaWayIds, viaNodeId, isUturn;
32309         fromWayId2 = path[0];
32310         toWayId = path[path.length - 1];
32311         if (path.length === 3 && fromWayId2 === toWayId) {
32312           var way2 = vgraph2.entity(fromWayId2);
32313           if (way2.__oneWay)
32314             return null;
32315           isUturn = true;
32316           viaNodeId = fromVertexId = toVertexId = path[1];
32317           fromNodeId = toNodeId = adjacentNode(fromWayId2, viaNodeId);
32318         } else {
32319           isUturn = false;
32320           fromVertexId = path[1];
32321           fromNodeId = adjacentNode(fromWayId2, fromVertexId);
32322           toVertexId = path[path.length - 2];
32323           toNodeId = adjacentNode(toWayId, toVertexId);
32324           if (path.length === 3) {
32325             viaNodeId = path[1];
32326           } else {
32327             viaWayIds = path.filter(function(entityId) {
32328               return entityId[0] === "w";
32329             });
32330             viaWayIds = viaWayIds.slice(1, viaWayIds.length - 1);
32331           }
32332         }
32333         return {
32334           key: path.join("_"),
32335           path,
32336           from: { node: fromNodeId, way: fromWayId2, vertex: fromVertexId },
32337           via: { node: viaNodeId, ways: viaWayIds },
32338           to: { node: toNodeId, way: toWayId, vertex: toVertexId },
32339           u: isUturn
32340         };
32341         function adjacentNode(wayId, affixId) {
32342           var nodes2 = vgraph2.entity(wayId).nodes;
32343           return affixId === nodes2[0] ? nodes2[1] : nodes2[nodes2.length - 2];
32344         }
32345       }
32346     };
32347     return intersection;
32348   }
32349   function osmInferRestriction(graph, turn, projection2) {
32350     var fromWay = graph.entity(turn.from.way);
32351     var fromNode = graph.entity(turn.from.node);
32352     var fromVertex = graph.entity(turn.from.vertex);
32353     var toWay = graph.entity(turn.to.way);
32354     var toNode = graph.entity(turn.to.node);
32355     var toVertex = graph.entity(turn.to.vertex);
32356     var fromOneWay = fromWay.tags.oneway === "yes";
32357     var toOneWay = toWay.tags.oneway === "yes";
32358     var angle2 = (geoAngle(fromVertex, fromNode, projection2) - geoAngle(toVertex, toNode, projection2)) * 180 / Math.PI;
32359     while (angle2 < 0) {
32360       angle2 += 360;
32361     }
32362     if (fromNode === toNode) {
32363       return "no_u_turn";
32364     }
32365     if ((angle2 < 23 || angle2 > 336) && fromOneWay && toOneWay) {
32366       return "no_u_turn";
32367     }
32368     if ((angle2 < 40 || angle2 > 319) && fromOneWay && toOneWay && turn.from.vertex !== turn.to.vertex) {
32369       return "no_u_turn";
32370     }
32371     if (angle2 < 158) {
32372       return "no_right_turn";
32373     }
32374     if (angle2 > 202) {
32375       return "no_left_turn";
32376     }
32377     return "no_straight_on";
32378   }
32379
32380   // modules/actions/merge_polygon.js
32381   function actionMergePolygon(ids, newRelationId) {
32382     function groupEntities(graph) {
32383       var entities = ids.map(function(id2) {
32384         return graph.entity(id2);
32385       });
32386       var geometryGroups = utilArrayGroupBy(entities, function(entity) {
32387         if (entity.type === "way" && entity.isClosed()) {
32388           return "closedWay";
32389         } else if (entity.type === "relation" && entity.isMultipolygon()) {
32390           return "multipolygon";
32391         } else {
32392           return "other";
32393         }
32394       });
32395       return Object.assign(
32396         { closedWay: [], multipolygon: [], other: [] },
32397         geometryGroups
32398       );
32399     }
32400     var action = function(graph) {
32401       var entities = groupEntities(graph);
32402       var polygons = entities.multipolygon.reduce(function(polygons2, m2) {
32403         return polygons2.concat(osmJoinWays(m2.members, graph));
32404       }, []).concat(entities.closedWay.map(function(d2) {
32405         var member = [{ id: d2.id }];
32406         member.nodes = graph.childNodes(d2);
32407         return member;
32408       }));
32409       var contained = polygons.map(function(w2, i3) {
32410         return polygons.map(function(d2, n3) {
32411           if (i3 === n3)
32412             return null;
32413           return geoPolygonContainsPolygon(
32414             d2.nodes.map(function(n4) {
32415               return n4.loc;
32416             }),
32417             w2.nodes.map(function(n4) {
32418               return n4.loc;
32419             })
32420           );
32421         });
32422       });
32423       var members = [];
32424       var outer = true;
32425       while (polygons.length) {
32426         extractUncontained(polygons);
32427         polygons = polygons.filter(isContained);
32428         contained = contained.filter(isContained).map(filterContained);
32429       }
32430       function isContained(d2, i3) {
32431         return contained[i3].some(function(val) {
32432           return val;
32433         });
32434       }
32435       function filterContained(d2) {
32436         return d2.filter(isContained);
32437       }
32438       function extractUncontained(polygons2) {
32439         polygons2.forEach(function(d2, i3) {
32440           if (!isContained(d2, i3)) {
32441             d2.forEach(function(member) {
32442               members.push({
32443                 type: "way",
32444                 id: member.id,
32445                 role: outer ? "outer" : "inner"
32446               });
32447             });
32448           }
32449         });
32450         outer = !outer;
32451       }
32452       var relation;
32453       if (entities.multipolygon.length > 0) {
32454         var oldestID = utilOldestID(entities.multipolygon.map((entity) => entity.id));
32455         relation = entities.multipolygon.find((entity) => entity.id === oldestID);
32456       } else {
32457         relation = osmRelation({ id: newRelationId, tags: { type: "multipolygon" } });
32458       }
32459       entities.multipolygon.forEach(function(m2) {
32460         if (m2.id !== relation.id) {
32461           relation = relation.mergeTags(m2.tags);
32462           graph = graph.remove(m2);
32463         }
32464       });
32465       entities.closedWay.forEach(function(way) {
32466         function isThisOuter(m2) {
32467           return m2.id === way.id && m2.role !== "inner";
32468         }
32469         if (members.some(isThisOuter)) {
32470           relation = relation.mergeTags(way.tags);
32471           graph = graph.replace(way.update({ tags: {} }));
32472         }
32473       });
32474       return graph.replace(relation.update({
32475         members,
32476         tags: utilObjectOmit(relation.tags, ["area"])
32477       }));
32478     };
32479     action.disabled = function(graph) {
32480       var entities = groupEntities(graph);
32481       if (entities.other.length > 0 || entities.closedWay.length + entities.multipolygon.length < 2) {
32482         return "not_eligible";
32483       }
32484       if (!entities.multipolygon.every(function(r2) {
32485         return r2.isComplete(graph);
32486       })) {
32487         return "incomplete_relation";
32488       }
32489       if (!entities.multipolygon.length) {
32490         var sharedMultipolygons = [];
32491         entities.closedWay.forEach(function(way, i3) {
32492           if (i3 === 0) {
32493             sharedMultipolygons = graph.parentMultipolygons(way);
32494           } else {
32495             sharedMultipolygons = utilArrayIntersection(sharedMultipolygons, graph.parentMultipolygons(way));
32496           }
32497         });
32498         sharedMultipolygons = sharedMultipolygons.filter(function(relation) {
32499           return relation.members.length === entities.closedWay.length;
32500         });
32501         if (sharedMultipolygons.length) {
32502           return "not_eligible";
32503         }
32504       } else if (entities.closedWay.some(function(way) {
32505         return utilArrayIntersection(graph.parentMultipolygons(way), entities.multipolygon).length;
32506       })) {
32507         return "not_eligible";
32508       }
32509     };
32510     return action;
32511   }
32512
32513   // modules/actions/merge_remote_changes.js
32514   var import_fast_deep_equal = __toESM(require_fast_deep_equal());
32515
32516   // node_modules/node-diff3/index.mjs
32517   function LCS(buffer1, buffer2) {
32518     let equivalenceClasses = {};
32519     for (let j3 = 0; j3 < buffer2.length; j3++) {
32520       const item = buffer2[j3];
32521       if (equivalenceClasses[item]) {
32522         equivalenceClasses[item].push(j3);
32523       } else {
32524         equivalenceClasses[item] = [j3];
32525       }
32526     }
32527     const NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null };
32528     let candidates = [NULLRESULT];
32529     for (let i3 = 0; i3 < buffer1.length; i3++) {
32530       const item = buffer1[i3];
32531       const buffer2indices = equivalenceClasses[item] || [];
32532       let r2 = 0;
32533       let c2 = candidates[0];
32534       for (let jx = 0; jx < buffer2indices.length; jx++) {
32535         const j3 = buffer2indices[jx];
32536         let s2;
32537         for (s2 = r2; s2 < candidates.length; s2++) {
32538           if (candidates[s2].buffer2index < j3 && (s2 === candidates.length - 1 || candidates[s2 + 1].buffer2index > j3)) {
32539             break;
32540           }
32541         }
32542         if (s2 < candidates.length) {
32543           const newCandidate = { buffer1index: i3, buffer2index: j3, chain: candidates[s2] };
32544           if (r2 === candidates.length) {
32545             candidates.push(c2);
32546           } else {
32547             candidates[r2] = c2;
32548           }
32549           r2 = s2 + 1;
32550           c2 = newCandidate;
32551           if (r2 === candidates.length) {
32552             break;
32553           }
32554         }
32555       }
32556       candidates[r2] = c2;
32557     }
32558     return candidates[candidates.length - 1];
32559   }
32560   function diffIndices(buffer1, buffer2) {
32561     const lcs = LCS(buffer1, buffer2);
32562     let result = [];
32563     let tail1 = buffer1.length;
32564     let tail2 = buffer2.length;
32565     for (let candidate = lcs; candidate !== null; candidate = candidate.chain) {
32566       const mismatchLength1 = tail1 - candidate.buffer1index - 1;
32567       const mismatchLength2 = tail2 - candidate.buffer2index - 1;
32568       tail1 = candidate.buffer1index;
32569       tail2 = candidate.buffer2index;
32570       if (mismatchLength1 || mismatchLength2) {
32571         result.push({
32572           buffer1: [tail1 + 1, mismatchLength1],
32573           buffer1Content: buffer1.slice(tail1 + 1, tail1 + 1 + mismatchLength1),
32574           buffer2: [tail2 + 1, mismatchLength2],
32575           buffer2Content: buffer2.slice(tail2 + 1, tail2 + 1 + mismatchLength2)
32576         });
32577       }
32578     }
32579     result.reverse();
32580     return result;
32581   }
32582   function diff3MergeRegions(a2, o2, b2) {
32583     let hunks = [];
32584     function addHunk(h2, ab) {
32585       hunks.push({
32586         ab,
32587         oStart: h2.buffer1[0],
32588         oLength: h2.buffer1[1],
32589         // length of o to remove
32590         abStart: h2.buffer2[0],
32591         abLength: h2.buffer2[1]
32592         // length of a/b to insert
32593         // abContent: (ab === 'a' ? a : b).slice(h.buffer2[0], h.buffer2[0] + h.buffer2[1])
32594       });
32595     }
32596     diffIndices(o2, a2).forEach((item) => addHunk(item, "a"));
32597     diffIndices(o2, b2).forEach((item) => addHunk(item, "b"));
32598     hunks.sort((x2, y2) => x2.oStart - y2.oStart);
32599     let results = [];
32600     let currOffset = 0;
32601     function advanceTo(endOffset) {
32602       if (endOffset > currOffset) {
32603         results.push({
32604           stable: true,
32605           buffer: "o",
32606           bufferStart: currOffset,
32607           bufferLength: endOffset - currOffset,
32608           bufferContent: o2.slice(currOffset, endOffset)
32609         });
32610         currOffset = endOffset;
32611       }
32612     }
32613     while (hunks.length) {
32614       let hunk = hunks.shift();
32615       let regionStart = hunk.oStart;
32616       let regionEnd = hunk.oStart + hunk.oLength;
32617       let regionHunks = [hunk];
32618       advanceTo(regionStart);
32619       while (hunks.length) {
32620         const nextHunk = hunks[0];
32621         const nextHunkStart = nextHunk.oStart;
32622         if (nextHunkStart > regionEnd)
32623           break;
32624         regionEnd = Math.max(regionEnd, nextHunkStart + nextHunk.oLength);
32625         regionHunks.push(hunks.shift());
32626       }
32627       if (regionHunks.length === 1) {
32628         if (hunk.abLength > 0) {
32629           const buffer = hunk.ab === "a" ? a2 : b2;
32630           results.push({
32631             stable: true,
32632             buffer: hunk.ab,
32633             bufferStart: hunk.abStart,
32634             bufferLength: hunk.abLength,
32635             bufferContent: buffer.slice(hunk.abStart, hunk.abStart + hunk.abLength)
32636           });
32637         }
32638       } else {
32639         let bounds = {
32640           a: [a2.length, -1, o2.length, -1],
32641           b: [b2.length, -1, o2.length, -1]
32642         };
32643         while (regionHunks.length) {
32644           hunk = regionHunks.shift();
32645           const oStart = hunk.oStart;
32646           const oEnd = oStart + hunk.oLength;
32647           const abStart = hunk.abStart;
32648           const abEnd = abStart + hunk.abLength;
32649           let b3 = bounds[hunk.ab];
32650           b3[0] = Math.min(abStart, b3[0]);
32651           b3[1] = Math.max(abEnd, b3[1]);
32652           b3[2] = Math.min(oStart, b3[2]);
32653           b3[3] = Math.max(oEnd, b3[3]);
32654         }
32655         const aStart = bounds.a[0] + (regionStart - bounds.a[2]);
32656         const aEnd = bounds.a[1] + (regionEnd - bounds.a[3]);
32657         const bStart = bounds.b[0] + (regionStart - bounds.b[2]);
32658         const bEnd = bounds.b[1] + (regionEnd - bounds.b[3]);
32659         let result = {
32660           stable: false,
32661           aStart,
32662           aLength: aEnd - aStart,
32663           aContent: a2.slice(aStart, aEnd),
32664           oStart: regionStart,
32665           oLength: regionEnd - regionStart,
32666           oContent: o2.slice(regionStart, regionEnd),
32667           bStart,
32668           bLength: bEnd - bStart,
32669           bContent: b2.slice(bStart, bEnd)
32670         };
32671         results.push(result);
32672       }
32673       currOffset = regionEnd;
32674     }
32675     advanceTo(o2.length);
32676     return results;
32677   }
32678   function diff3Merge(a2, o2, b2, options2) {
32679     let defaults = {
32680       excludeFalseConflicts: true,
32681       stringSeparator: /\s+/
32682     };
32683     options2 = Object.assign(defaults, options2);
32684     if (typeof a2 === "string")
32685       a2 = a2.split(options2.stringSeparator);
32686     if (typeof o2 === "string")
32687       o2 = o2.split(options2.stringSeparator);
32688     if (typeof b2 === "string")
32689       b2 = b2.split(options2.stringSeparator);
32690     let results = [];
32691     const regions = diff3MergeRegions(a2, o2, b2);
32692     let okBuffer = [];
32693     function flushOk() {
32694       if (okBuffer.length) {
32695         results.push({ ok: okBuffer });
32696       }
32697       okBuffer = [];
32698     }
32699     function isFalseConflict(a3, b3) {
32700       if (a3.length !== b3.length)
32701         return false;
32702       for (let i3 = 0; i3 < a3.length; i3++) {
32703         if (a3[i3] !== b3[i3])
32704           return false;
32705       }
32706       return true;
32707     }
32708     regions.forEach((region) => {
32709       if (region.stable) {
32710         okBuffer.push(...region.bufferContent);
32711       } else {
32712         if (options2.excludeFalseConflicts && isFalseConflict(region.aContent, region.bContent)) {
32713           okBuffer.push(...region.aContent);
32714         } else {
32715           flushOk();
32716           results.push({
32717             conflict: {
32718               a: region.aContent,
32719               aIndex: region.aStart,
32720               o: region.oContent,
32721               oIndex: region.oStart,
32722               b: region.bContent,
32723               bIndex: region.bStart
32724             }
32725           });
32726         }
32727       }
32728     });
32729     flushOk();
32730     return results;
32731   }
32732
32733   // modules/actions/merge_remote_changes.js
32734   var import_lodash2 = __toESM(require_lodash());
32735   function actionMergeRemoteChanges(id2, localGraph, remoteGraph, discardTags, formatUser) {
32736     discardTags = discardTags || {};
32737     var _option = "safe";
32738     var _conflicts = [];
32739     function user(d2) {
32740       return typeof formatUser === "function" ? formatUser(d2) : (0, import_lodash2.escape)(d2);
32741     }
32742     function mergeLocation(remote, target) {
32743       function pointEqual(a2, b2) {
32744         var epsilon3 = 1e-6;
32745         return Math.abs(a2[0] - b2[0]) < epsilon3 && Math.abs(a2[1] - b2[1]) < epsilon3;
32746       }
32747       if (_option === "force_local" || pointEqual(target.loc, remote.loc)) {
32748         return target;
32749       }
32750       if (_option === "force_remote") {
32751         return target.update({ loc: remote.loc });
32752       }
32753       _conflicts.push(_t.html("merge_remote_changes.conflict.location", { user: { html: user(remote.user) } }));
32754       return target;
32755     }
32756     function mergeNodes(base, remote, target) {
32757       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.nodes, remote.nodes)) {
32758         return target;
32759       }
32760       if (_option === "force_remote") {
32761         return target.update({ nodes: remote.nodes });
32762       }
32763       var ccount = _conflicts.length;
32764       var o2 = base.nodes || [];
32765       var a2 = target.nodes || [];
32766       var b2 = remote.nodes || [];
32767       var nodes = [];
32768       var hunks = diff3Merge(a2, o2, b2, { excludeFalseConflicts: true });
32769       for (var i3 = 0; i3 < hunks.length; i3++) {
32770         var hunk = hunks[i3];
32771         if (hunk.ok) {
32772           nodes.push.apply(nodes, hunk.ok);
32773         } else {
32774           var c2 = hunk.conflict;
32775           if ((0, import_fast_deep_equal.default)(c2.o, c2.a)) {
32776             nodes.push.apply(nodes, c2.b);
32777           } else if ((0, import_fast_deep_equal.default)(c2.o, c2.b)) {
32778             nodes.push.apply(nodes, c2.a);
32779           } else {
32780             _conflicts.push(_t.html("merge_remote_changes.conflict.nodelist", { user: { html: user(remote.user) } }));
32781             break;
32782           }
32783         }
32784       }
32785       return _conflicts.length === ccount ? target.update({ nodes }) : target;
32786     }
32787     function mergeChildren(targetWay, children2, updates, graph) {
32788       function isUsed(node2, targetWay2) {
32789         var hasInterestingParent = graph.parentWays(node2).some(function(way) {
32790           return way.id !== targetWay2.id;
32791         });
32792         return node2.hasInterestingTags() || hasInterestingParent || graph.parentRelations(node2).length > 0;
32793       }
32794       var ccount = _conflicts.length;
32795       for (var i3 = 0; i3 < children2.length; i3++) {
32796         var id3 = children2[i3];
32797         var node = graph.hasEntity(id3);
32798         if (targetWay.nodes.indexOf(id3) === -1) {
32799           if (node && !isUsed(node, targetWay)) {
32800             updates.removeIds.push(id3);
32801           }
32802           continue;
32803         }
32804         var local = localGraph.hasEntity(id3);
32805         var remote = remoteGraph.hasEntity(id3);
32806         var target;
32807         if (_option === "force_remote" && remote && remote.visible) {
32808           updates.replacements.push(remote);
32809         } else if (_option === "force_local" && local) {
32810           target = osmEntity(local);
32811           if (remote) {
32812             target = target.update({ version: remote.version });
32813           }
32814           updates.replacements.push(target);
32815         } else if (_option === "safe" && local && remote && local.version !== remote.version) {
32816           target = osmEntity(local, { version: remote.version });
32817           if (remote.visible) {
32818             target = mergeLocation(remote, target);
32819           } else {
32820             _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
32821           }
32822           if (_conflicts.length !== ccount)
32823             break;
32824           updates.replacements.push(target);
32825         }
32826       }
32827       return targetWay;
32828     }
32829     function updateChildren(updates, graph) {
32830       for (var i3 = 0; i3 < updates.replacements.length; i3++) {
32831         graph = graph.replace(updates.replacements[i3]);
32832       }
32833       if (updates.removeIds.length) {
32834         graph = actionDeleteMultiple(updates.removeIds)(graph);
32835       }
32836       return graph;
32837     }
32838     function mergeMembers(remote, target) {
32839       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.members, remote.members)) {
32840         return target;
32841       }
32842       if (_option === "force_remote") {
32843         return target.update({ members: remote.members });
32844       }
32845       _conflicts.push(_t.html("merge_remote_changes.conflict.memberlist", { user: { html: user(remote.user) } }));
32846       return target;
32847     }
32848     function mergeTags(base, remote, target) {
32849       if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.tags, remote.tags)) {
32850         return target;
32851       }
32852       if (_option === "force_remote") {
32853         return target.update({ tags: remote.tags });
32854       }
32855       var ccount = _conflicts.length;
32856       var o2 = base.tags || {};
32857       var a2 = target.tags || {};
32858       var b2 = remote.tags || {};
32859       var keys2 = utilArrayUnion(utilArrayUnion(Object.keys(o2), Object.keys(a2)), Object.keys(b2)).filter(function(k3) {
32860         return !discardTags[k3];
32861       });
32862       var tags = Object.assign({}, a2);
32863       var changed = false;
32864       for (var i3 = 0; i3 < keys2.length; i3++) {
32865         var k2 = keys2[i3];
32866         if (o2[k2] !== b2[k2] && a2[k2] !== b2[k2]) {
32867           if (o2[k2] !== a2[k2]) {
32868             _conflicts.push(_t.html(
32869               "merge_remote_changes.conflict.tags",
32870               { tag: k2, local: a2[k2], remote: b2[k2], user: { html: user(remote.user) } }
32871             ));
32872           } else {
32873             if (b2.hasOwnProperty(k2)) {
32874               tags[k2] = b2[k2];
32875             } else {
32876               delete tags[k2];
32877             }
32878             changed = true;
32879           }
32880         }
32881       }
32882       return changed && _conflicts.length === ccount ? target.update({ tags }) : target;
32883     }
32884     var action = function(graph) {
32885       var updates = { replacements: [], removeIds: [] };
32886       var base = graph.base().entities[id2];
32887       var local = localGraph.entity(id2);
32888       var remote = remoteGraph.entity(id2);
32889       var target = osmEntity(local, { version: remote.version });
32890       if (!remote.visible) {
32891         if (_option === "force_remote") {
32892           return actionDeleteMultiple([id2])(graph);
32893         } else if (_option === "force_local") {
32894           if (target.type === "way") {
32895             target = mergeChildren(target, utilArrayUniq(local.nodes), updates, graph);
32896             graph = updateChildren(updates, graph);
32897           }
32898           return graph.replace(target);
32899         } else {
32900           _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
32901           return graph;
32902         }
32903       }
32904       if (target.type === "node") {
32905         target = mergeLocation(remote, target);
32906       } else if (target.type === "way") {
32907         graph.rebase(remoteGraph.childNodes(remote), [graph], false);
32908         target = mergeNodes(base, remote, target);
32909         target = mergeChildren(target, utilArrayUnion(local.nodes, remote.nodes), updates, graph);
32910       } else if (target.type === "relation") {
32911         target = mergeMembers(remote, target);
32912       }
32913       target = mergeTags(base, remote, target);
32914       if (!_conflicts.length) {
32915         graph = updateChildren(updates, graph).replace(target);
32916       }
32917       return graph;
32918     };
32919     action.withOption = function(opt) {
32920       _option = opt;
32921       return action;
32922     };
32923     action.conflicts = function() {
32924       return _conflicts;
32925     };
32926     return action;
32927   }
32928
32929   // modules/actions/move.js
32930   function actionMove(moveIDs, tryDelta, projection2, cache) {
32931     var _delta = tryDelta;
32932     function setupCache(graph) {
32933       function canMove(nodeID) {
32934         if (moveIDs.indexOf(nodeID) !== -1)
32935           return true;
32936         var parents = graph.parentWays(graph.entity(nodeID));
32937         if (parents.length < 3)
32938           return true;
32939         var parentsMoving = parents.every(function(way) {
32940           return cache.moving[way.id];
32941         });
32942         if (!parentsMoving)
32943           delete cache.moving[nodeID];
32944         return parentsMoving;
32945       }
32946       function cacheEntities(ids) {
32947         for (var i3 = 0; i3 < ids.length; i3++) {
32948           var id2 = ids[i3];
32949           if (cache.moving[id2])
32950             continue;
32951           cache.moving[id2] = true;
32952           var entity = graph.hasEntity(id2);
32953           if (!entity)
32954             continue;
32955           if (entity.type === "node") {
32956             cache.nodes.push(id2);
32957             cache.startLoc[id2] = entity.loc;
32958           } else if (entity.type === "way") {
32959             cache.ways.push(id2);
32960             cacheEntities(entity.nodes);
32961           } else {
32962             cacheEntities(entity.members.map(function(member) {
32963               return member.id;
32964             }));
32965           }
32966         }
32967       }
32968       function cacheIntersections(ids) {
32969         function isEndpoint(way2, id3) {
32970           return !way2.isClosed() && !!way2.affix(id3);
32971         }
32972         for (var i3 = 0; i3 < ids.length; i3++) {
32973           var id2 = ids[i3];
32974           var childNodes = graph.childNodes(graph.entity(id2));
32975           for (var j3 = 0; j3 < childNodes.length; j3++) {
32976             var node = childNodes[j3];
32977             var parents = graph.parentWays(node);
32978             if (parents.length !== 2)
32979               continue;
32980             var moved = graph.entity(id2);
32981             var unmoved = null;
32982             for (var k2 = 0; k2 < parents.length; k2++) {
32983               var way = parents[k2];
32984               if (!cache.moving[way.id]) {
32985                 unmoved = way;
32986                 break;
32987               }
32988             }
32989             if (!unmoved)
32990               continue;
32991             if (utilArrayIntersection(moved.nodes, unmoved.nodes).length > 2)
32992               continue;
32993             if (moved.isArea() || unmoved.isArea())
32994               continue;
32995             cache.intersections.push({
32996               nodeId: node.id,
32997               movedId: moved.id,
32998               unmovedId: unmoved.id,
32999               movedIsEP: isEndpoint(moved, node.id),
33000               unmovedIsEP: isEndpoint(unmoved, node.id)
33001             });
33002           }
33003         }
33004       }
33005       if (!cache) {
33006         cache = {};
33007       }
33008       if (!cache.ok) {
33009         cache.moving = {};
33010         cache.intersections = [];
33011         cache.replacedVertex = {};
33012         cache.startLoc = {};
33013         cache.nodes = [];
33014         cache.ways = [];
33015         cacheEntities(moveIDs);
33016         cacheIntersections(cache.ways);
33017         cache.nodes = cache.nodes.filter(canMove);
33018         cache.ok = true;
33019       }
33020     }
33021     function replaceMovedVertex(nodeId, wayId, graph, delta) {
33022       var way = graph.entity(wayId);
33023       var moved = graph.entity(nodeId);
33024       var movedIndex = way.nodes.indexOf(nodeId);
33025       var len, prevIndex, nextIndex;
33026       if (way.isClosed()) {
33027         len = way.nodes.length - 1;
33028         prevIndex = (movedIndex + len - 1) % len;
33029         nextIndex = (movedIndex + len + 1) % len;
33030       } else {
33031         len = way.nodes.length;
33032         prevIndex = movedIndex - 1;
33033         nextIndex = movedIndex + 1;
33034       }
33035       var prev = graph.hasEntity(way.nodes[prevIndex]);
33036       var next = graph.hasEntity(way.nodes[nextIndex]);
33037       if (!prev || !next)
33038         return graph;
33039       var key = wayId + "_" + nodeId;
33040       var orig = cache.replacedVertex[key];
33041       if (!orig) {
33042         orig = osmNode();
33043         cache.replacedVertex[key] = orig;
33044         cache.startLoc[orig.id] = cache.startLoc[nodeId];
33045       }
33046       var start2, end;
33047       if (delta) {
33048         start2 = projection2(cache.startLoc[nodeId]);
33049         end = projection2.invert(geoVecAdd(start2, delta));
33050       } else {
33051         end = cache.startLoc[nodeId];
33052       }
33053       orig = orig.move(end);
33054       var angle2 = Math.abs(geoAngle(orig, prev, projection2) - geoAngle(orig, next, projection2)) * 180 / Math.PI;
33055       if (angle2 > 175 && angle2 < 185)
33056         return graph;
33057       var p1 = [prev.loc, orig.loc, moved.loc, next.loc].map(projection2);
33058       var p2 = [prev.loc, moved.loc, orig.loc, next.loc].map(projection2);
33059       var d1 = geoPathLength(p1);
33060       var d2 = geoPathLength(p2);
33061       var insertAt = d1 <= d2 ? movedIndex : nextIndex;
33062       if (way.isClosed() && insertAt === 0)
33063         insertAt = len;
33064       way = way.addNode(orig.id, insertAt);
33065       return graph.replace(orig).replace(way);
33066     }
33067     function removeDuplicateVertices(wayId, graph) {
33068       var way = graph.entity(wayId);
33069       var epsilon3 = 1e-6;
33070       var prev, curr;
33071       function isInteresting(node, graph2) {
33072         return graph2.parentWays(node).length > 1 || graph2.parentRelations(node).length || node.hasInterestingTags();
33073       }
33074       for (var i3 = 0; i3 < way.nodes.length; i3++) {
33075         curr = graph.entity(way.nodes[i3]);
33076         if (prev && curr && geoVecEqual(prev.loc, curr.loc, epsilon3)) {
33077           if (!isInteresting(prev, graph)) {
33078             way = way.removeNode(prev.id);
33079             graph = graph.replace(way).remove(prev);
33080           } else if (!isInteresting(curr, graph)) {
33081             way = way.removeNode(curr.id);
33082             graph = graph.replace(way).remove(curr);
33083           }
33084         }
33085         prev = curr;
33086       }
33087       return graph;
33088     }
33089     function unZorroIntersection(intersection, graph) {
33090       var vertex = graph.entity(intersection.nodeId);
33091       var way1 = graph.entity(intersection.movedId);
33092       var way2 = graph.entity(intersection.unmovedId);
33093       var isEP1 = intersection.movedIsEP;
33094       var isEP2 = intersection.unmovedIsEP;
33095       if (isEP1 && isEP2)
33096         return graph;
33097       var nodes1 = graph.childNodes(way1).filter(function(n3) {
33098         return n3 !== vertex;
33099       });
33100       var nodes2 = graph.childNodes(way2).filter(function(n3) {
33101         return n3 !== vertex;
33102       });
33103       if (way1.isClosed() && way1.first() === vertex.id)
33104         nodes1.push(nodes1[0]);
33105       if (way2.isClosed() && way2.first() === vertex.id)
33106         nodes2.push(nodes2[0]);
33107       var edge1 = !isEP1 && geoChooseEdge(nodes1, projection2(vertex.loc), projection2);
33108       var edge2 = !isEP2 && geoChooseEdge(nodes2, projection2(vertex.loc), projection2);
33109       var loc;
33110       if (!isEP1 && !isEP2) {
33111         var epsilon3 = 1e-6, maxIter = 10;
33112         for (var i3 = 0; i3 < maxIter; i3++) {
33113           loc = geoVecInterp(edge1.loc, edge2.loc, 0.5);
33114           edge1 = geoChooseEdge(nodes1, projection2(loc), projection2);
33115           edge2 = geoChooseEdge(nodes2, projection2(loc), projection2);
33116           if (Math.abs(edge1.distance - edge2.distance) < epsilon3)
33117             break;
33118         }
33119       } else if (!isEP1) {
33120         loc = edge1.loc;
33121       } else {
33122         loc = edge2.loc;
33123       }
33124       graph = graph.replace(vertex.move(loc));
33125       if (!isEP1 && edge1.index !== way1.nodes.indexOf(vertex.id)) {
33126         way1 = way1.removeNode(vertex.id).addNode(vertex.id, edge1.index);
33127         graph = graph.replace(way1);
33128       }
33129       if (!isEP2 && edge2.index !== way2.nodes.indexOf(vertex.id)) {
33130         way2 = way2.removeNode(vertex.id).addNode(vertex.id, edge2.index);
33131         graph = graph.replace(way2);
33132       }
33133       return graph;
33134     }
33135     function cleanupIntersections(graph) {
33136       for (var i3 = 0; i3 < cache.intersections.length; i3++) {
33137         var obj = cache.intersections[i3];
33138         graph = replaceMovedVertex(obj.nodeId, obj.movedId, graph, _delta);
33139         graph = replaceMovedVertex(obj.nodeId, obj.unmovedId, graph, null);
33140         graph = unZorroIntersection(obj, graph);
33141         graph = removeDuplicateVertices(obj.movedId, graph);
33142         graph = removeDuplicateVertices(obj.unmovedId, graph);
33143       }
33144       return graph;
33145     }
33146     function limitDelta(graph) {
33147       function moveNode(loc) {
33148         return geoVecAdd(projection2(loc), _delta);
33149       }
33150       for (var i3 = 0; i3 < cache.intersections.length; i3++) {
33151         var obj = cache.intersections[i3];
33152         if (obj.movedIsEP && obj.unmovedIsEP)
33153           continue;
33154         if (!obj.movedIsEP)
33155           continue;
33156         var node = graph.entity(obj.nodeId);
33157         var start2 = projection2(node.loc);
33158         var end = geoVecAdd(start2, _delta);
33159         var movedNodes = graph.childNodes(graph.entity(obj.movedId));
33160         var movedPath = movedNodes.map(function(n3) {
33161           return moveNode(n3.loc);
33162         });
33163         var unmovedNodes = graph.childNodes(graph.entity(obj.unmovedId));
33164         var unmovedPath = unmovedNodes.map(function(n3) {
33165           return projection2(n3.loc);
33166         });
33167         var hits = geoPathIntersections(movedPath, unmovedPath);
33168         for (var j3 = 0; i3 < hits.length; i3++) {
33169           if (geoVecEqual(hits[j3], end))
33170             continue;
33171           var edge = geoChooseEdge(unmovedNodes, end, projection2);
33172           _delta = geoVecSubtract(projection2(edge.loc), start2);
33173         }
33174       }
33175     }
33176     var action = function(graph) {
33177       if (_delta[0] === 0 && _delta[1] === 0)
33178         return graph;
33179       setupCache(graph);
33180       if (cache.intersections.length) {
33181         limitDelta(graph);
33182       }
33183       for (var i3 = 0; i3 < cache.nodes.length; i3++) {
33184         var node = graph.entity(cache.nodes[i3]);
33185         var start2 = projection2(node.loc);
33186         var end = geoVecAdd(start2, _delta);
33187         graph = graph.replace(node.move(projection2.invert(end)));
33188       }
33189       if (cache.intersections.length) {
33190         graph = cleanupIntersections(graph);
33191       }
33192       return graph;
33193     };
33194     action.delta = function() {
33195       return _delta;
33196     };
33197     return action;
33198   }
33199
33200   // modules/actions/move_member.js
33201   function actionMoveMember(relationId, fromIndex, toIndex) {
33202     return function(graph) {
33203       return graph.replace(graph.entity(relationId).moveMember(fromIndex, toIndex));
33204     };
33205   }
33206
33207   // modules/actions/move_node.js
33208   function actionMoveNode(nodeID, toLoc) {
33209     var action = function(graph, t2) {
33210       if (t2 === null || !isFinite(t2))
33211         t2 = 1;
33212       t2 = Math.min(Math.max(+t2, 0), 1);
33213       var node = graph.entity(nodeID);
33214       return graph.replace(
33215         node.move(geoVecInterp(node.loc, toLoc, t2))
33216       );
33217     };
33218     action.transitionable = true;
33219     return action;
33220   }
33221
33222   // modules/actions/noop.js
33223   function actionNoop() {
33224     return function(graph) {
33225       return graph;
33226     };
33227   }
33228
33229   // modules/actions/orthogonalize.js
33230   function actionOrthogonalize(wayID, projection2, vertexID, degThresh, ep) {
33231     var epsilon3 = ep || 1e-4;
33232     var threshold = degThresh || 13;
33233     var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
33234     var upperThreshold = Math.cos(threshold * Math.PI / 180);
33235     var action = function(graph, t2) {
33236       if (t2 === null || !isFinite(t2))
33237         t2 = 1;
33238       t2 = Math.min(Math.max(+t2, 0), 1);
33239       var way = graph.entity(wayID);
33240       way = way.removeNode("");
33241       if (way.tags.nonsquare) {
33242         var tags = Object.assign({}, way.tags);
33243         delete tags.nonsquare;
33244         way = way.update({ tags });
33245       }
33246       graph = graph.replace(way);
33247       var isClosed = way.isClosed();
33248       var nodes = graph.childNodes(way).slice();
33249       if (isClosed)
33250         nodes.pop();
33251       if (vertexID !== void 0) {
33252         nodes = nodeSubset(nodes, vertexID, isClosed);
33253         if (nodes.length !== 3)
33254           return graph;
33255       }
33256       var nodeCount = {};
33257       var points = [];
33258       var corner = { i: 0, dotp: 1 };
33259       var node, point2, loc, score, motions, i3, j3;
33260       for (i3 = 0; i3 < nodes.length; i3++) {
33261         node = nodes[i3];
33262         nodeCount[node.id] = (nodeCount[node.id] || 0) + 1;
33263         points.push({ id: node.id, coord: projection2(node.loc) });
33264       }
33265       if (points.length === 3) {
33266         for (i3 = 0; i3 < 1e3; i3++) {
33267           motions = points.map(calcMotion);
33268           points[corner.i].coord = geoVecAdd(points[corner.i].coord, motions[corner.i]);
33269           score = corner.dotp;
33270           if (score < epsilon3) {
33271             break;
33272           }
33273         }
33274         node = graph.entity(nodes[corner.i].id);
33275         loc = projection2.invert(points[corner.i].coord);
33276         graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
33277       } else {
33278         var straights = [];
33279         var simplified = [];
33280         for (i3 = 0; i3 < points.length; i3++) {
33281           point2 = points[i3];
33282           var dotp = 0;
33283           if (isClosed || i3 > 0 && i3 < points.length - 1) {
33284             var a2 = points[(i3 - 1 + points.length) % points.length];
33285             var b2 = points[(i3 + 1) % points.length];
33286             dotp = Math.abs(geoOrthoNormalizedDotProduct(a2.coord, b2.coord, point2.coord));
33287           }
33288           if (dotp > upperThreshold) {
33289             straights.push(point2);
33290           } else {
33291             simplified.push(point2);
33292           }
33293         }
33294         var bestPoints = clonePoints(simplified);
33295         var originalPoints = clonePoints(simplified);
33296         score = Infinity;
33297         for (i3 = 0; i3 < 1e3; i3++) {
33298           motions = simplified.map(calcMotion);
33299           for (j3 = 0; j3 < motions.length; j3++) {
33300             simplified[j3].coord = geoVecAdd(simplified[j3].coord, motions[j3]);
33301           }
33302           var newScore = geoOrthoCalcScore(simplified, isClosed, epsilon3, threshold);
33303           if (newScore < score) {
33304             bestPoints = clonePoints(simplified);
33305             score = newScore;
33306           }
33307           if (score < epsilon3) {
33308             break;
33309           }
33310         }
33311         var bestCoords = bestPoints.map(function(p2) {
33312           return p2.coord;
33313         });
33314         if (isClosed)
33315           bestCoords.push(bestCoords[0]);
33316         for (i3 = 0; i3 < bestPoints.length; i3++) {
33317           point2 = bestPoints[i3];
33318           if (!geoVecEqual(originalPoints[i3].coord, point2.coord)) {
33319             node = graph.entity(point2.id);
33320             loc = projection2.invert(point2.coord);
33321             graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
33322           }
33323         }
33324         for (i3 = 0; i3 < straights.length; i3++) {
33325           point2 = straights[i3];
33326           if (nodeCount[point2.id] > 1)
33327             continue;
33328           node = graph.entity(point2.id);
33329           if (t2 === 1 && graph.parentWays(node).length === 1 && graph.parentRelations(node).length === 0 && !node.hasInterestingTags()) {
33330             graph = actionDeleteNode(node.id)(graph);
33331           } else {
33332             var choice = geoVecProject(point2.coord, bestCoords);
33333             if (choice) {
33334               loc = projection2.invert(choice.target);
33335               graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
33336             }
33337           }
33338         }
33339       }
33340       return graph;
33341       function clonePoints(array2) {
33342         return array2.map(function(p2) {
33343           return { id: p2.id, coord: [p2.coord[0], p2.coord[1]] };
33344         });
33345       }
33346       function calcMotion(point3, i4, array2) {
33347         if (!isClosed && (i4 === 0 || i4 === array2.length - 1))
33348           return [0, 0];
33349         if (nodeCount[array2[i4].id] > 1)
33350           return [0, 0];
33351         var a3 = array2[(i4 - 1 + array2.length) % array2.length].coord;
33352         var origin = point3.coord;
33353         var b3 = array2[(i4 + 1) % array2.length].coord;
33354         var p2 = geoVecSubtract(a3, origin);
33355         var q2 = geoVecSubtract(b3, origin);
33356         var scale = 2 * Math.min(geoVecLength(p2), geoVecLength(q2));
33357         p2 = geoVecNormalize(p2);
33358         q2 = geoVecNormalize(q2);
33359         var dotp2 = p2[0] * q2[0] + p2[1] * q2[1];
33360         var val = Math.abs(dotp2);
33361         if (val < lowerThreshold) {
33362           corner.i = i4;
33363           corner.dotp = val;
33364           var vec = geoVecNormalize(geoVecAdd(p2, q2));
33365           return geoVecScale(vec, 0.1 * dotp2 * scale);
33366         }
33367         return [0, 0];
33368       }
33369     };
33370     function nodeSubset(nodes, vertexID2, isClosed) {
33371       var first = isClosed ? 0 : 1;
33372       var last = isClosed ? nodes.length : nodes.length - 1;
33373       for (var i3 = first; i3 < last; i3++) {
33374         if (nodes[i3].id === vertexID2) {
33375           return [
33376             nodes[(i3 - 1 + nodes.length) % nodes.length],
33377             nodes[i3],
33378             nodes[(i3 + 1) % nodes.length]
33379           ];
33380         }
33381       }
33382       return [];
33383     }
33384     action.disabled = function(graph) {
33385       var way = graph.entity(wayID);
33386       way = way.removeNode("");
33387       graph = graph.replace(way);
33388       var isClosed = way.isClosed();
33389       var nodes = graph.childNodes(way).slice();
33390       if (isClosed)
33391         nodes.pop();
33392       var allowStraightAngles = false;
33393       if (vertexID !== void 0) {
33394         allowStraightAngles = true;
33395         nodes = nodeSubset(nodes, vertexID, isClosed);
33396         if (nodes.length !== 3)
33397           return "end_vertex";
33398       }
33399       var coords = nodes.map(function(n3) {
33400         return projection2(n3.loc);
33401       });
33402       var score = geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles);
33403       if (score === null) {
33404         return "not_squarish";
33405       } else if (score === 0) {
33406         return "square_enough";
33407       } else {
33408         return false;
33409       }
33410     };
33411     action.transitionable = true;
33412     return action;
33413   }
33414
33415   // modules/actions/restrict_turn.js
33416   function actionRestrictTurn(turn, restrictionType, restrictionID) {
33417     return function(graph) {
33418       var fromWay = graph.entity(turn.from.way);
33419       var toWay = graph.entity(turn.to.way);
33420       var viaNode = turn.via.node && graph.entity(turn.via.node);
33421       var viaWays = turn.via.ways && turn.via.ways.map(function(id2) {
33422         return graph.entity(id2);
33423       });
33424       var members = [];
33425       members.push({ id: fromWay.id, type: "way", role: "from" });
33426       if (viaNode) {
33427         members.push({ id: viaNode.id, type: "node", role: "via" });
33428       } else if (viaWays) {
33429         viaWays.forEach(function(viaWay) {
33430           members.push({ id: viaWay.id, type: "way", role: "via" });
33431         });
33432       }
33433       members.push({ id: toWay.id, type: "way", role: "to" });
33434       return graph.replace(osmRelation({
33435         id: restrictionID,
33436         tags: {
33437           type: "restriction",
33438           restriction: restrictionType
33439         },
33440         members
33441       }));
33442     };
33443   }
33444
33445   // modules/actions/revert.js
33446   function actionRevert(id2) {
33447     var action = function(graph) {
33448       var entity = graph.hasEntity(id2), base = graph.base().entities[id2];
33449       if (entity && !base) {
33450         if (entity.type === "node") {
33451           graph.parentWays(entity).forEach(function(parent) {
33452             parent = parent.removeNode(id2);
33453             graph = graph.replace(parent);
33454             if (parent.isDegenerate()) {
33455               graph = actionDeleteWay(parent.id)(graph);
33456             }
33457           });
33458         }
33459         graph.parentRelations(entity).forEach(function(parent) {
33460           parent = parent.removeMembersWithID(id2);
33461           graph = graph.replace(parent);
33462           if (parent.isDegenerate()) {
33463             graph = actionDeleteRelation(parent.id)(graph);
33464           }
33465         });
33466       }
33467       return graph.revert(id2);
33468     };
33469     return action;
33470   }
33471
33472   // modules/actions/rotate.js
33473   function actionRotate(rotateIds, pivot, angle2, projection2) {
33474     var action = function(graph) {
33475       return graph.update(function(graph2) {
33476         utilGetAllNodes(rotateIds, graph2).forEach(function(node) {
33477           var point2 = geoRotate([projection2(node.loc)], angle2, pivot)[0];
33478           graph2 = graph2.replace(node.move(projection2.invert(point2)));
33479         });
33480       });
33481     };
33482     return action;
33483   }
33484
33485   // modules/actions/scale.js
33486   function actionScale(ids, pivotLoc, scaleFactor, projection2) {
33487     return function(graph) {
33488       return graph.update(function(graph2) {
33489         let point2, radial;
33490         utilGetAllNodes(ids, graph2).forEach(function(node) {
33491           point2 = projection2(node.loc);
33492           radial = [
33493             point2[0] - pivotLoc[0],
33494             point2[1] - pivotLoc[1]
33495           ];
33496           point2 = [
33497             pivotLoc[0] + scaleFactor * radial[0],
33498             pivotLoc[1] + scaleFactor * radial[1]
33499           ];
33500           graph2 = graph2.replace(node.move(projection2.invert(point2)));
33501         });
33502       });
33503     };
33504   }
33505
33506   // modules/actions/straighten_nodes.js
33507   function actionStraightenNodes(nodeIDs, projection2) {
33508     function positionAlongWay(a2, o2, b2) {
33509       return geoVecDot(a2, b2, o2) / geoVecDot(b2, b2, o2);
33510     }
33511     function getEndpoints(points) {
33512       var ssr = geoGetSmallestSurroundingRectangle(points);
33513       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
33514       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
33515       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
33516       var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
33517       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
33518       if (isLong) {
33519         return [p1, q1];
33520       }
33521       return [p2, q2];
33522     }
33523     var action = function(graph, t2) {
33524       if (t2 === null || !isFinite(t2))
33525         t2 = 1;
33526       t2 = Math.min(Math.max(+t2, 0), 1);
33527       var nodes = nodeIDs.map(function(id2) {
33528         return graph.entity(id2);
33529       });
33530       var points = nodes.map(function(n3) {
33531         return projection2(n3.loc);
33532       });
33533       var endpoints = getEndpoints(points);
33534       var startPoint = endpoints[0];
33535       var endPoint = endpoints[1];
33536       for (var i3 = 0; i3 < points.length; i3++) {
33537         var node = nodes[i3];
33538         var point2 = points[i3];
33539         var u2 = positionAlongWay(point2, startPoint, endPoint);
33540         var point22 = geoVecInterp(startPoint, endPoint, u2);
33541         var loc2 = projection2.invert(point22);
33542         graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
33543       }
33544       return graph;
33545     };
33546     action.disabled = function(graph) {
33547       var nodes = nodeIDs.map(function(id2) {
33548         return graph.entity(id2);
33549       });
33550       var points = nodes.map(function(n3) {
33551         return projection2(n3.loc);
33552       });
33553       var endpoints = getEndpoints(points);
33554       var startPoint = endpoints[0];
33555       var endPoint = endpoints[1];
33556       var maxDistance = 0;
33557       for (var i3 = 0; i3 < points.length; i3++) {
33558         var point2 = points[i3];
33559         var u2 = positionAlongWay(point2, startPoint, endPoint);
33560         var p2 = geoVecInterp(startPoint, endPoint, u2);
33561         var dist = geoVecLength(p2, point2);
33562         if (!isNaN(dist) && dist > maxDistance) {
33563           maxDistance = dist;
33564         }
33565       }
33566       if (maxDistance < 1e-4) {
33567         return "straight_enough";
33568       }
33569     };
33570     action.transitionable = true;
33571     return action;
33572   }
33573
33574   // modules/actions/straighten_way.js
33575   function actionStraightenWay(selectedIDs, projection2) {
33576     function positionAlongWay(a2, o2, b2) {
33577       return geoVecDot(a2, b2, o2) / geoVecDot(b2, b2, o2);
33578     }
33579     function allNodes(graph) {
33580       var nodes = [];
33581       var startNodes = [];
33582       var endNodes = [];
33583       var remainingWays = [];
33584       var selectedWays = selectedIDs.filter(function(w2) {
33585         return graph.entity(w2).type === "way";
33586       });
33587       var selectedNodes = selectedIDs.filter(function(n3) {
33588         return graph.entity(n3).type === "node";
33589       });
33590       for (var i3 = 0; i3 < selectedWays.length; i3++) {
33591         var way = graph.entity(selectedWays[i3]);
33592         nodes = way.nodes.slice(0);
33593         remainingWays.push(nodes);
33594         startNodes.push(nodes[0]);
33595         endNodes.push(nodes[nodes.length - 1]);
33596       }
33597       startNodes = startNodes.filter(function(n3) {
33598         return startNodes.indexOf(n3) === startNodes.lastIndexOf(n3);
33599       });
33600       endNodes = endNodes.filter(function(n3) {
33601         return endNodes.indexOf(n3) === endNodes.lastIndexOf(n3);
33602       });
33603       var currNode = utilArrayDifference(startNodes, endNodes).concat(utilArrayDifference(endNodes, startNodes))[0];
33604       var nextWay = [];
33605       nodes = [];
33606       var getNextWay = function(currNode2, remainingWays2) {
33607         return remainingWays2.filter(function(way2) {
33608           return way2[0] === currNode2 || way2[way2.length - 1] === currNode2;
33609         })[0];
33610       };
33611       while (remainingWays.length) {
33612         nextWay = getNextWay(currNode, remainingWays);
33613         remainingWays = utilArrayDifference(remainingWays, [nextWay]);
33614         if (nextWay[0] !== currNode) {
33615           nextWay.reverse();
33616         }
33617         nodes = nodes.concat(nextWay);
33618         currNode = nodes[nodes.length - 1];
33619       }
33620       if (selectedNodes.length === 2) {
33621         var startNodeIdx = nodes.indexOf(selectedNodes[0]);
33622         var endNodeIdx = nodes.indexOf(selectedNodes[1]);
33623         var sortedStartEnd = [startNodeIdx, endNodeIdx];
33624         sortedStartEnd.sort(function(a2, b2) {
33625           return a2 - b2;
33626         });
33627         nodes = nodes.slice(sortedStartEnd[0], sortedStartEnd[1] + 1);
33628       }
33629       return nodes.map(function(n3) {
33630         return graph.entity(n3);
33631       });
33632     }
33633     function shouldKeepNode(node, graph) {
33634       return graph.parentWays(node).length > 1 || graph.parentRelations(node).length || node.hasInterestingTags();
33635     }
33636     var action = function(graph, t2) {
33637       if (t2 === null || !isFinite(t2))
33638         t2 = 1;
33639       t2 = Math.min(Math.max(+t2, 0), 1);
33640       var nodes = allNodes(graph);
33641       var points = nodes.map(function(n3) {
33642         return projection2(n3.loc);
33643       });
33644       var startPoint = points[0];
33645       var endPoint = points[points.length - 1];
33646       var toDelete = [];
33647       var i3;
33648       for (i3 = 1; i3 < points.length - 1; i3++) {
33649         var node = nodes[i3];
33650         var point2 = points[i3];
33651         if (t2 < 1 || shouldKeepNode(node, graph)) {
33652           var u2 = positionAlongWay(point2, startPoint, endPoint);
33653           var p2 = geoVecInterp(startPoint, endPoint, u2);
33654           var loc2 = projection2.invert(p2);
33655           graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
33656         } else {
33657           if (toDelete.indexOf(node) === -1) {
33658             toDelete.push(node);
33659           }
33660         }
33661       }
33662       for (i3 = 0; i3 < toDelete.length; i3++) {
33663         graph = actionDeleteNode(toDelete[i3].id)(graph);
33664       }
33665       return graph;
33666     };
33667     action.disabled = function(graph) {
33668       var nodes = allNodes(graph);
33669       var points = nodes.map(function(n3) {
33670         return projection2(n3.loc);
33671       });
33672       var startPoint = points[0];
33673       var endPoint = points[points.length - 1];
33674       var threshold = 0.2 * geoVecLength(startPoint, endPoint);
33675       var i3;
33676       if (threshold === 0) {
33677         return "too_bendy";
33678       }
33679       var maxDistance = 0;
33680       for (i3 = 1; i3 < points.length - 1; i3++) {
33681         var point2 = points[i3];
33682         var u2 = positionAlongWay(point2, startPoint, endPoint);
33683         var p2 = geoVecInterp(startPoint, endPoint, u2);
33684         var dist = geoVecLength(p2, point2);
33685         if (isNaN(dist) || dist > threshold) {
33686           return "too_bendy";
33687         } else if (dist > maxDistance) {
33688           maxDistance = dist;
33689         }
33690       }
33691       var keepingAllNodes = nodes.every(function(node, i4) {
33692         return i4 === 0 || i4 === nodes.length - 1 || shouldKeepNode(node, graph);
33693       });
33694       if (maxDistance < 1e-4 && // Allow straightening even if already straight in order to remove extraneous nodes
33695       keepingAllNodes) {
33696         return "straight_enough";
33697       }
33698     };
33699     action.transitionable = true;
33700     return action;
33701   }
33702
33703   // modules/actions/unrestrict_turn.js
33704   function actionUnrestrictTurn(turn) {
33705     return function(graph) {
33706       return actionDeleteRelation(turn.restrictionID)(graph);
33707     };
33708   }
33709
33710   // modules/actions/reflect.js
33711   function actionReflect(reflectIds, projection2) {
33712     var _useLongAxis = true;
33713     var action = function(graph, t2) {
33714       if (t2 === null || !isFinite(t2))
33715         t2 = 1;
33716       t2 = Math.min(Math.max(+t2, 0), 1);
33717       var nodes = utilGetAllNodes(reflectIds, graph);
33718       var points = nodes.map(function(n3) {
33719         return projection2(n3.loc);
33720       });
33721       var ssr = geoGetSmallestSurroundingRectangle(points);
33722       var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
33723       var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
33724       var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
33725       var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
33726       var p3, q3;
33727       var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
33728       if (_useLongAxis && isLong || !_useLongAxis && !isLong) {
33729         p3 = p1;
33730         q3 = q1;
33731       } else {
33732         p3 = p2;
33733         q3 = q2;
33734       }
33735       var dx = q3[0] - p3[0];
33736       var dy = q3[1] - p3[1];
33737       var a2 = (dx * dx - dy * dy) / (dx * dx + dy * dy);
33738       var b2 = 2 * dx * dy / (dx * dx + dy * dy);
33739       for (var i3 = 0; i3 < nodes.length; i3++) {
33740         var node = nodes[i3];
33741         var c2 = projection2(node.loc);
33742         var c22 = [
33743           a2 * (c2[0] - p3[0]) + b2 * (c2[1] - p3[1]) + p3[0],
33744           b2 * (c2[0] - p3[0]) - a2 * (c2[1] - p3[1]) + p3[1]
33745         ];
33746         var loc2 = projection2.invert(c22);
33747         node = node.move(geoVecInterp(node.loc, loc2, t2));
33748         graph = graph.replace(node);
33749       }
33750       return graph;
33751     };
33752     action.useLongAxis = function(val) {
33753       if (!arguments.length)
33754         return _useLongAxis;
33755       _useLongAxis = val;
33756       return action;
33757     };
33758     action.transitionable = true;
33759     return action;
33760   }
33761
33762   // modules/actions/upgrade_tags.js
33763   function actionUpgradeTags(entityId, oldTags, replaceTags) {
33764     return function(graph) {
33765       var entity = graph.entity(entityId);
33766       var tags = Object.assign({}, entity.tags);
33767       var transferValue;
33768       var semiIndex;
33769       for (var oldTagKey in oldTags) {
33770         if (!(oldTagKey in tags))
33771           continue;
33772         if (oldTags[oldTagKey] === "*") {
33773           transferValue = tags[oldTagKey];
33774           delete tags[oldTagKey];
33775         } else if (oldTags[oldTagKey] === tags[oldTagKey]) {
33776           delete tags[oldTagKey];
33777         } else {
33778           var vals = tags[oldTagKey].split(";").filter(Boolean);
33779           var oldIndex = vals.indexOf(oldTags[oldTagKey]);
33780           if (vals.length === 1 || oldIndex === -1) {
33781             delete tags[oldTagKey];
33782           } else {
33783             if (replaceTags && replaceTags[oldTagKey]) {
33784               semiIndex = oldIndex;
33785             }
33786             vals.splice(oldIndex, 1);
33787             tags[oldTagKey] = vals.join(";");
33788           }
33789         }
33790       }
33791       if (replaceTags) {
33792         for (var replaceKey in replaceTags) {
33793           var replaceValue = replaceTags[replaceKey];
33794           if (replaceValue === "*") {
33795             if (tags[replaceKey] && tags[replaceKey] !== "no") {
33796               continue;
33797             } else {
33798               tags[replaceKey] = "yes";
33799             }
33800           } else if (replaceValue === "$1") {
33801             tags[replaceKey] = transferValue;
33802           } else {
33803             if (tags[replaceKey] && oldTags[replaceKey] && semiIndex !== void 0) {
33804               var existingVals = tags[replaceKey].split(";").filter(Boolean);
33805               if (existingVals.indexOf(replaceValue) === -1) {
33806                 existingVals.splice(semiIndex, 0, replaceValue);
33807                 tags[replaceKey] = existingVals.join(";");
33808               }
33809             } else {
33810               tags[replaceKey] = replaceValue;
33811             }
33812           }
33813         }
33814       }
33815       return graph.replace(entity.update({ tags }));
33816     };
33817   }
33818
33819   // modules/behavior/edit.js
33820   function behaviorEdit(context) {
33821     function behavior() {
33822       context.map().minzoom(context.minEditableZoom());
33823     }
33824     behavior.off = function() {
33825       context.map().minzoom(0);
33826     };
33827     return behavior;
33828   }
33829
33830   // modules/behavior/hover.js
33831   function behaviorHover(context) {
33832     var dispatch14 = dispatch_default("hover");
33833     var _selection = select_default2(null);
33834     var _newNodeId = null;
33835     var _initialNodeID = null;
33836     var _altDisables;
33837     var _ignoreVertex;
33838     var _targets = [];
33839     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33840     function keydown(d3_event) {
33841       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
33842         _selection.selectAll(".hover").classed("hover-suppressed", true).classed("hover", false);
33843         _selection.classed("hover-disabled", true);
33844         dispatch14.call("hover", this, null);
33845       }
33846     }
33847     function keyup(d3_event) {
33848       if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
33849         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false).classed("hover", true);
33850         _selection.classed("hover-disabled", false);
33851         dispatch14.call("hover", this, _targets);
33852       }
33853     }
33854     function behavior(selection2) {
33855       _selection = selection2;
33856       _targets = [];
33857       if (_initialNodeID) {
33858         _newNodeId = _initialNodeID;
33859         _initialNodeID = null;
33860       } else {
33861         _newNodeId = null;
33862       }
33863       _selection.on(_pointerPrefix + "over.hover", pointerover).on(_pointerPrefix + "out.hover", pointerout).on(_pointerPrefix + "down.hover", pointerover);
33864       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", pointerout, true).on("keydown.hover", keydown).on("keyup.hover", keyup);
33865       function eventTarget(d3_event) {
33866         var datum2 = d3_event.target && d3_event.target.__data__;
33867         if (typeof datum2 !== "object")
33868           return null;
33869         if (!(datum2 instanceof osmEntity) && datum2.properties && datum2.properties.entity instanceof osmEntity) {
33870           return datum2.properties.entity;
33871         }
33872         return datum2;
33873       }
33874       function pointerover(d3_event) {
33875         if (context.mode().id.indexOf("drag") === -1 && (!d3_event.pointerType || d3_event.pointerType === "mouse") && d3_event.buttons)
33876           return;
33877         var target = eventTarget(d3_event);
33878         if (target && _targets.indexOf(target) === -1) {
33879           _targets.push(target);
33880           updateHover(d3_event, _targets);
33881         }
33882       }
33883       function pointerout(d3_event) {
33884         var target = eventTarget(d3_event);
33885         var index = _targets.indexOf(target);
33886         if (index !== -1) {
33887           _targets.splice(index);
33888           updateHover(d3_event, _targets);
33889         }
33890       }
33891       function allowsVertex(d2) {
33892         return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
33893       }
33894       function modeAllowsHover(target) {
33895         var mode = context.mode();
33896         if (mode.id === "add-point") {
33897           return mode.preset.matchGeometry("vertex") || target.type !== "way" && target.geometry(context.graph()) !== "vertex";
33898         }
33899         return true;
33900       }
33901       function updateHover(d3_event, targets) {
33902         _selection.selectAll(".hover").classed("hover", false);
33903         _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false);
33904         var mode = context.mode();
33905         if (!_newNodeId && (mode.id === "draw-line" || mode.id === "draw-area")) {
33906           var node = targets.find(function(target) {
33907             return target instanceof osmEntity && target.type === "node";
33908           });
33909           _newNodeId = node && node.id;
33910         }
33911         targets = targets.filter(function(datum3) {
33912           if (datum3 instanceof osmEntity) {
33913             return datum3.id !== _newNodeId && (datum3.type !== "node" || !_ignoreVertex || allowsVertex(datum3)) && modeAllowsHover(datum3);
33914           }
33915           return true;
33916         });
33917         var selector = "";
33918         for (var i3 in targets) {
33919           var datum2 = targets[i3];
33920           if (datum2.__featurehash__) {
33921             selector += ", .data" + datum2.__featurehash__;
33922           } else if (datum2 instanceof QAItem) {
33923             selector += ", ." + datum2.service + ".itemId-" + datum2.id;
33924           } else if (datum2 instanceof osmNote) {
33925             selector += ", .note-" + datum2.id;
33926           } else if (datum2 instanceof osmEntity) {
33927             selector += ", ." + datum2.id;
33928             if (datum2.type === "relation") {
33929               for (var j3 in datum2.members) {
33930                 selector += ", ." + datum2.members[j3].id;
33931               }
33932             }
33933           }
33934         }
33935         var suppressed = _altDisables && d3_event && d3_event.altKey;
33936         if (selector.trim().length) {
33937           selector = selector.slice(1);
33938           _selection.selectAll(selector).classed(suppressed ? "hover-suppressed" : "hover", true);
33939         }
33940         dispatch14.call("hover", this, !suppressed && targets);
33941       }
33942     }
33943     behavior.off = function(selection2) {
33944       selection2.selectAll(".hover").classed("hover", false);
33945       selection2.selectAll(".hover-suppressed").classed("hover-suppressed", false);
33946       selection2.classed("hover-disabled", false);
33947       selection2.on(_pointerPrefix + "over.hover", null).on(_pointerPrefix + "out.hover", null).on(_pointerPrefix + "down.hover", null);
33948       select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", null, true).on("keydown.hover", null).on("keyup.hover", null);
33949     };
33950     behavior.altDisables = function(val) {
33951       if (!arguments.length)
33952         return _altDisables;
33953       _altDisables = val;
33954       return behavior;
33955     };
33956     behavior.ignoreVertex = function(val) {
33957       if (!arguments.length)
33958         return _ignoreVertex;
33959       _ignoreVertex = val;
33960       return behavior;
33961     };
33962     behavior.initialNodeID = function(nodeId) {
33963       _initialNodeID = nodeId;
33964       return behavior;
33965     };
33966     return utilRebind(behavior, dispatch14, "on");
33967   }
33968
33969   // modules/behavior/draw.js
33970   var _disableSpace = false;
33971   var _lastSpace = null;
33972   function behaviorDraw(context) {
33973     var dispatch14 = dispatch_default(
33974       "move",
33975       "down",
33976       "downcancel",
33977       "click",
33978       "clickWay",
33979       "clickNode",
33980       "undo",
33981       "cancel",
33982       "finish"
33983     );
33984     var keybinding = utilKeybinding("draw");
33985     var _hover = behaviorHover(context).altDisables(true).ignoreVertex(true).on("hover", context.ui().sidebar.hover);
33986     var _edit = behaviorEdit(context);
33987     var _closeTolerance = 4;
33988     var _tolerance = 12;
33989     var _mouseLeave = false;
33990     var _lastMouse = null;
33991     var _lastPointerUpEvent;
33992     var _downPointer;
33993     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
33994     function datum2(d3_event) {
33995       var mode = context.mode();
33996       var isNote = mode && mode.id.indexOf("note") !== -1;
33997       if (d3_event.altKey || isNote)
33998         return {};
33999       var element;
34000       if (d3_event.type === "keydown") {
34001         element = _lastMouse && _lastMouse.target;
34002       } else {
34003         element = d3_event.target;
34004       }
34005       var d2 = element.__data__;
34006       return d2 && d2.properties && d2.properties.target ? d2 : {};
34007     }
34008     function pointerdown(d3_event) {
34009       if (_downPointer)
34010         return;
34011       var pointerLocGetter = utilFastMouse(this);
34012       _downPointer = {
34013         id: d3_event.pointerId || "mouse",
34014         pointerLocGetter,
34015         downTime: +/* @__PURE__ */ new Date(),
34016         downLoc: pointerLocGetter(d3_event)
34017       };
34018       dispatch14.call("down", this, d3_event, datum2(d3_event));
34019     }
34020     function pointerup(d3_event) {
34021       if (!_downPointer || _downPointer.id !== (d3_event.pointerId || "mouse"))
34022         return;
34023       var downPointer = _downPointer;
34024       _downPointer = null;
34025       _lastPointerUpEvent = d3_event;
34026       if (downPointer.isCancelled)
34027         return;
34028       var t2 = +/* @__PURE__ */ new Date();
34029       var p2 = downPointer.pointerLocGetter(d3_event);
34030       var dist = geoVecLength(downPointer.downLoc, p2);
34031       if (dist < _closeTolerance || dist < _tolerance && t2 - downPointer.downTime < 500) {
34032         select_default2(window).on("click.draw-block", function() {
34033           d3_event.stopPropagation();
34034         }, true);
34035         context.map().dblclickZoomEnable(false);
34036         window.setTimeout(function() {
34037           context.map().dblclickZoomEnable(true);
34038           select_default2(window).on("click.draw-block", null);
34039         }, 500);
34040         click(d3_event, p2);
34041       }
34042     }
34043     function pointermove(d3_event) {
34044       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse") && !_downPointer.isCancelled) {
34045         var p2 = _downPointer.pointerLocGetter(d3_event);
34046         var dist = geoVecLength(_downPointer.downLoc, p2);
34047         if (dist >= _closeTolerance) {
34048           _downPointer.isCancelled = true;
34049           dispatch14.call("downcancel", this);
34050         }
34051       }
34052       if (d3_event.pointerType && d3_event.pointerType !== "mouse" || d3_event.buttons || _downPointer)
34053         return;
34054       if (_lastPointerUpEvent && _lastPointerUpEvent.pointerType !== "mouse" && d3_event.timeStamp - _lastPointerUpEvent.timeStamp < 100)
34055         return;
34056       _lastMouse = d3_event;
34057       dispatch14.call("move", this, d3_event, datum2(d3_event));
34058     }
34059     function pointercancel(d3_event) {
34060       if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse")) {
34061         if (!_downPointer.isCancelled) {
34062           dispatch14.call("downcancel", this);
34063         }
34064         _downPointer = null;
34065       }
34066     }
34067     function mouseenter() {
34068       _mouseLeave = false;
34069     }
34070     function mouseleave() {
34071       _mouseLeave = true;
34072     }
34073     function allowsVertex(d2) {
34074       return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
34075     }
34076     function click(d3_event, loc) {
34077       var d2 = datum2(d3_event);
34078       var target = d2 && d2.properties && d2.properties.entity;
34079       var mode = context.mode();
34080       if (target && target.type === "node" && allowsVertex(target)) {
34081         dispatch14.call("clickNode", this, target, d2);
34082         return;
34083       } else if (target && target.type === "way" && (mode.id !== "add-point" || mode.preset.matchGeometry("vertex"))) {
34084         var choice = geoChooseEdge(
34085           context.graph().childNodes(target),
34086           loc,
34087           context.projection,
34088           context.activeID()
34089         );
34090         if (choice) {
34091           var edge = [target.nodes[choice.index - 1], target.nodes[choice.index]];
34092           dispatch14.call("clickWay", this, choice.loc, edge, d2);
34093           return;
34094         }
34095       } else if (mode.id !== "add-point" || mode.preset.matchGeometry("point")) {
34096         var locLatLng = context.projection.invert(loc);
34097         dispatch14.call("click", this, locLatLng, d2);
34098       }
34099     }
34100     function space(d3_event) {
34101       d3_event.preventDefault();
34102       d3_event.stopPropagation();
34103       var currSpace = context.map().mouse();
34104       if (_disableSpace && _lastSpace) {
34105         var dist = geoVecLength(_lastSpace, currSpace);
34106         if (dist > _tolerance) {
34107           _disableSpace = false;
34108         }
34109       }
34110       if (_disableSpace || _mouseLeave || !_lastMouse)
34111         return;
34112       _lastSpace = currSpace;
34113       _disableSpace = true;
34114       select_default2(window).on("keyup.space-block", function() {
34115         d3_event.preventDefault();
34116         d3_event.stopPropagation();
34117         _disableSpace = false;
34118         select_default2(window).on("keyup.space-block", null);
34119       });
34120       var loc = context.map().mouse() || // or the map center if the mouse has never entered the map
34121       context.projection(context.map().center());
34122       click(d3_event, loc);
34123     }
34124     function backspace(d3_event) {
34125       d3_event.preventDefault();
34126       dispatch14.call("undo");
34127     }
34128     function del(d3_event) {
34129       d3_event.preventDefault();
34130       dispatch14.call("cancel");
34131     }
34132     function ret(d3_event) {
34133       d3_event.preventDefault();
34134       dispatch14.call("finish");
34135     }
34136     function behavior(selection2) {
34137       context.install(_hover);
34138       context.install(_edit);
34139       _downPointer = null;
34140       keybinding.on("\u232B", backspace).on("\u2326", del).on("\u238B", ret).on("\u21A9", ret).on("space", space).on("\u2325space", space);
34141       selection2.on("mouseenter.draw", mouseenter).on("mouseleave.draw", mouseleave).on(_pointerPrefix + "down.draw", pointerdown).on(_pointerPrefix + "move.draw", pointermove);
34142       select_default2(window).on(_pointerPrefix + "up.draw", pointerup, true).on("pointercancel.draw", pointercancel, true);
34143       select_default2(document).call(keybinding);
34144       return behavior;
34145     }
34146     behavior.off = function(selection2) {
34147       context.ui().sidebar.hover.cancel();
34148       context.uninstall(_hover);
34149       context.uninstall(_edit);
34150       selection2.on("mouseenter.draw", null).on("mouseleave.draw", null).on(_pointerPrefix + "down.draw", null).on(_pointerPrefix + "move.draw", null);
34151       select_default2(window).on(_pointerPrefix + "up.draw", null).on("pointercancel.draw", null);
34152       select_default2(document).call(keybinding.unbind);
34153     };
34154     behavior.hover = function() {
34155       return _hover;
34156     };
34157     return utilRebind(behavior, dispatch14, "on");
34158   }
34159
34160   // modules/behavior/breathe.js
34161   var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
34162
34163   // node_modules/d3-scale/src/init.js
34164   function initRange(domain2, range3) {
34165     switch (arguments.length) {
34166       case 0:
34167         break;
34168       case 1:
34169         this.range(domain2);
34170         break;
34171       default:
34172         this.range(range3).domain(domain2);
34173         break;
34174     }
34175     return this;
34176   }
34177
34178   // node_modules/d3-scale/src/constant.js
34179   function constants(x2) {
34180     return function() {
34181       return x2;
34182     };
34183   }
34184
34185   // node_modules/d3-scale/src/number.js
34186   function number2(x2) {
34187     return +x2;
34188   }
34189
34190   // node_modules/d3-scale/src/continuous.js
34191   var unit = [0, 1];
34192   function identity3(x2) {
34193     return x2;
34194   }
34195   function normalize(a2, b2) {
34196     return (b2 -= a2 = +a2) ? function(x2) {
34197       return (x2 - a2) / b2;
34198     } : constants(isNaN(b2) ? NaN : 0.5);
34199   }
34200   function clamper(a2, b2) {
34201     var t2;
34202     if (a2 > b2)
34203       t2 = a2, a2 = b2, b2 = t2;
34204     return function(x2) {
34205       return Math.max(a2, Math.min(b2, x2));
34206     };
34207   }
34208   function bimap(domain2, range3, interpolate) {
34209     var d0 = domain2[0], d1 = domain2[1], r0 = range3[0], r1 = range3[1];
34210     if (d1 < d0)
34211       d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
34212     else
34213       d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
34214     return function(x2) {
34215       return r0(d0(x2));
34216     };
34217   }
34218   function polymap(domain2, range3, interpolate) {
34219     var j3 = Math.min(domain2.length, range3.length) - 1, d2 = new Array(j3), r2 = new Array(j3), i3 = -1;
34220     if (domain2[j3] < domain2[0]) {
34221       domain2 = domain2.slice().reverse();
34222       range3 = range3.slice().reverse();
34223     }
34224     while (++i3 < j3) {
34225       d2[i3] = normalize(domain2[i3], domain2[i3 + 1]);
34226       r2[i3] = interpolate(range3[i3], range3[i3 + 1]);
34227     }
34228     return function(x2) {
34229       var i4 = bisect_default(domain2, x2, 1, j3) - 1;
34230       return r2[i4](d2[i4](x2));
34231     };
34232   }
34233   function copy(source, target) {
34234     return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
34235   }
34236   function transformer2() {
34237     var domain2 = unit, range3 = unit, interpolate = value_default, transform2, untransform, unknown, clamp3 = identity3, piecewise, output, input;
34238     function rescale() {
34239       var n3 = Math.min(domain2.length, range3.length);
34240       if (clamp3 !== identity3)
34241         clamp3 = clamper(domain2[0], domain2[n3 - 1]);
34242       piecewise = n3 > 2 ? polymap : bimap;
34243       output = input = null;
34244       return scale;
34245     }
34246     function scale(x2) {
34247       return x2 == null || isNaN(x2 = +x2) ? unknown : (output || (output = piecewise(domain2.map(transform2), range3, interpolate)))(transform2(clamp3(x2)));
34248     }
34249     scale.invert = function(y2) {
34250       return clamp3(untransform((input || (input = piecewise(range3, domain2.map(transform2), number_default)))(y2)));
34251     };
34252     scale.domain = function(_2) {
34253       return arguments.length ? (domain2 = Array.from(_2, number2), rescale()) : domain2.slice();
34254     };
34255     scale.range = function(_2) {
34256       return arguments.length ? (range3 = Array.from(_2), rescale()) : range3.slice();
34257     };
34258     scale.rangeRound = function(_2) {
34259       return range3 = Array.from(_2), interpolate = round_default, rescale();
34260     };
34261     scale.clamp = function(_2) {
34262       return arguments.length ? (clamp3 = _2 ? true : identity3, rescale()) : clamp3 !== identity3;
34263     };
34264     scale.interpolate = function(_2) {
34265       return arguments.length ? (interpolate = _2, rescale()) : interpolate;
34266     };
34267     scale.unknown = function(_2) {
34268       return arguments.length ? (unknown = _2, scale) : unknown;
34269     };
34270     return function(t2, u2) {
34271       transform2 = t2, untransform = u2;
34272       return rescale();
34273     };
34274   }
34275   function continuous() {
34276     return transformer2()(identity3, identity3);
34277   }
34278
34279   // node_modules/d3-format/src/formatDecimal.js
34280   function formatDecimal_default(x2) {
34281     return Math.abs(x2 = Math.round(x2)) >= 1e21 ? x2.toLocaleString("en").replace(/,/g, "") : x2.toString(10);
34282   }
34283   function formatDecimalParts(x2, p2) {
34284     if ((i3 = (x2 = p2 ? x2.toExponential(p2 - 1) : x2.toExponential()).indexOf("e")) < 0)
34285       return null;
34286     var i3, coefficient = x2.slice(0, i3);
34287     return [
34288       coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
34289       +x2.slice(i3 + 1)
34290     ];
34291   }
34292
34293   // node_modules/d3-format/src/exponent.js
34294   function exponent_default(x2) {
34295     return x2 = formatDecimalParts(Math.abs(x2)), x2 ? x2[1] : NaN;
34296   }
34297
34298   // node_modules/d3-format/src/formatGroup.js
34299   function formatGroup_default(grouping, thousands) {
34300     return function(value, width) {
34301       var i3 = value.length, t2 = [], j3 = 0, g3 = grouping[0], length = 0;
34302       while (i3 > 0 && g3 > 0) {
34303         if (length + g3 + 1 > width)
34304           g3 = Math.max(1, width - length);
34305         t2.push(value.substring(i3 -= g3, i3 + g3));
34306         if ((length += g3 + 1) > width)
34307           break;
34308         g3 = grouping[j3 = (j3 + 1) % grouping.length];
34309       }
34310       return t2.reverse().join(thousands);
34311     };
34312   }
34313
34314   // node_modules/d3-format/src/formatNumerals.js
34315   function formatNumerals_default(numerals) {
34316     return function(value) {
34317       return value.replace(/[0-9]/g, function(i3) {
34318         return numerals[+i3];
34319       });
34320     };
34321   }
34322
34323   // node_modules/d3-format/src/formatSpecifier.js
34324   var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
34325   function formatSpecifier(specifier) {
34326     if (!(match = re.exec(specifier)))
34327       throw new Error("invalid format: " + specifier);
34328     var match;
34329     return new FormatSpecifier({
34330       fill: match[1],
34331       align: match[2],
34332       sign: match[3],
34333       symbol: match[4],
34334       zero: match[5],
34335       width: match[6],
34336       comma: match[7],
34337       precision: match[8] && match[8].slice(1),
34338       trim: match[9],
34339       type: match[10]
34340     });
34341   }
34342   formatSpecifier.prototype = FormatSpecifier.prototype;
34343   function FormatSpecifier(specifier) {
34344     this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
34345     this.align = specifier.align === void 0 ? ">" : specifier.align + "";
34346     this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
34347     this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
34348     this.zero = !!specifier.zero;
34349     this.width = specifier.width === void 0 ? void 0 : +specifier.width;
34350     this.comma = !!specifier.comma;
34351     this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
34352     this.trim = !!specifier.trim;
34353     this.type = specifier.type === void 0 ? "" : specifier.type + "";
34354   }
34355   FormatSpecifier.prototype.toString = function() {
34356     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;
34357   };
34358
34359   // node_modules/d3-format/src/formatTrim.js
34360   function formatTrim_default(s2) {
34361     out:
34362       for (var n3 = s2.length, i3 = 1, i0 = -1, i1; i3 < n3; ++i3) {
34363         switch (s2[i3]) {
34364           case ".":
34365             i0 = i1 = i3;
34366             break;
34367           case "0":
34368             if (i0 === 0)
34369               i0 = i3;
34370             i1 = i3;
34371             break;
34372           default:
34373             if (!+s2[i3])
34374               break out;
34375             if (i0 > 0)
34376               i0 = 0;
34377             break;
34378         }
34379       }
34380     return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2;
34381   }
34382
34383   // node_modules/d3-format/src/formatPrefixAuto.js
34384   var prefixExponent;
34385   function formatPrefixAuto_default(x2, p2) {
34386     var d2 = formatDecimalParts(x2, p2);
34387     if (!d2)
34388       return x2 + "";
34389     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;
34390     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];
34391   }
34392
34393   // node_modules/d3-format/src/formatRounded.js
34394   function formatRounded_default(x2, p2) {
34395     var d2 = formatDecimalParts(x2, p2);
34396     if (!d2)
34397       return x2 + "";
34398     var coefficient = d2[0], exponent = d2[1];
34399     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");
34400   }
34401
34402   // node_modules/d3-format/src/formatTypes.js
34403   var formatTypes_default = {
34404     "%": (x2, p2) => (x2 * 100).toFixed(p2),
34405     "b": (x2) => Math.round(x2).toString(2),
34406     "c": (x2) => x2 + "",
34407     "d": formatDecimal_default,
34408     "e": (x2, p2) => x2.toExponential(p2),
34409     "f": (x2, p2) => x2.toFixed(p2),
34410     "g": (x2, p2) => x2.toPrecision(p2),
34411     "o": (x2) => Math.round(x2).toString(8),
34412     "p": (x2, p2) => formatRounded_default(x2 * 100, p2),
34413     "r": formatRounded_default,
34414     "s": formatPrefixAuto_default,
34415     "X": (x2) => Math.round(x2).toString(16).toUpperCase(),
34416     "x": (x2) => Math.round(x2).toString(16)
34417   };
34418
34419   // node_modules/d3-format/src/identity.js
34420   function identity_default3(x2) {
34421     return x2;
34422   }
34423
34424   // node_modules/d3-format/src/locale.js
34425   var map = Array.prototype.map;
34426   var prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
34427   function locale_default(locale2) {
34428     var group = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity_default3 : formatGroup_default(map.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal === void 0 ? "." : locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity_default3 : formatNumerals_default(map.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus === void 0 ? "\u2212" : locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + "";
34429     function newFormat(specifier) {
34430       specifier = formatSpecifier(specifier);
34431       var fill = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol = specifier.symbol, zero3 = specifier.zero, width = specifier.width, comma = specifier.comma, precision2 = specifier.precision, trim = specifier.trim, type2 = specifier.type;
34432       if (type2 === "n")
34433         comma = true, type2 = "g";
34434       else if (!formatTypes_default[type2])
34435         precision2 === void 0 && (precision2 = 12), trim = true, type2 = "g";
34436       if (zero3 || fill === "0" && align === "=")
34437         zero3 = true, fill = "0", align = "=";
34438       var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : "";
34439       var formatType = formatTypes_default[type2], maybeSuffix = /[defgprs%]/.test(type2);
34440       precision2 = precision2 === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision2)) : Math.max(0, Math.min(20, precision2));
34441       function format2(value) {
34442         var valuePrefix = prefix, valueSuffix = suffix, i3, n3, c2;
34443         if (type2 === "c") {
34444           valueSuffix = formatType(value) + valueSuffix;
34445           value = "";
34446         } else {
34447           value = +value;
34448           var valueNegative = value < 0 || 1 / value < 0;
34449           value = isNaN(value) ? nan : formatType(Math.abs(value), precision2);
34450           if (trim)
34451             value = formatTrim_default(value);
34452           if (valueNegative && +value === 0 && sign2 !== "+")
34453             valueNegative = false;
34454           valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix;
34455           valueSuffix = (type2 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : "");
34456           if (maybeSuffix) {
34457             i3 = -1, n3 = value.length;
34458             while (++i3 < n3) {
34459               if (c2 = value.charCodeAt(i3), 48 > c2 || c2 > 57) {
34460                 valueSuffix = (c2 === 46 ? decimal + value.slice(i3 + 1) : value.slice(i3)) + valueSuffix;
34461                 value = value.slice(0, i3);
34462                 break;
34463               }
34464             }
34465           }
34466         }
34467         if (comma && !zero3)
34468           value = group(value, Infinity);
34469         var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : "";
34470         if (comma && zero3)
34471           value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
34472         switch (align) {
34473           case "<":
34474             value = valuePrefix + value + valueSuffix + padding;
34475             break;
34476           case "=":
34477             value = valuePrefix + padding + value + valueSuffix;
34478             break;
34479           case "^":
34480             value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
34481             break;
34482           default:
34483             value = padding + valuePrefix + value + valueSuffix;
34484             break;
34485         }
34486         return numerals(value);
34487       }
34488       format2.toString = function() {
34489         return specifier + "";
34490       };
34491       return format2;
34492     }
34493     function formatPrefix2(specifier, value) {
34494       var f3 = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e3 = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k2 = Math.pow(10, -e3), prefix = prefixes[8 + e3 / 3];
34495       return function(value2) {
34496         return f3(k2 * value2) + prefix;
34497       };
34498     }
34499     return {
34500       format: newFormat,
34501       formatPrefix: formatPrefix2
34502     };
34503   }
34504
34505   // node_modules/d3-format/src/defaultLocale.js
34506   var locale;
34507   var format;
34508   var formatPrefix;
34509   defaultLocale({
34510     thousands: ",",
34511     grouping: [3],
34512     currency: ["$", ""]
34513   });
34514   function defaultLocale(definition) {
34515     locale = locale_default(definition);
34516     format = locale.format;
34517     formatPrefix = locale.formatPrefix;
34518     return locale;
34519   }
34520
34521   // node_modules/d3-format/src/precisionFixed.js
34522   function precisionFixed_default(step) {
34523     return Math.max(0, -exponent_default(Math.abs(step)));
34524   }
34525
34526   // node_modules/d3-format/src/precisionPrefix.js
34527   function precisionPrefix_default(step, value) {
34528     return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
34529   }
34530
34531   // node_modules/d3-format/src/precisionRound.js
34532   function precisionRound_default(step, max3) {
34533     step = Math.abs(step), max3 = Math.abs(max3) - step;
34534     return Math.max(0, exponent_default(max3) - exponent_default(step)) + 1;
34535   }
34536
34537   // node_modules/d3-scale/src/tickFormat.js
34538   function tickFormat(start2, stop, count, specifier) {
34539     var step = tickStep(start2, stop, count), precision2;
34540     specifier = formatSpecifier(specifier == null ? ",f" : specifier);
34541     switch (specifier.type) {
34542       case "s": {
34543         var value = Math.max(Math.abs(start2), Math.abs(stop));
34544         if (specifier.precision == null && !isNaN(precision2 = precisionPrefix_default(step, value)))
34545           specifier.precision = precision2;
34546         return formatPrefix(specifier, value);
34547       }
34548       case "":
34549       case "e":
34550       case "g":
34551       case "p":
34552       case "r": {
34553         if (specifier.precision == null && !isNaN(precision2 = precisionRound_default(step, Math.max(Math.abs(start2), Math.abs(stop)))))
34554           specifier.precision = precision2 - (specifier.type === "e");
34555         break;
34556       }
34557       case "f":
34558       case "%": {
34559         if (specifier.precision == null && !isNaN(precision2 = precisionFixed_default(step)))
34560           specifier.precision = precision2 - (specifier.type === "%") * 2;
34561         break;
34562       }
34563     }
34564     return format(specifier);
34565   }
34566
34567   // node_modules/d3-scale/src/linear.js
34568   function linearish(scale) {
34569     var domain2 = scale.domain;
34570     scale.ticks = function(count) {
34571       var d2 = domain2();
34572       return ticks(d2[0], d2[d2.length - 1], count == null ? 10 : count);
34573     };
34574     scale.tickFormat = function(count, specifier) {
34575       var d2 = domain2();
34576       return tickFormat(d2[0], d2[d2.length - 1], count == null ? 10 : count, specifier);
34577     };
34578     scale.nice = function(count) {
34579       if (count == null)
34580         count = 10;
34581       var d2 = domain2();
34582       var i0 = 0;
34583       var i1 = d2.length - 1;
34584       var start2 = d2[i0];
34585       var stop = d2[i1];
34586       var prestep;
34587       var step;
34588       var maxIter = 10;
34589       if (stop < start2) {
34590         step = start2, start2 = stop, stop = step;
34591         step = i0, i0 = i1, i1 = step;
34592       }
34593       while (maxIter-- > 0) {
34594         step = tickIncrement(start2, stop, count);
34595         if (step === prestep) {
34596           d2[i0] = start2;
34597           d2[i1] = stop;
34598           return domain2(d2);
34599         } else if (step > 0) {
34600           start2 = Math.floor(start2 / step) * step;
34601           stop = Math.ceil(stop / step) * step;
34602         } else if (step < 0) {
34603           start2 = Math.ceil(start2 * step) / step;
34604           stop = Math.floor(stop * step) / step;
34605         } else {
34606           break;
34607         }
34608         prestep = step;
34609       }
34610       return scale;
34611     };
34612     return scale;
34613   }
34614   function linear3() {
34615     var scale = continuous();
34616     scale.copy = function() {
34617       return copy(scale, linear3());
34618     };
34619     initRange.apply(scale, arguments);
34620     return linearish(scale);
34621   }
34622
34623   // node_modules/d3-scale/src/quantize.js
34624   function quantize() {
34625     var x05 = 0, x12 = 1, n3 = 1, domain2 = [0.5], range3 = [0, 1], unknown;
34626     function scale(x2) {
34627       return x2 != null && x2 <= x2 ? range3[bisect_default(domain2, x2, 0, n3)] : unknown;
34628     }
34629     function rescale() {
34630       var i3 = -1;
34631       domain2 = new Array(n3);
34632       while (++i3 < n3)
34633         domain2[i3] = ((i3 + 1) * x12 - (i3 - n3) * x05) / (n3 + 1);
34634       return scale;
34635     }
34636     scale.domain = function(_2) {
34637       return arguments.length ? ([x05, x12] = _2, x05 = +x05, x12 = +x12, rescale()) : [x05, x12];
34638     };
34639     scale.range = function(_2) {
34640       return arguments.length ? (n3 = (range3 = Array.from(_2)).length - 1, rescale()) : range3.slice();
34641     };
34642     scale.invertExtent = function(y2) {
34643       var i3 = range3.indexOf(y2);
34644       return i3 < 0 ? [NaN, NaN] : i3 < 1 ? [x05, domain2[0]] : i3 >= n3 ? [domain2[n3 - 1], x12] : [domain2[i3 - 1], domain2[i3]];
34645     };
34646     scale.unknown = function(_2) {
34647       return arguments.length ? (unknown = _2, scale) : scale;
34648     };
34649     scale.thresholds = function() {
34650       return domain2.slice();
34651     };
34652     scale.copy = function() {
34653       return quantize().domain([x05, x12]).range(range3).unknown(unknown);
34654     };
34655     return initRange.apply(linearish(scale), arguments);
34656   }
34657
34658   // modules/behavior/breathe.js
34659   function behaviorBreathe() {
34660     var duration = 800;
34661     var steps = 4;
34662     var selector = ".selected.shadow, .selected .shadow";
34663     var _selected = select_default2(null);
34664     var _classed = "";
34665     var _params = {};
34666     var _done = false;
34667     var _timer;
34668     function ratchetyInterpolator(a2, b2, steps2, units) {
34669       a2 = Number(a2);
34670       b2 = Number(b2);
34671       var sample = quantize().domain([0, 1]).range(quantize_default(number_default(a2, b2), steps2));
34672       return function(t2) {
34673         return String(sample(t2)) + (units || "");
34674       };
34675     }
34676     function reset(selection2) {
34677       selection2.style("stroke-opacity", null).style("stroke-width", null).style("fill-opacity", null).style("r", null);
34678     }
34679     function setAnimationParams(transition2, fromTo) {
34680       var toFrom = fromTo === "from" ? "to" : "from";
34681       transition2.styleTween("stroke-opacity", function(d2) {
34682         return ratchetyInterpolator(
34683           _params[d2.id][toFrom].opacity,
34684           _params[d2.id][fromTo].opacity,
34685           steps
34686         );
34687       }).styleTween("stroke-width", function(d2) {
34688         return ratchetyInterpolator(
34689           _params[d2.id][toFrom].width,
34690           _params[d2.id][fromTo].width,
34691           steps,
34692           "px"
34693         );
34694       }).styleTween("fill-opacity", function(d2) {
34695         return ratchetyInterpolator(
34696           _params[d2.id][toFrom].opacity,
34697           _params[d2.id][fromTo].opacity,
34698           steps
34699         );
34700       }).styleTween("r", function(d2) {
34701         return ratchetyInterpolator(
34702           _params[d2.id][toFrom].width,
34703           _params[d2.id][fromTo].width,
34704           steps,
34705           "px"
34706         );
34707       });
34708     }
34709     function calcAnimationParams(selection2) {
34710       selection2.call(reset).each(function(d2) {
34711         var s2 = select_default2(this);
34712         var tag = s2.node().tagName;
34713         var p2 = { "from": {}, "to": {} };
34714         var opacity;
34715         var width;
34716         if (tag === "circle") {
34717           opacity = Number(s2.style("fill-opacity") || 0.5);
34718           width = Number(s2.style("r") || 15.5);
34719         } else {
34720           opacity = Number(s2.style("stroke-opacity") || 0.7);
34721           width = Number(s2.style("stroke-width") || 10);
34722         }
34723         p2.tag = tag;
34724         p2.from.opacity = opacity * 0.6;
34725         p2.to.opacity = opacity * 1.25;
34726         p2.from.width = width * 0.7;
34727         p2.to.width = width * (tag === "circle" ? 1.5 : 1);
34728         _params[d2.id] = p2;
34729       });
34730     }
34731     function run(surface, fromTo) {
34732       var toFrom = fromTo === "from" ? "to" : "from";
34733       var currSelected = surface.selectAll(selector);
34734       var currClassed = surface.attr("class");
34735       if (_done || currSelected.empty()) {
34736         _selected.call(reset);
34737         _selected = select_default2(null);
34738         return;
34739       }
34740       if (!(0, import_fast_deep_equal2.default)(currSelected.data(), _selected.data()) || currClassed !== _classed) {
34741         _selected.call(reset);
34742         _classed = currClassed;
34743         _selected = currSelected.call(calcAnimationParams);
34744       }
34745       var didCallNextRun = false;
34746       _selected.transition().duration(duration).call(setAnimationParams, fromTo).on("end", function() {
34747         if (!didCallNextRun) {
34748           surface.call(run, toFrom);
34749           didCallNextRun = true;
34750         }
34751         if (!select_default2(this).classed("selected")) {
34752           reset(select_default2(this));
34753         }
34754       });
34755     }
34756     function behavior(surface) {
34757       _done = false;
34758       _timer = timer(function() {
34759         if (surface.selectAll(selector).empty()) {
34760           return false;
34761         }
34762         surface.call(run, "from");
34763         _timer.stop();
34764         return true;
34765       }, 20);
34766     }
34767     behavior.restartIfNeeded = function(surface) {
34768       if (_selected.empty()) {
34769         surface.call(run, "from");
34770         if (_timer) {
34771           _timer.stop();
34772         }
34773       }
34774     };
34775     behavior.off = function() {
34776       _done = true;
34777       if (_timer) {
34778         _timer.stop();
34779       }
34780       _selected.interrupt().call(reset);
34781     };
34782     return behavior;
34783   }
34784
34785   // modules/behavior/operation.js
34786   function behaviorOperation(context) {
34787     var _operation;
34788     function keypress(d3_event) {
34789       if (!context.map().withinEditableZoom())
34790         return;
34791       if (_operation.availableForKeypress && !_operation.availableForKeypress())
34792         return;
34793       d3_event.preventDefault();
34794       var disabled = _operation.disabled();
34795       if (disabled) {
34796         context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_operation.tooltip())();
34797       } else {
34798         context.ui().flash.duration(2e3).iconName("#iD-operation-" + _operation.id).iconClass("operation").label(_operation.annotation() || _operation.title)();
34799         if (_operation.point)
34800           _operation.point(null);
34801         _operation();
34802       }
34803     }
34804     function behavior() {
34805       if (_operation && _operation.available()) {
34806         context.keybinding().on(_operation.keys, keypress);
34807       }
34808       return behavior;
34809     }
34810     behavior.off = function() {
34811       context.keybinding().off(_operation.keys);
34812     };
34813     behavior.which = function(_2) {
34814       if (!arguments.length)
34815         return _operation;
34816       _operation = _2;
34817       return behavior;
34818     };
34819     return behavior;
34820   }
34821
34822   // modules/operations/circularize.js
34823   function operationCircularize(context, selectedIDs) {
34824     var _extent;
34825     var _actions = selectedIDs.map(getAction).filter(Boolean);
34826     var _amount = _actions.length === 1 ? "single" : "multiple";
34827     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
34828       return n3.loc;
34829     });
34830     function getAction(entityID) {
34831       var entity = context.entity(entityID);
34832       if (entity.type !== "way" || new Set(entity.nodes).size <= 1)
34833         return null;
34834       if (!_extent) {
34835         _extent = entity.extent(context.graph());
34836       } else {
34837         _extent = _extent.extend(entity.extent(context.graph()));
34838       }
34839       return actionCircularize(entityID, context.projection);
34840     }
34841     var operation = function() {
34842       if (!_actions.length)
34843         return;
34844       var combinedAction = function(graph, t2) {
34845         _actions.forEach(function(action) {
34846           if (!action.disabled(graph)) {
34847             graph = action(graph, t2);
34848           }
34849         });
34850         return graph;
34851       };
34852       combinedAction.transitionable = true;
34853       context.perform(combinedAction, operation.annotation());
34854       window.setTimeout(function() {
34855         context.validator().validate();
34856       }, 300);
34857     };
34858     operation.available = function() {
34859       return _actions.length && selectedIDs.length === _actions.length;
34860     };
34861     operation.disabled = function() {
34862       if (!_actions.length)
34863         return "";
34864       var actionDisableds = _actions.map(function(action) {
34865         return action.disabled(context.graph());
34866       }).filter(Boolean);
34867       if (actionDisableds.length === _actions.length) {
34868         if (new Set(actionDisableds).size > 1) {
34869           return "multiple_blockers";
34870         }
34871         return actionDisableds[0];
34872       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
34873         return "too_large";
34874       } else if (someMissing()) {
34875         return "not_downloaded";
34876       } else if (selectedIDs.some(context.hasHiddenConnections)) {
34877         return "connected_to_hidden";
34878       }
34879       return false;
34880       function someMissing() {
34881         if (context.inIntro())
34882           return false;
34883         var osm = context.connection();
34884         if (osm) {
34885           var missing = _coords.filter(function(loc) {
34886             return !osm.isDataLoaded(loc);
34887           });
34888           if (missing.length) {
34889             missing.forEach(function(loc) {
34890               context.loadTileAtLoc(loc);
34891             });
34892             return true;
34893           }
34894         }
34895         return false;
34896       }
34897     };
34898     operation.tooltip = function() {
34899       var disable = operation.disabled();
34900       return disable ? _t.append("operations.circularize." + disable + "." + _amount) : _t.append("operations.circularize.description." + _amount);
34901     };
34902     operation.annotation = function() {
34903       return _t("operations.circularize.annotation.feature", { n: _actions.length });
34904     };
34905     operation.id = "circularize";
34906     operation.keys = [_t("operations.circularize.key")];
34907     operation.title = _t.append("operations.circularize.title");
34908     operation.behavior = behaviorOperation(context).which(operation);
34909     return operation;
34910   }
34911
34912   // modules/ui/cmd.js
34913   var uiCmd = function(code) {
34914     var detected = utilDetect();
34915     if (detected.os === "mac") {
34916       return code;
34917     }
34918     if (detected.os === "win") {
34919       if (code === "\u2318\u21E7Z")
34920         return "Ctrl+Y";
34921     }
34922     var result = "", replacements = {
34923       "\u2318": "Ctrl",
34924       "\u21E7": "Shift",
34925       "\u2325": "Alt",
34926       "\u232B": "Backspace",
34927       "\u2326": "Delete"
34928     };
34929     for (var i3 = 0; i3 < code.length; i3++) {
34930       if (code[i3] in replacements) {
34931         result += replacements[code[i3]] + (i3 < code.length - 1 ? "+" : "");
34932       } else {
34933         result += code[i3];
34934       }
34935     }
34936     return result;
34937   };
34938   uiCmd.display = function(code) {
34939     if (code.length !== 1)
34940       return code;
34941     var detected = utilDetect();
34942     var mac = detected.os === "mac";
34943     var replacements = {
34944       "\u2318": mac ? "\u2318 " + _t("shortcuts.key.cmd") : _t("shortcuts.key.ctrl"),
34945       "\u21E7": mac ? "\u21E7 " + _t("shortcuts.key.shift") : _t("shortcuts.key.shift"),
34946       "\u2325": mac ? "\u2325 " + _t("shortcuts.key.option") : _t("shortcuts.key.alt"),
34947       "\u2303": mac ? "\u2303 " + _t("shortcuts.key.ctrl") : _t("shortcuts.key.ctrl"),
34948       "\u232B": mac ? "\u232B " + _t("shortcuts.key.delete") : _t("shortcuts.key.backspace"),
34949       "\u2326": mac ? "\u2326 " + _t("shortcuts.key.del") : _t("shortcuts.key.del"),
34950       "\u2196": mac ? "\u2196 " + _t("shortcuts.key.pgup") : _t("shortcuts.key.pgup"),
34951       "\u2198": mac ? "\u2198 " + _t("shortcuts.key.pgdn") : _t("shortcuts.key.pgdn"),
34952       "\u21DE": mac ? "\u21DE " + _t("shortcuts.key.home") : _t("shortcuts.key.home"),
34953       "\u21DF": mac ? "\u21DF " + _t("shortcuts.key.end") : _t("shortcuts.key.end"),
34954       "\u21B5": mac ? "\u23CE " + _t("shortcuts.key.return") : _t("shortcuts.key.enter"),
34955       "\u238B": mac ? "\u238B " + _t("shortcuts.key.esc") : _t("shortcuts.key.esc"),
34956       "\u2630": mac ? "\u2630 " + _t("shortcuts.key.menu") : _t("shortcuts.key.menu")
34957     };
34958     return replacements[code] || code;
34959   };
34960
34961   // modules/operations/delete.js
34962   function operationDelete(context, selectedIDs) {
34963     var multi = selectedIDs.length === 1 ? "single" : "multiple";
34964     var action = actionDeleteMultiple(selectedIDs);
34965     var nodes = utilGetAllNodes(selectedIDs, context.graph());
34966     var coords = nodes.map(function(n3) {
34967       return n3.loc;
34968     });
34969     var extent = utilTotalExtent(selectedIDs, context.graph());
34970     var operation = function() {
34971       var nextSelectedID;
34972       var nextSelectedLoc;
34973       if (selectedIDs.length === 1) {
34974         var id2 = selectedIDs[0];
34975         var entity = context.entity(id2);
34976         var geometry = entity.geometry(context.graph());
34977         var parents = context.graph().parentWays(entity);
34978         var parent = parents[0];
34979         if (geometry === "vertex") {
34980           var nodes2 = parent.nodes;
34981           var i3 = nodes2.indexOf(id2);
34982           if (i3 === 0) {
34983             i3++;
34984           } else if (i3 === nodes2.length - 1) {
34985             i3--;
34986           } else {
34987             var a2 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 - 1]).loc);
34988             var b2 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 + 1]).loc);
34989             i3 = a2 < b2 ? i3 - 1 : i3 + 1;
34990           }
34991           nextSelectedID = nodes2[i3];
34992           nextSelectedLoc = context.entity(nextSelectedID).loc;
34993         }
34994       }
34995       context.perform(action, operation.annotation());
34996       context.validator().validate();
34997       if (nextSelectedID && nextSelectedLoc) {
34998         if (context.hasEntity(nextSelectedID)) {
34999           context.enter(modeSelect(context, [nextSelectedID]).follow(true));
35000         } else {
35001           context.map().centerEase(nextSelectedLoc);
35002           context.enter(modeBrowse(context));
35003         }
35004       } else {
35005         context.enter(modeBrowse(context));
35006       }
35007     };
35008     operation.available = function() {
35009       return true;
35010     };
35011     operation.disabled = function() {
35012       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35013         return "too_large";
35014       } else if (someMissing()) {
35015         return "not_downloaded";
35016       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35017         return "connected_to_hidden";
35018       } else if (selectedIDs.some(protectedMember)) {
35019         return "part_of_relation";
35020       } else if (selectedIDs.some(incompleteRelation)) {
35021         return "incomplete_relation";
35022       } else if (selectedIDs.some(hasWikidataTag)) {
35023         return "has_wikidata_tag";
35024       }
35025       return false;
35026       function someMissing() {
35027         if (context.inIntro())
35028           return false;
35029         var osm = context.connection();
35030         if (osm) {
35031           var missing = coords.filter(function(loc) {
35032             return !osm.isDataLoaded(loc);
35033           });
35034           if (missing.length) {
35035             missing.forEach(function(loc) {
35036               context.loadTileAtLoc(loc);
35037             });
35038             return true;
35039           }
35040         }
35041         return false;
35042       }
35043       function hasWikidataTag(id2) {
35044         var entity = context.entity(id2);
35045         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
35046       }
35047       function incompleteRelation(id2) {
35048         var entity = context.entity(id2);
35049         return entity.type === "relation" && !entity.isComplete(context.graph());
35050       }
35051       function protectedMember(id2) {
35052         var entity = context.entity(id2);
35053         if (entity.type !== "way")
35054           return false;
35055         var parents = context.graph().parentRelations(entity);
35056         for (var i3 = 0; i3 < parents.length; i3++) {
35057           var parent = parents[i3];
35058           var type2 = parent.tags.type;
35059           var role = parent.memberById(id2).role || "outer";
35060           if (type2 === "route" || type2 === "boundary" || type2 === "multipolygon" && role === "outer") {
35061             return true;
35062           }
35063         }
35064         return false;
35065       }
35066     };
35067     operation.tooltip = function() {
35068       var disable = operation.disabled();
35069       return disable ? _t.append("operations.delete." + disable + "." + multi) : _t.append("operations.delete.description." + multi);
35070     };
35071     operation.annotation = function() {
35072       return selectedIDs.length === 1 ? _t("operations.delete.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.delete.annotation.feature", { n: selectedIDs.length });
35073     };
35074     operation.id = "delete";
35075     operation.keys = [uiCmd("\u2318\u232B"), uiCmd("\u2318\u2326"), uiCmd("\u2326")];
35076     operation.title = _t.append("operations.delete.title");
35077     operation.behavior = behaviorOperation(context).which(operation);
35078     return operation;
35079   }
35080
35081   // modules/operations/orthogonalize.js
35082   function operationOrthogonalize(context, selectedIDs) {
35083     var _extent;
35084     var _type;
35085     var _actions = selectedIDs.map(chooseAction).filter(Boolean);
35086     var _amount = _actions.length === 1 ? "single" : "multiple";
35087     var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
35088       return n3.loc;
35089     });
35090     function chooseAction(entityID) {
35091       var entity = context.entity(entityID);
35092       var geometry = entity.geometry(context.graph());
35093       if (!_extent) {
35094         _extent = entity.extent(context.graph());
35095       } else {
35096         _extent = _extent.extend(entity.extent(context.graph()));
35097       }
35098       if (entity.type === "way" && new Set(entity.nodes).size > 2) {
35099         if (_type && _type !== "feature")
35100           return null;
35101         _type = "feature";
35102         return actionOrthogonalize(entityID, context.projection);
35103       } else if (geometry === "vertex") {
35104         if (_type && _type !== "corner")
35105           return null;
35106         _type = "corner";
35107         var graph = context.graph();
35108         var parents = graph.parentWays(entity);
35109         if (parents.length === 1) {
35110           var way = parents[0];
35111           if (way.nodes.indexOf(entityID) !== -1) {
35112             return actionOrthogonalize(way.id, context.projection, entityID);
35113           }
35114         }
35115       }
35116       return null;
35117     }
35118     var operation = function() {
35119       if (!_actions.length)
35120         return;
35121       var combinedAction = function(graph, t2) {
35122         _actions.forEach(function(action) {
35123           if (!action.disabled(graph)) {
35124             graph = action(graph, t2);
35125           }
35126         });
35127         return graph;
35128       };
35129       combinedAction.transitionable = true;
35130       context.perform(combinedAction, operation.annotation());
35131       window.setTimeout(function() {
35132         context.validator().validate();
35133       }, 300);
35134     };
35135     operation.available = function() {
35136       return _actions.length && selectedIDs.length === _actions.length;
35137     };
35138     operation.disabled = function() {
35139       if (!_actions.length)
35140         return "";
35141       var actionDisableds = _actions.map(function(action) {
35142         return action.disabled(context.graph());
35143       }).filter(Boolean);
35144       if (actionDisableds.length === _actions.length) {
35145         if (new Set(actionDisableds).size > 1) {
35146           return "multiple_blockers";
35147         }
35148         return actionDisableds[0];
35149       } else if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
35150         return "too_large";
35151       } else if (someMissing()) {
35152         return "not_downloaded";
35153       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35154         return "connected_to_hidden";
35155       }
35156       return false;
35157       function someMissing() {
35158         if (context.inIntro())
35159           return false;
35160         var osm = context.connection();
35161         if (osm) {
35162           var missing = _coords.filter(function(loc) {
35163             return !osm.isDataLoaded(loc);
35164           });
35165           if (missing.length) {
35166             missing.forEach(function(loc) {
35167               context.loadTileAtLoc(loc);
35168             });
35169             return true;
35170           }
35171         }
35172         return false;
35173       }
35174     };
35175     operation.tooltip = function() {
35176       var disable = operation.disabled();
35177       return disable ? _t.append("operations.orthogonalize." + disable + "." + _amount) : _t.append("operations.orthogonalize.description." + _type + "." + _amount);
35178     };
35179     operation.annotation = function() {
35180       return _t("operations.orthogonalize.annotation." + _type, { n: _actions.length });
35181     };
35182     operation.id = "orthogonalize";
35183     operation.keys = [_t("operations.orthogonalize.key")];
35184     operation.title = _t.append("operations.orthogonalize.title");
35185     operation.behavior = behaviorOperation(context).which(operation);
35186     return operation;
35187   }
35188
35189   // modules/operations/reflect.js
35190   function operationReflectShort(context, selectedIDs) {
35191     return operationReflect(context, selectedIDs, "short");
35192   }
35193   function operationReflectLong(context, selectedIDs) {
35194     return operationReflect(context, selectedIDs, "long");
35195   }
35196   function operationReflect(context, selectedIDs, axis) {
35197     axis = axis || "long";
35198     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35199     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35200     var coords = nodes.map(function(n3) {
35201       return n3.loc;
35202     });
35203     var extent = utilTotalExtent(selectedIDs, context.graph());
35204     var operation = function() {
35205       var action = actionReflect(selectedIDs, context.projection).useLongAxis(Boolean(axis === "long"));
35206       context.perform(action, operation.annotation());
35207       window.setTimeout(function() {
35208         context.validator().validate();
35209       }, 300);
35210     };
35211     operation.available = function() {
35212       return nodes.length >= 3;
35213     };
35214     operation.disabled = function() {
35215       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35216         return "too_large";
35217       } else if (someMissing()) {
35218         return "not_downloaded";
35219       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35220         return "connected_to_hidden";
35221       } else if (selectedIDs.some(incompleteRelation)) {
35222         return "incomplete_relation";
35223       }
35224       return false;
35225       function someMissing() {
35226         if (context.inIntro())
35227           return false;
35228         var osm = context.connection();
35229         if (osm) {
35230           var missing = coords.filter(function(loc) {
35231             return !osm.isDataLoaded(loc);
35232           });
35233           if (missing.length) {
35234             missing.forEach(function(loc) {
35235               context.loadTileAtLoc(loc);
35236             });
35237             return true;
35238           }
35239         }
35240         return false;
35241       }
35242       function incompleteRelation(id2) {
35243         var entity = context.entity(id2);
35244         return entity.type === "relation" && !entity.isComplete(context.graph());
35245       }
35246     };
35247     operation.tooltip = function() {
35248       var disable = operation.disabled();
35249       return disable ? _t.append("operations.reflect." + disable + "." + multi) : _t.append("operations.reflect.description." + axis + "." + multi);
35250     };
35251     operation.annotation = function() {
35252       return _t("operations.reflect.annotation." + axis + ".feature", { n: selectedIDs.length });
35253     };
35254     operation.id = "reflect-" + axis;
35255     operation.keys = [_t("operations.reflect.key." + axis)];
35256     operation.title = _t.append("operations.reflect.title." + axis);
35257     operation.behavior = behaviorOperation(context).which(operation);
35258     return operation;
35259   }
35260
35261   // modules/operations/move.js
35262   function operationMove(context, selectedIDs) {
35263     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35264     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35265     var coords = nodes.map(function(n3) {
35266       return n3.loc;
35267     });
35268     var extent = utilTotalExtent(selectedIDs, context.graph());
35269     var operation = function() {
35270       context.enter(modeMove(context, selectedIDs));
35271     };
35272     operation.available = function() {
35273       return selectedIDs.length > 0;
35274     };
35275     operation.disabled = function() {
35276       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35277         return "too_large";
35278       } else if (someMissing()) {
35279         return "not_downloaded";
35280       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35281         return "connected_to_hidden";
35282       } else if (selectedIDs.some(incompleteRelation)) {
35283         return "incomplete_relation";
35284       }
35285       return false;
35286       function someMissing() {
35287         if (context.inIntro())
35288           return false;
35289         var osm = context.connection();
35290         if (osm) {
35291           var missing = coords.filter(function(loc) {
35292             return !osm.isDataLoaded(loc);
35293           });
35294           if (missing.length) {
35295             missing.forEach(function(loc) {
35296               context.loadTileAtLoc(loc);
35297             });
35298             return true;
35299           }
35300         }
35301         return false;
35302       }
35303       function incompleteRelation(id2) {
35304         var entity = context.entity(id2);
35305         return entity.type === "relation" && !entity.isComplete(context.graph());
35306       }
35307     };
35308     operation.tooltip = function() {
35309       var disable = operation.disabled();
35310       return disable ? _t.append("operations.move." + disable + "." + multi) : _t.append("operations.move.description." + multi);
35311     };
35312     operation.annotation = function() {
35313       return selectedIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.move.annotation.feature", { n: selectedIDs.length });
35314     };
35315     operation.id = "move";
35316     operation.keys = [_t("operations.move.key")];
35317     operation.title = _t.append("operations.move.title");
35318     operation.behavior = behaviorOperation(context).which(operation);
35319     operation.mouseOnly = true;
35320     return operation;
35321   }
35322
35323   // modules/modes/rotate.js
35324   function modeRotate(context, entityIDs) {
35325     var _tolerancePx = 4;
35326     var mode = {
35327       id: "rotate",
35328       button: "browse"
35329     };
35330     var keybinding = utilKeybinding("rotate");
35331     var behaviors = [
35332       behaviorEdit(context),
35333       operationCircularize(context, entityIDs).behavior,
35334       operationDelete(context, entityIDs).behavior,
35335       operationMove(context, entityIDs).behavior,
35336       operationOrthogonalize(context, entityIDs).behavior,
35337       operationReflectLong(context, entityIDs).behavior,
35338       operationReflectShort(context, entityIDs).behavior
35339     ];
35340     var annotation = entityIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.rotate.annotation.feature", { n: entityIDs.length });
35341     var _prevGraph;
35342     var _prevAngle;
35343     var _prevTransform;
35344     var _pivot;
35345     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35346     function doRotate(d3_event) {
35347       var fn;
35348       if (context.graph() !== _prevGraph) {
35349         fn = context.perform;
35350       } else {
35351         fn = context.replace;
35352       }
35353       var projection2 = context.projection;
35354       var currTransform = projection2.transform();
35355       if (!_prevTransform || currTransform.k !== _prevTransform.k || currTransform.x !== _prevTransform.x || currTransform.y !== _prevTransform.y) {
35356         var nodes = utilGetAllNodes(entityIDs, context.graph());
35357         var points = nodes.map(function(n3) {
35358           return projection2(n3.loc);
35359         });
35360         _pivot = getPivot(points);
35361         _prevAngle = void 0;
35362       }
35363       var currMouse = context.map().mouse(d3_event);
35364       var currAngle = Math.atan2(currMouse[1] - _pivot[1], currMouse[0] - _pivot[0]);
35365       if (typeof _prevAngle === "undefined")
35366         _prevAngle = currAngle;
35367       var delta = currAngle - _prevAngle;
35368       fn(actionRotate(entityIDs, _pivot, delta, projection2));
35369       _prevTransform = currTransform;
35370       _prevAngle = currAngle;
35371       _prevGraph = context.graph();
35372     }
35373     function getPivot(points) {
35374       var _pivot2;
35375       if (points.length === 1) {
35376         _pivot2 = points[0];
35377       } else if (points.length === 2) {
35378         _pivot2 = geoVecInterp(points[0], points[1], 0.5);
35379       } else {
35380         var polygonHull = hull_default(points);
35381         if (polygonHull.length === 2) {
35382           _pivot2 = geoVecInterp(points[0], points[1], 0.5);
35383         } else {
35384           _pivot2 = centroid_default2(hull_default(points));
35385         }
35386       }
35387       return _pivot2;
35388     }
35389     function finish(d3_event) {
35390       d3_event.stopPropagation();
35391       context.replace(actionNoop(), annotation);
35392       context.enter(modeSelect(context, entityIDs));
35393     }
35394     function cancel() {
35395       if (_prevGraph)
35396         context.pop();
35397       context.enter(modeSelect(context, entityIDs));
35398     }
35399     function undone() {
35400       context.enter(modeBrowse(context));
35401     }
35402     mode.enter = function() {
35403       _prevGraph = null;
35404       context.features().forceVisible(entityIDs);
35405       behaviors.forEach(context.install);
35406       var downEvent;
35407       context.surface().on(_pointerPrefix + "down.modeRotate", function(d3_event) {
35408         downEvent = d3_event;
35409       });
35410       select_default2(window).on(_pointerPrefix + "move.modeRotate", doRotate, true).on(_pointerPrefix + "up.modeRotate", function(d3_event) {
35411         if (!downEvent)
35412           return;
35413         var mapNode = context.container().select(".main-map").node();
35414         var pointGetter = utilFastMouse(mapNode);
35415         var p1 = pointGetter(downEvent);
35416         var p2 = pointGetter(d3_event);
35417         var dist = geoVecLength(p1, p2);
35418         if (dist <= _tolerancePx)
35419           finish(d3_event);
35420         downEvent = null;
35421       }, true);
35422       context.history().on("undone.modeRotate", undone);
35423       keybinding.on("\u238B", cancel).on("\u21A9", finish);
35424       select_default2(document).call(keybinding);
35425     };
35426     mode.exit = function() {
35427       behaviors.forEach(context.uninstall);
35428       context.surface().on(_pointerPrefix + "down.modeRotate", null);
35429       select_default2(window).on(_pointerPrefix + "move.modeRotate", null, true).on(_pointerPrefix + "up.modeRotate", null, true);
35430       context.history().on("undone.modeRotate", null);
35431       select_default2(document).call(keybinding.unbind);
35432       context.features().forceVisible([]);
35433     };
35434     mode.selectedIDs = function() {
35435       if (!arguments.length)
35436         return entityIDs;
35437       return mode;
35438     };
35439     return mode;
35440   }
35441
35442   // modules/operations/rotate.js
35443   function operationRotate(context, selectedIDs) {
35444     var multi = selectedIDs.length === 1 ? "single" : "multiple";
35445     var nodes = utilGetAllNodes(selectedIDs, context.graph());
35446     var coords = nodes.map(function(n3) {
35447       return n3.loc;
35448     });
35449     var extent = utilTotalExtent(selectedIDs, context.graph());
35450     var operation = function() {
35451       context.enter(modeRotate(context, selectedIDs));
35452     };
35453     operation.available = function() {
35454       return nodes.length >= 2;
35455     };
35456     operation.disabled = function() {
35457       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35458         return "too_large";
35459       } else if (someMissing()) {
35460         return "not_downloaded";
35461       } else if (selectedIDs.some(context.hasHiddenConnections)) {
35462         return "connected_to_hidden";
35463       } else if (selectedIDs.some(incompleteRelation)) {
35464         return "incomplete_relation";
35465       }
35466       return false;
35467       function someMissing() {
35468         if (context.inIntro())
35469           return false;
35470         var osm = context.connection();
35471         if (osm) {
35472           var missing = coords.filter(function(loc) {
35473             return !osm.isDataLoaded(loc);
35474           });
35475           if (missing.length) {
35476             missing.forEach(function(loc) {
35477               context.loadTileAtLoc(loc);
35478             });
35479             return true;
35480           }
35481         }
35482         return false;
35483       }
35484       function incompleteRelation(id2) {
35485         var entity = context.entity(id2);
35486         return entity.type === "relation" && !entity.isComplete(context.graph());
35487       }
35488     };
35489     operation.tooltip = function() {
35490       var disable = operation.disabled();
35491       return disable ? _t.append("operations.rotate." + disable + "." + multi) : _t.append("operations.rotate.description." + multi);
35492     };
35493     operation.annotation = function() {
35494       return selectedIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.rotate.annotation.feature", { n: selectedIDs.length });
35495     };
35496     operation.id = "rotate";
35497     operation.keys = [_t("operations.rotate.key")];
35498     operation.title = _t.append("operations.rotate.title");
35499     operation.behavior = behaviorOperation(context).which(operation);
35500     operation.mouseOnly = true;
35501     return operation;
35502   }
35503
35504   // modules/modes/move.js
35505   function modeMove(context, entityIDs, baseGraph) {
35506     var _tolerancePx = 4;
35507     var mode = {
35508       id: "move",
35509       button: "browse"
35510     };
35511     var keybinding = utilKeybinding("move");
35512     var behaviors = [
35513       behaviorEdit(context),
35514       operationCircularize(context, entityIDs).behavior,
35515       operationDelete(context, entityIDs).behavior,
35516       operationOrthogonalize(context, entityIDs).behavior,
35517       operationReflectLong(context, entityIDs).behavior,
35518       operationReflectShort(context, entityIDs).behavior,
35519       operationRotate(context, entityIDs).behavior
35520     ];
35521     var annotation = entityIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.move.annotation.feature", { n: entityIDs.length });
35522     var _prevGraph;
35523     var _cache5;
35524     var _origin;
35525     var _nudgeInterval;
35526     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35527     function doMove(nudge) {
35528       nudge = nudge || [0, 0];
35529       var fn;
35530       if (_prevGraph !== context.graph()) {
35531         _cache5 = {};
35532         _origin = context.map().mouseCoordinates();
35533         fn = context.perform;
35534       } else {
35535         fn = context.overwrite;
35536       }
35537       var currMouse = context.map().mouse();
35538       var origMouse = context.projection(_origin);
35539       var delta = geoVecSubtract(geoVecSubtract(currMouse, origMouse), nudge);
35540       fn(actionMove(entityIDs, delta, context.projection, _cache5));
35541       _prevGraph = context.graph();
35542     }
35543     function startNudge(nudge) {
35544       if (_nudgeInterval)
35545         window.clearInterval(_nudgeInterval);
35546       _nudgeInterval = window.setInterval(function() {
35547         context.map().pan(nudge);
35548         doMove(nudge);
35549       }, 50);
35550     }
35551     function stopNudge() {
35552       if (_nudgeInterval) {
35553         window.clearInterval(_nudgeInterval);
35554         _nudgeInterval = null;
35555       }
35556     }
35557     function move() {
35558       doMove();
35559       var nudge = geoViewportEdge(context.map().mouse(), context.map().dimensions());
35560       if (nudge) {
35561         startNudge(nudge);
35562       } else {
35563         stopNudge();
35564       }
35565     }
35566     function finish(d3_event) {
35567       d3_event.stopPropagation();
35568       context.replace(actionNoop(), annotation);
35569       context.enter(modeSelect(context, entityIDs));
35570       stopNudge();
35571     }
35572     function cancel() {
35573       if (baseGraph) {
35574         while (context.graph() !== baseGraph)
35575           context.pop();
35576         context.enter(modeBrowse(context));
35577       } else {
35578         if (_prevGraph)
35579           context.pop();
35580         context.enter(modeSelect(context, entityIDs));
35581       }
35582       stopNudge();
35583     }
35584     function undone() {
35585       context.enter(modeBrowse(context));
35586     }
35587     mode.enter = function() {
35588       _origin = context.map().mouseCoordinates();
35589       _prevGraph = null;
35590       _cache5 = {};
35591       context.features().forceVisible(entityIDs);
35592       behaviors.forEach(context.install);
35593       var downEvent;
35594       context.surface().on(_pointerPrefix + "down.modeMove", function(d3_event) {
35595         downEvent = d3_event;
35596       });
35597       select_default2(window).on(_pointerPrefix + "move.modeMove", move, true).on(_pointerPrefix + "up.modeMove", function(d3_event) {
35598         if (!downEvent)
35599           return;
35600         var mapNode = context.container().select(".main-map").node();
35601         var pointGetter = utilFastMouse(mapNode);
35602         var p1 = pointGetter(downEvent);
35603         var p2 = pointGetter(d3_event);
35604         var dist = geoVecLength(p1, p2);
35605         if (dist <= _tolerancePx)
35606           finish(d3_event);
35607         downEvent = null;
35608       }, true);
35609       context.history().on("undone.modeMove", undone);
35610       keybinding.on("\u238B", cancel).on("\u21A9", finish);
35611       select_default2(document).call(keybinding);
35612     };
35613     mode.exit = function() {
35614       stopNudge();
35615       behaviors.forEach(function(behavior) {
35616         context.uninstall(behavior);
35617       });
35618       context.surface().on(_pointerPrefix + "down.modeMove", null);
35619       select_default2(window).on(_pointerPrefix + "move.modeMove", null, true).on(_pointerPrefix + "up.modeMove", null, true);
35620       context.history().on("undone.modeMove", null);
35621       select_default2(document).call(keybinding.unbind);
35622       context.features().forceVisible([]);
35623     };
35624     mode.selectedIDs = function() {
35625       if (!arguments.length)
35626         return entityIDs;
35627       return mode;
35628     };
35629     return mode;
35630   }
35631
35632   // modules/behavior/paste.js
35633   function behaviorPaste(context) {
35634     function doPaste(d3_event) {
35635       if (!context.map().withinEditableZoom())
35636         return;
35637       d3_event.preventDefault();
35638       var baseGraph = context.graph();
35639       var mouse = context.map().mouse();
35640       var projection2 = context.projection;
35641       var viewport = geoExtent(projection2.clipExtent()).polygon();
35642       if (!geoPointInPolygon(mouse, viewport))
35643         return;
35644       var oldIDs = context.copyIDs();
35645       if (!oldIDs.length)
35646         return;
35647       var extent = geoExtent();
35648       var oldGraph = context.copyGraph();
35649       var newIDs = [];
35650       var action = actionCopyEntities(oldIDs, oldGraph);
35651       context.perform(action);
35652       var copies = action.copies();
35653       var originals = /* @__PURE__ */ new Set();
35654       Object.values(copies).forEach(function(entity) {
35655         originals.add(entity.id);
35656       });
35657       for (var id2 in copies) {
35658         var oldEntity = oldGraph.entity(id2);
35659         var newEntity = copies[id2];
35660         extent._extend(oldEntity.extent(oldGraph));
35661         var parents = context.graph().parentWays(newEntity);
35662         var parentCopied = parents.some(function(parent) {
35663           return originals.has(parent.id);
35664         });
35665         if (!parentCopied) {
35666           newIDs.push(newEntity.id);
35667         }
35668       }
35669       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
35670       var delta = geoVecSubtract(mouse, copyPoint);
35671       context.perform(actionMove(newIDs, delta, projection2));
35672       context.enter(modeMove(context, newIDs, baseGraph));
35673     }
35674     function behavior() {
35675       context.keybinding().on(uiCmd("\u2318V"), doPaste);
35676       return behavior;
35677     }
35678     behavior.off = function() {
35679       context.keybinding().off(uiCmd("\u2318V"));
35680     };
35681     return behavior;
35682   }
35683
35684   // modules/behavior/drag.js
35685   function behaviorDrag() {
35686     var dispatch14 = dispatch_default("start", "move", "end");
35687     var _tolerancePx = 1;
35688     var _penTolerancePx = 4;
35689     var _origin = null;
35690     var _selector = "";
35691     var _targetNode;
35692     var _targetEntity;
35693     var _surface;
35694     var _pointerId;
35695     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35696     var d3_event_userSelectProperty = utilPrefixCSSProperty("UserSelect");
35697     var d3_event_userSelectSuppress = function() {
35698       var selection2 = selection_default();
35699       var select = selection2.style(d3_event_userSelectProperty);
35700       selection2.style(d3_event_userSelectProperty, "none");
35701       return function() {
35702         selection2.style(d3_event_userSelectProperty, select);
35703       };
35704     };
35705     function pointerdown(d3_event) {
35706       if (_pointerId)
35707         return;
35708       _pointerId = d3_event.pointerId || "mouse";
35709       _targetNode = this;
35710       var pointerLocGetter = utilFastMouse(_surface || _targetNode.parentNode);
35711       var offset;
35712       var startOrigin = pointerLocGetter(d3_event);
35713       var started = false;
35714       var selectEnable = d3_event_userSelectSuppress();
35715       select_default2(window).on(_pointerPrefix + "move.drag", pointermove).on(_pointerPrefix + "up.drag pointercancel.drag", pointerup, true);
35716       if (_origin) {
35717         offset = _origin.call(_targetNode, _targetEntity);
35718         offset = [offset[0] - startOrigin[0], offset[1] - startOrigin[1]];
35719       } else {
35720         offset = [0, 0];
35721       }
35722       d3_event.stopPropagation();
35723       function pointermove(d3_event2) {
35724         if (_pointerId !== (d3_event2.pointerId || "mouse"))
35725           return;
35726         var p2 = pointerLocGetter(d3_event2);
35727         if (!started) {
35728           var dist = geoVecLength(startOrigin, p2);
35729           var tolerance = d3_event2.pointerType === "pen" ? _penTolerancePx : _tolerancePx;
35730           if (dist < tolerance)
35731             return;
35732           started = true;
35733           dispatch14.call("start", this, d3_event2, _targetEntity);
35734         } else {
35735           startOrigin = p2;
35736           d3_event2.stopPropagation();
35737           d3_event2.preventDefault();
35738           var dx = p2[0] - startOrigin[0];
35739           var dy = p2[1] - startOrigin[1];
35740           dispatch14.call("move", this, d3_event2, _targetEntity, [p2[0] + offset[0], p2[1] + offset[1]], [dx, dy]);
35741         }
35742       }
35743       function pointerup(d3_event2) {
35744         if (_pointerId !== (d3_event2.pointerId || "mouse"))
35745           return;
35746         _pointerId = null;
35747         if (started) {
35748           dispatch14.call("end", this, d3_event2, _targetEntity);
35749           d3_event2.preventDefault();
35750         }
35751         select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
35752         selectEnable();
35753       }
35754     }
35755     function behavior(selection2) {
35756       var matchesSelector = utilPrefixDOMProperty("matchesSelector");
35757       var delegate = pointerdown;
35758       if (_selector) {
35759         delegate = function(d3_event) {
35760           var root3 = this;
35761           var target = d3_event.target;
35762           for (; target && target !== root3; target = target.parentNode) {
35763             var datum2 = target.__data__;
35764             _targetEntity = datum2 instanceof osmNote ? datum2 : datum2 && datum2.properties && datum2.properties.entity;
35765             if (_targetEntity && target[matchesSelector](_selector)) {
35766               return pointerdown.call(target, d3_event);
35767             }
35768           }
35769         };
35770       }
35771       selection2.on(_pointerPrefix + "down.drag" + _selector, delegate);
35772     }
35773     behavior.off = function(selection2) {
35774       selection2.on(_pointerPrefix + "down.drag" + _selector, null);
35775     };
35776     behavior.selector = function(_2) {
35777       if (!arguments.length)
35778         return _selector;
35779       _selector = _2;
35780       return behavior;
35781     };
35782     behavior.origin = function(_2) {
35783       if (!arguments.length)
35784         return _origin;
35785       _origin = _2;
35786       return behavior;
35787     };
35788     behavior.cancel = function() {
35789       select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
35790       return behavior;
35791     };
35792     behavior.targetNode = function(_2) {
35793       if (!arguments.length)
35794         return _targetNode;
35795       _targetNode = _2;
35796       return behavior;
35797     };
35798     behavior.targetEntity = function(_2) {
35799       if (!arguments.length)
35800         return _targetEntity;
35801       _targetEntity = _2;
35802       return behavior;
35803     };
35804     behavior.surface = function(_2) {
35805       if (!arguments.length)
35806         return _surface;
35807       _surface = _2;
35808       return behavior;
35809     };
35810     return utilRebind(behavior, dispatch14, "on");
35811   }
35812
35813   // modules/modes/drag_node.js
35814   function modeDragNode(context) {
35815     var mode = {
35816       id: "drag-node",
35817       button: "browse"
35818     };
35819     var hover = behaviorHover(context).altDisables(true).on("hover", context.ui().sidebar.hover);
35820     var edit2 = behaviorEdit(context);
35821     var _nudgeInterval;
35822     var _restoreSelectedIDs = [];
35823     var _wasMidpoint = false;
35824     var _isCancelled = false;
35825     var _activeEntity;
35826     var _startLoc;
35827     var _lastLoc;
35828     function startNudge(d3_event, entity, nudge) {
35829       if (_nudgeInterval)
35830         window.clearInterval(_nudgeInterval);
35831       _nudgeInterval = window.setInterval(function() {
35832         context.map().pan(nudge);
35833         doMove(d3_event, entity, nudge);
35834       }, 50);
35835     }
35836     function stopNudge() {
35837       if (_nudgeInterval) {
35838         window.clearInterval(_nudgeInterval);
35839         _nudgeInterval = null;
35840       }
35841     }
35842     function moveAnnotation(entity) {
35843       return _t("operations.move.annotation." + entity.geometry(context.graph()));
35844     }
35845     function connectAnnotation(nodeEntity, targetEntity) {
35846       var nodeGeometry = nodeEntity.geometry(context.graph());
35847       var targetGeometry = targetEntity.geometry(context.graph());
35848       if (nodeGeometry === "vertex" && targetGeometry === "vertex") {
35849         var nodeParentWayIDs = context.graph().parentWays(nodeEntity);
35850         var targetParentWayIDs = context.graph().parentWays(targetEntity);
35851         var sharedParentWays = utilArrayIntersection(nodeParentWayIDs, targetParentWayIDs);
35852         if (sharedParentWays.length !== 0) {
35853           if (sharedParentWays[0].areAdjacent(nodeEntity.id, targetEntity.id)) {
35854             return _t("operations.connect.annotation.from_vertex.to_adjacent_vertex");
35855           }
35856           return _t("operations.connect.annotation.from_vertex.to_sibling_vertex");
35857         }
35858       }
35859       return _t("operations.connect.annotation.from_" + nodeGeometry + ".to_" + targetGeometry);
35860     }
35861     function shouldSnapToNode(target) {
35862       if (!_activeEntity)
35863         return false;
35864       return _activeEntity.geometry(context.graph()) !== "vertex" || (target.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(target, context.graph()));
35865     }
35866     function origin(entity) {
35867       return context.projection(entity.loc);
35868     }
35869     function keydown(d3_event) {
35870       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
35871         if (context.surface().classed("nope")) {
35872           context.surface().classed("nope-suppressed", true);
35873         }
35874         context.surface().classed("nope", false).classed("nope-disabled", true);
35875       }
35876     }
35877     function keyup(d3_event) {
35878       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
35879         if (context.surface().classed("nope-suppressed")) {
35880           context.surface().classed("nope", true);
35881         }
35882         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
35883       }
35884     }
35885     function start2(d3_event, entity) {
35886       _wasMidpoint = entity.type === "midpoint";
35887       var hasHidden = context.features().hasHiddenConnections(entity, context.graph());
35888       _isCancelled = !context.editable() || d3_event.shiftKey || hasHidden;
35889       if (_isCancelled) {
35890         if (hasHidden) {
35891           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("modes.drag_node.connected_to_hidden"))();
35892         }
35893         return drag.cancel();
35894       }
35895       if (_wasMidpoint) {
35896         var midpoint = entity;
35897         entity = osmNode();
35898         context.perform(actionAddMidpoint(midpoint, entity));
35899         entity = context.entity(entity.id);
35900         var vertex = context.surface().selectAll("." + entity.id);
35901         drag.targetNode(vertex.node()).targetEntity(entity);
35902       } else {
35903         context.perform(actionNoop());
35904       }
35905       _activeEntity = entity;
35906       _startLoc = entity.loc;
35907       hover.ignoreVertex(entity.geometry(context.graph()) === "vertex");
35908       context.surface().selectAll("." + _activeEntity.id).classed("active", true);
35909       context.enter(mode);
35910     }
35911     function datum2(d3_event) {
35912       if (!d3_event || d3_event.altKey) {
35913         return {};
35914       } else {
35915         var d2 = d3_event.target.__data__;
35916         return d2 && d2.properties && d2.properties.target ? d2 : {};
35917       }
35918     }
35919     function doMove(d3_event, entity, nudge) {
35920       nudge = nudge || [0, 0];
35921       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
35922       var currMouse = geoVecSubtract(currPoint, nudge);
35923       var loc = context.projection.invert(currMouse);
35924       var target, edge;
35925       if (!_nudgeInterval) {
35926         var d2 = datum2(d3_event);
35927         target = d2 && d2.properties && d2.properties.entity;
35928         var targetLoc = target && target.loc;
35929         var targetNodes = d2 && d2.properties && d2.properties.nodes;
35930         if (targetLoc) {
35931           if (shouldSnapToNode(target)) {
35932             loc = targetLoc;
35933           }
35934         } else if (targetNodes) {
35935           edge = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, end.id);
35936           if (edge) {
35937             loc = edge.loc;
35938           }
35939         }
35940       }
35941       context.replace(
35942         actionMoveNode(entity.id, loc)
35943       );
35944       var isInvalid = false;
35945       if (target) {
35946         isInvalid = hasRelationConflict(entity, target, edge, context.graph());
35947       }
35948       if (!isInvalid) {
35949         isInvalid = hasInvalidGeometry(entity, context.graph());
35950       }
35951       var nope = context.surface().classed("nope");
35952       if (isInvalid === "relation" || isInvalid === "restriction") {
35953         if (!nope) {
35954           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(
35955             "operations.connect." + isInvalid,
35956             { relation: _mainPresetIndex.item("type/restriction").name() }
35957           ))();
35958         }
35959       } else if (isInvalid) {
35960         var errorID = isInvalid === "line" ? "lines" : "areas";
35961         context.ui().flash.duration(3e3).iconName("#iD-icon-no").label(_t.append("self_intersection.error." + errorID))();
35962       } else {
35963         if (nope) {
35964           context.ui().flash.duration(1).label("")();
35965         }
35966       }
35967       var nopeDisabled = context.surface().classed("nope-disabled");
35968       if (nopeDisabled) {
35969         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
35970       } else {
35971         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
35972       }
35973       _lastLoc = loc;
35974     }
35975     function hasRelationConflict(entity, target, edge, graph) {
35976       var testGraph = graph.update();
35977       if (edge) {
35978         var midpoint = osmNode();
35979         var action = actionAddMidpoint({
35980           loc: edge.loc,
35981           edge: [target.nodes[edge.index - 1], target.nodes[edge.index]]
35982         }, midpoint);
35983         testGraph = action(testGraph);
35984         target = midpoint;
35985       }
35986       var ids = [entity.id, target.id];
35987       return actionConnect(ids).disabled(testGraph);
35988     }
35989     function hasInvalidGeometry(entity, graph) {
35990       var parents = graph.parentWays(entity);
35991       var i3, j3, k2;
35992       for (i3 = 0; i3 < parents.length; i3++) {
35993         var parent = parents[i3];
35994         var nodes = [];
35995         var activeIndex = null;
35996         var relations = graph.parentRelations(parent);
35997         for (j3 = 0; j3 < relations.length; j3++) {
35998           if (!relations[j3].isMultipolygon())
35999             continue;
36000           var rings = osmJoinWays(relations[j3].members, graph);
36001           for (k2 = 0; k2 < rings.length; k2++) {
36002             nodes = rings[k2].nodes;
36003             if (nodes.find(function(n3) {
36004               return n3.id === entity.id;
36005             })) {
36006               activeIndex = k2;
36007               if (geoHasSelfIntersections(nodes, entity.id)) {
36008                 return "multipolygonMember";
36009               }
36010             }
36011             rings[k2].coords = nodes.map(function(n3) {
36012               return n3.loc;
36013             });
36014           }
36015           for (k2 = 0; k2 < rings.length; k2++) {
36016             if (k2 === activeIndex)
36017               continue;
36018             if (geoHasLineIntersections(rings[activeIndex].nodes, rings[k2].nodes, entity.id)) {
36019               return "multipolygonRing";
36020             }
36021           }
36022         }
36023         if (activeIndex === null) {
36024           nodes = parent.nodes.map(function(nodeID) {
36025             return graph.entity(nodeID);
36026           });
36027           if (nodes.length && geoHasSelfIntersections(nodes, entity.id)) {
36028             return parent.geometry(graph);
36029           }
36030         }
36031       }
36032       return false;
36033     }
36034     function move(d3_event, entity, point2) {
36035       if (_isCancelled)
36036         return;
36037       d3_event.stopPropagation();
36038       context.surface().classed("nope-disabled", d3_event.altKey);
36039       _lastLoc = context.projection.invert(point2);
36040       doMove(d3_event, entity);
36041       var nudge = geoViewportEdge(point2, context.map().dimensions());
36042       if (nudge) {
36043         startNudge(d3_event, entity, nudge);
36044       } else {
36045         stopNudge();
36046       }
36047     }
36048     function end(d3_event, entity) {
36049       if (_isCancelled)
36050         return;
36051       var wasPoint = entity.geometry(context.graph()) === "point";
36052       var d2 = datum2(d3_event);
36053       var nope = d2 && d2.properties && d2.properties.nope || context.surface().classed("nope");
36054       var target = d2 && d2.properties && d2.properties.entity;
36055       if (nope) {
36056         context.perform(
36057           _actionBounceBack(entity.id, _startLoc)
36058         );
36059       } else if (target && target.type === "way") {
36060         var choice = geoChooseEdge(context.graph().childNodes(target), context.map().mouse(), context.projection, entity.id);
36061         context.replace(
36062           actionAddMidpoint({
36063             loc: choice.loc,
36064             edge: [target.nodes[choice.index - 1], target.nodes[choice.index]]
36065           }, entity),
36066           connectAnnotation(entity, target)
36067         );
36068       } else if (target && target.type === "node" && shouldSnapToNode(target)) {
36069         context.replace(
36070           actionConnect([target.id, entity.id]),
36071           connectAnnotation(entity, target)
36072         );
36073       } else if (_wasMidpoint) {
36074         context.replace(
36075           actionNoop(),
36076           _t("operations.add.annotation.vertex")
36077         );
36078       } else {
36079         context.replace(
36080           actionNoop(),
36081           moveAnnotation(entity)
36082         );
36083       }
36084       if (wasPoint) {
36085         context.enter(modeSelect(context, [entity.id]));
36086       } else {
36087         var reselection = _restoreSelectedIDs.filter(function(id2) {
36088           return context.graph().hasEntity(id2);
36089         });
36090         if (reselection.length) {
36091           context.enter(modeSelect(context, reselection));
36092         } else {
36093           context.enter(modeBrowse(context));
36094         }
36095       }
36096     }
36097     function _actionBounceBack(nodeID, toLoc) {
36098       var moveNode = actionMoveNode(nodeID, toLoc);
36099       var action = function(graph, t2) {
36100         if (t2 === 1)
36101           context.pop();
36102         return moveNode(graph, t2);
36103       };
36104       action.transitionable = true;
36105       return action;
36106     }
36107     function cancel() {
36108       drag.cancel();
36109       context.enter(modeBrowse(context));
36110     }
36111     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);
36112     mode.enter = function() {
36113       context.install(hover);
36114       context.install(edit2);
36115       select_default2(window).on("keydown.dragNode", keydown).on("keyup.dragNode", keyup);
36116       context.history().on("undone.drag-node", cancel);
36117     };
36118     mode.exit = function() {
36119       context.ui().sidebar.hover.cancel();
36120       context.uninstall(hover);
36121       context.uninstall(edit2);
36122       select_default2(window).on("keydown.dragNode", null).on("keyup.dragNode", null);
36123       context.history().on("undone.drag-node", null);
36124       _activeEntity = null;
36125       context.surface().classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false).selectAll(".active").classed("active", false);
36126       stopNudge();
36127     };
36128     mode.selectedIDs = function() {
36129       if (!arguments.length)
36130         return _activeEntity ? [_activeEntity.id] : [];
36131       return mode;
36132     };
36133     mode.activeID = function() {
36134       if (!arguments.length)
36135         return _activeEntity && _activeEntity.id;
36136       return mode;
36137     };
36138     mode.restoreSelectedIDs = function(_2) {
36139       if (!arguments.length)
36140         return _restoreSelectedIDs;
36141       _restoreSelectedIDs = _2;
36142       return mode;
36143     };
36144     mode.behavior = drag;
36145     return mode;
36146   }
36147
36148   // modules/services/keepRight.js
36149   var import_rbush = __toESM(require_rbush_min());
36150
36151   // node_modules/d3-fetch/src/text.js
36152   function responseText(response) {
36153     if (!response.ok)
36154       throw new Error(response.status + " " + response.statusText);
36155     return response.text();
36156   }
36157   function text_default3(input, init2) {
36158     return fetch(input, init2).then(responseText);
36159   }
36160
36161   // node_modules/d3-fetch/src/json.js
36162   function responseJson(response) {
36163     if (!response.ok)
36164       throw new Error(response.status + " " + response.statusText);
36165     if (response.status === 204 || response.status === 205)
36166       return;
36167     return response.json();
36168   }
36169   function json_default(input, init2) {
36170     return fetch(input, init2).then(responseJson);
36171   }
36172
36173   // node_modules/d3-fetch/src/xml.js
36174   function parser(type2) {
36175     return (input, init2) => text_default3(input, init2).then((text2) => new DOMParser().parseFromString(text2, type2));
36176   }
36177   var xml_default = parser("application/xml");
36178   var html = parser("text/html");
36179   var svg = parser("image/svg+xml");
36180
36181   // modules/services/keepRight.js
36182   var tiler = utilTiler();
36183   var dispatch2 = dispatch_default("loaded");
36184   var _tileZoom = 14;
36185   var _krUrlRoot = "https://www.keepright.at";
36186   var _krData = { errorTypes: {}, localizeStrings: {} };
36187   var _cache;
36188   var _krRuleset = [
36189     // no 20 - multiple node on same spot - these are mostly boundaries overlapping roads
36190     30,
36191     40,
36192     50,
36193     60,
36194     70,
36195     90,
36196     100,
36197     110,
36198     120,
36199     130,
36200     150,
36201     160,
36202     170,
36203     180,
36204     190,
36205     191,
36206     192,
36207     193,
36208     194,
36209     195,
36210     196,
36211     197,
36212     198,
36213     200,
36214     201,
36215     202,
36216     203,
36217     204,
36218     205,
36219     206,
36220     207,
36221     208,
36222     210,
36223     220,
36224     230,
36225     231,
36226     232,
36227     270,
36228     280,
36229     281,
36230     282,
36231     283,
36232     284,
36233     285,
36234     290,
36235     291,
36236     292,
36237     293,
36238     294,
36239     295,
36240     296,
36241     297,
36242     298,
36243     300,
36244     310,
36245     311,
36246     312,
36247     313,
36248     320,
36249     350,
36250     360,
36251     370,
36252     380,
36253     390,
36254     400,
36255     401,
36256     402,
36257     410,
36258     411,
36259     412,
36260     413
36261   ];
36262   function abortRequest(controller) {
36263     if (controller) {
36264       controller.abort();
36265     }
36266   }
36267   function abortUnwantedRequests(cache, tiles) {
36268     Object.keys(cache.inflightTile).forEach((k2) => {
36269       const wanted = tiles.find((tile) => k2 === tile.id);
36270       if (!wanted) {
36271         abortRequest(cache.inflightTile[k2]);
36272         delete cache.inflightTile[k2];
36273       }
36274     });
36275   }
36276   function encodeIssueRtree(d2) {
36277     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
36278   }
36279   function updateRtree(item, replace) {
36280     _cache.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
36281     if (replace) {
36282       _cache.rtree.insert(item);
36283     }
36284   }
36285   function tokenReplacements(d2) {
36286     if (!(d2 instanceof QAItem))
36287       return;
36288     const replacements = {};
36289     const issueTemplate = _krData.errorTypes[d2.whichType];
36290     if (!issueTemplate) {
36291       console.log("No Template: ", d2.whichType);
36292       console.log("  ", d2.description);
36293       return;
36294     }
36295     if (!issueTemplate.regex)
36296       return;
36297     const errorRegex = new RegExp(issueTemplate.regex, "i");
36298     const errorMatch = errorRegex.exec(d2.description);
36299     if (!errorMatch) {
36300       console.log("Unmatched: ", d2.whichType);
36301       console.log("  ", d2.description);
36302       console.log("  ", errorRegex);
36303       return;
36304     }
36305     for (let i3 = 1; i3 < errorMatch.length; i3++) {
36306       let capture = errorMatch[i3];
36307       let idType;
36308       idType = "IDs" in issueTemplate ? issueTemplate.IDs[i3 - 1] : "";
36309       if (idType && capture) {
36310         capture = parseError(capture, idType);
36311       } else {
36312         const compare = capture.toLowerCase();
36313         if (_krData.localizeStrings[compare]) {
36314           capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare]);
36315         } else {
36316           capture = unescape_default(capture);
36317         }
36318       }
36319       replacements["var" + i3] = capture;
36320     }
36321     return replacements;
36322   }
36323   function parseError(capture, idType) {
36324     const compare = capture.toLowerCase();
36325     if (_krData.localizeStrings[compare]) {
36326       capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare]);
36327     }
36328     switch (idType) {
36329       case "this":
36330         capture = linkErrorObject2(capture);
36331         break;
36332       case "url":
36333         capture = linkURL(capture);
36334         break;
36335       case "n":
36336       case "w":
36337       case "r":
36338         capture = linkEntity2(idType + capture);
36339         break;
36340       case "20":
36341         capture = parse20(capture);
36342         break;
36343       case "211":
36344         capture = parse211(capture);
36345         break;
36346       case "231":
36347         capture = parse231(capture);
36348         break;
36349       case "294":
36350         capture = parse294(capture);
36351         break;
36352       case "370":
36353         capture = parse370(capture);
36354         break;
36355     }
36356     return capture;
36357     function linkErrorObject2(d2) {
36358       return { html: '<a class="error_object_link">'.concat(d2, "</a>") };
36359     }
36360     function linkEntity2(d2) {
36361       return { html: '<a class="error_entity_link">'.concat(d2, "</a>") };
36362     }
36363     function linkURL(d2) {
36364       return { html: '<a class="kr_external_link" target="_blank" href="'.concat(d2, '">').concat(d2, "</a>") };
36365     }
36366     function parse211(capture2) {
36367       let newList = [];
36368       const items = capture2.split(", ");
36369       items.forEach((item) => {
36370         let id2 = linkEntity2("n" + item.slice(1));
36371         newList.push(id2);
36372       });
36373       return newList.join(", ");
36374     }
36375     function parse231(capture2) {
36376       let newList = [];
36377       const items = capture2.split("),");
36378       items.forEach((item) => {
36379         const match = item.match(/\#(\d+)\((.+)\)?/);
36380         if (match !== null && match.length > 2) {
36381           newList.push(
36382             linkEntity2("w" + match[1]) + " " + _t("QA.keepRight.errorTypes.231.layer", { layer: match[2] })
36383           );
36384         }
36385       });
36386       return newList.join(", ");
36387     }
36388     function parse294(capture2) {
36389       let newList = [];
36390       const items = capture2.split(",");
36391       items.forEach((item) => {
36392         item = item.split(" ");
36393         const role = '"'.concat(item[0], '"');
36394         const idType2 = item[1].slice(0, 1);
36395         let id2 = item[2].slice(1);
36396         id2 = linkEntity2(idType2 + id2);
36397         newList.push("".concat(role, " ").concat(item[1], " ").concat(id2));
36398       });
36399       return newList.join(", ");
36400     }
36401     function parse370(capture2) {
36402       if (!capture2)
36403         return "";
36404       const match = capture2.match(/\(including the name (\'.+\')\)/);
36405       if (match && match.length) {
36406         return _t("QA.keepRight.errorTypes.370.including_the_name", { name: match[1] });
36407       }
36408       return "";
36409     }
36410     function parse20(capture2) {
36411       let newList = [];
36412       const items = capture2.split(",");
36413       items.forEach((item) => {
36414         const id2 = linkEntity2("n" + item.slice(1));
36415         newList.push(id2);
36416       });
36417       return newList.join(", ");
36418     }
36419   }
36420   var keepRight_default = {
36421     title: "keepRight",
36422     init() {
36423       _mainFileFetcher.get("keepRight").then((d2) => _krData = d2);
36424       if (!_cache) {
36425         this.reset();
36426       }
36427       this.event = utilRebind(this, dispatch2, "on");
36428     },
36429     reset() {
36430       if (_cache) {
36431         Object.values(_cache.inflightTile).forEach(abortRequest);
36432       }
36433       _cache = {
36434         data: {},
36435         loadedTile: {},
36436         inflightTile: {},
36437         inflightPost: {},
36438         closed: {},
36439         rtree: new import_rbush.default()
36440       };
36441     },
36442     // KeepRight API:  http://osm.mueschelsoft.de/keepright/interfacing.php
36443     loadIssues(projection2) {
36444       const options2 = {
36445         format: "geojson",
36446         ch: _krRuleset
36447       };
36448       const tiles = tiler.zoomExtent([_tileZoom, _tileZoom]).getTiles(projection2);
36449       abortUnwantedRequests(_cache, tiles);
36450       tiles.forEach((tile) => {
36451         if (_cache.loadedTile[tile.id] || _cache.inflightTile[tile.id])
36452           return;
36453         const [left, top, right, bottom] = tile.extent.rectangle();
36454         const params = Object.assign({}, options2, { left, bottom, right, top });
36455         const url = "".concat(_krUrlRoot, "/export.php?") + utilQsString(params);
36456         const controller = new AbortController();
36457         _cache.inflightTile[tile.id] = controller;
36458         json_default(url, { signal: controller.signal }).then((data) => {
36459           delete _cache.inflightTile[tile.id];
36460           _cache.loadedTile[tile.id] = true;
36461           if (!data || !data.features || !data.features.length) {
36462             throw new Error("No Data");
36463           }
36464           data.features.forEach((feature3) => {
36465             const {
36466               properties: {
36467                 error_type: itemType,
36468                 error_id: id2,
36469                 comment = null,
36470                 object_id: objectId,
36471                 object_type: objectType,
36472                 schema,
36473                 title
36474               }
36475             } = feature3;
36476             let {
36477               geometry: { coordinates: loc },
36478               properties: { description = "" }
36479             } = feature3;
36480             const issueTemplate = _krData.errorTypes[itemType];
36481             const parentIssueType = (Math.floor(itemType / 10) * 10).toString();
36482             const whichType = issueTemplate ? itemType : parentIssueType;
36483             const whichTemplate = _krData.errorTypes[whichType];
36484             switch (whichType) {
36485               case "170":
36486                 description = "This feature has a FIXME tag: ".concat(description);
36487                 break;
36488               case "292":
36489               case "293":
36490                 description = description.replace("A turn-", "This turn-");
36491                 break;
36492               case "294":
36493               case "295":
36494               case "296":
36495               case "297":
36496               case "298":
36497                 description = "This turn-restriction~".concat(description);
36498                 break;
36499               case "300":
36500                 description = "This highway is missing a maxspeed tag";
36501                 break;
36502               case "411":
36503               case "412":
36504               case "413":
36505                 description = "This feature~".concat(description);
36506                 break;
36507             }
36508             let coincident = false;
36509             do {
36510               let delta = coincident ? [1e-5, 0] : [0, 1e-5];
36511               loc = geoVecAdd(loc, delta);
36512               let bbox2 = geoExtent(loc).bbox();
36513               coincident = _cache.rtree.search(bbox2).length;
36514             } while (coincident);
36515             let d2 = new QAItem(loc, this, itemType, id2, {
36516               comment,
36517               description,
36518               whichType,
36519               parentIssueType,
36520               severity: whichTemplate.severity || "error",
36521               objectId,
36522               objectType,
36523               schema,
36524               title
36525             });
36526             d2.replacements = tokenReplacements(d2);
36527             _cache.data[id2] = d2;
36528             _cache.rtree.insert(encodeIssueRtree(d2));
36529           });
36530           dispatch2.call("loaded");
36531         }).catch(() => {
36532           delete _cache.inflightTile[tile.id];
36533           _cache.loadedTile[tile.id] = true;
36534         });
36535       });
36536     },
36537     postUpdate(d2, callback) {
36538       if (_cache.inflightPost[d2.id]) {
36539         return callback({ message: "Error update already inflight", status: -2 }, d2);
36540       }
36541       const params = { schema: d2.schema, id: d2.id };
36542       if (d2.newStatus) {
36543         params.st = d2.newStatus;
36544       }
36545       if (d2.newComment !== void 0) {
36546         params.co = d2.newComment;
36547       }
36548       const url = "".concat(_krUrlRoot, "/comment.php?") + utilQsString(params);
36549       const controller = new AbortController();
36550       _cache.inflightPost[d2.id] = controller;
36551       json_default(url, { signal: controller.signal }).finally(() => {
36552         delete _cache.inflightPost[d2.id];
36553         if (d2.newStatus === "ignore") {
36554           this.removeItem(d2);
36555         } else if (d2.newStatus === "ignore_t") {
36556           this.removeItem(d2);
36557           _cache.closed["".concat(d2.schema, ":").concat(d2.id)] = true;
36558         } else {
36559           d2 = this.replaceItem(d2.update({
36560             comment: d2.newComment,
36561             newComment: void 0,
36562             newState: void 0
36563           }));
36564         }
36565         if (callback)
36566           callback(null, d2);
36567       });
36568     },
36569     // Get all cached QAItems covering the viewport
36570     getItems(projection2) {
36571       const viewport = projection2.clipExtent();
36572       const min3 = [viewport[0][0], viewport[1][1]];
36573       const max3 = [viewport[1][0], viewport[0][1]];
36574       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
36575       return _cache.rtree.search(bbox2).map((d2) => d2.data);
36576     },
36577     // Get a QAItem from cache
36578     // NOTE: Don't change method name until UI v3 is merged
36579     getError(id2) {
36580       return _cache.data[id2];
36581     },
36582     // Replace a single QAItem in the cache
36583     replaceItem(item) {
36584       if (!(item instanceof QAItem) || !item.id)
36585         return;
36586       _cache.data[item.id] = item;
36587       updateRtree(encodeIssueRtree(item), true);
36588       return item;
36589     },
36590     // Remove a single QAItem from the cache
36591     removeItem(item) {
36592       if (!(item instanceof QAItem) || !item.id)
36593         return;
36594       delete _cache.data[item.id];
36595       updateRtree(encodeIssueRtree(item), false);
36596     },
36597     issueURL(item) {
36598       return "".concat(_krUrlRoot, "/report_map.php?schema=").concat(item.schema, "&error=").concat(item.id);
36599     },
36600     // Get an array of issues closed during this session.
36601     // Used to populate `closed:keepright` changeset tag
36602     getClosedIDs() {
36603       return Object.keys(_cache.closed).sort();
36604     }
36605   };
36606
36607   // modules/services/improveOSM.js
36608   var import_rbush2 = __toESM(require_rbush_min());
36609   var tiler2 = utilTiler();
36610   var dispatch3 = dispatch_default("loaded");
36611   var _tileZoom2 = 14;
36612   var _impOsmUrls = {
36613     ow: "https://grab.community.improve-osm.org/directionOfFlowService",
36614     mr: "https://grab.community.improve-osm.org/missingGeoService",
36615     tr: "https://grab.community.improve-osm.org/turnRestrictionService"
36616   };
36617   var _impOsmData = { icons: {} };
36618   var _cache2;
36619   function abortRequest2(i3) {
36620     Object.values(i3).forEach((controller) => {
36621       if (controller) {
36622         controller.abort();
36623       }
36624     });
36625   }
36626   function abortUnwantedRequests2(cache, tiles) {
36627     Object.keys(cache.inflightTile).forEach((k2) => {
36628       const wanted = tiles.find((tile) => k2 === tile.id);
36629       if (!wanted) {
36630         abortRequest2(cache.inflightTile[k2]);
36631         delete cache.inflightTile[k2];
36632       }
36633     });
36634   }
36635   function encodeIssueRtree2(d2) {
36636     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
36637   }
36638   function updateRtree2(item, replace) {
36639     _cache2.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
36640     if (replace) {
36641       _cache2.rtree.insert(item);
36642     }
36643   }
36644   function linkErrorObject(d2) {
36645     return { html: '<a class="error_object_link">'.concat(d2, "</a>") };
36646   }
36647   function linkEntity(d2) {
36648     return { html: '<a class="error_entity_link">'.concat(d2, "</a>") };
36649   }
36650   function pointAverage(points) {
36651     if (points.length) {
36652       const sum = points.reduce(
36653         (acc, point2) => geoVecAdd(acc, [point2.lon, point2.lat]),
36654         [0, 0]
36655       );
36656       return geoVecScale(sum, 1 / points.length);
36657     } else {
36658       return [0, 0];
36659     }
36660   }
36661   function relativeBearing(p1, p2) {
36662     let angle2 = Math.atan2(p2.lon - p1.lon, p2.lat - p1.lat);
36663     if (angle2 < 0) {
36664       angle2 += 2 * Math.PI;
36665     }
36666     return angle2 * 180 / Math.PI;
36667   }
36668   function cardinalDirection(bearing) {
36669     const dir = 45 * Math.round(bearing / 45);
36670     const compass = {
36671       0: "north",
36672       45: "northeast",
36673       90: "east",
36674       135: "southeast",
36675       180: "south",
36676       225: "southwest",
36677       270: "west",
36678       315: "northwest",
36679       360: "north"
36680     };
36681     return _t("QA.improveOSM.directions.".concat(compass[dir]));
36682   }
36683   function preventCoincident(loc, bumpUp) {
36684     let coincident = false;
36685     do {
36686       let delta = coincident ? [1e-5, 0] : bumpUp ? [0, 1e-5] : [0, 0];
36687       loc = geoVecAdd(loc, delta);
36688       let bbox2 = geoExtent(loc).bbox();
36689       coincident = _cache2.rtree.search(bbox2).length;
36690     } while (coincident);
36691     return loc;
36692   }
36693   var improveOSM_default = {
36694     title: "improveOSM",
36695     init() {
36696       _mainFileFetcher.get("qa_data").then((d2) => _impOsmData = d2.improveOSM);
36697       if (!_cache2) {
36698         this.reset();
36699       }
36700       this.event = utilRebind(this, dispatch3, "on");
36701     },
36702     reset() {
36703       if (_cache2) {
36704         Object.values(_cache2.inflightTile).forEach(abortRequest2);
36705       }
36706       _cache2 = {
36707         data: {},
36708         loadedTile: {},
36709         inflightTile: {},
36710         inflightPost: {},
36711         closed: {},
36712         rtree: new import_rbush2.default()
36713       };
36714     },
36715     loadIssues(projection2) {
36716       const options2 = {
36717         client: "iD",
36718         status: "OPEN",
36719         zoom: "19"
36720         // Use a high zoom so that clusters aren't returned
36721       };
36722       const tiles = tiler2.zoomExtent([_tileZoom2, _tileZoom2]).getTiles(projection2);
36723       abortUnwantedRequests2(_cache2, tiles);
36724       tiles.forEach((tile) => {
36725         if (_cache2.loadedTile[tile.id] || _cache2.inflightTile[tile.id])
36726           return;
36727         const [east, north, west, south] = tile.extent.rectangle();
36728         const params = Object.assign({}, options2, { east, south, west, north });
36729         const requests = {};
36730         Object.keys(_impOsmUrls).forEach((k2) => {
36731           const kParams = Object.assign(
36732             {},
36733             params,
36734             k2 === "mr" ? { type: "PARKING,ROAD,BOTH,PATH" } : { confidenceLevel: "C1" }
36735           );
36736           const url = "".concat(_impOsmUrls[k2], "/search?") + utilQsString(kParams);
36737           const controller = new AbortController();
36738           requests[k2] = controller;
36739           json_default(url, { signal: controller.signal }).then((data) => {
36740             delete _cache2.inflightTile[tile.id][k2];
36741             if (!Object.keys(_cache2.inflightTile[tile.id]).length) {
36742               delete _cache2.inflightTile[tile.id];
36743               _cache2.loadedTile[tile.id] = true;
36744             }
36745             if (data.roadSegments) {
36746               data.roadSegments.forEach((feature3) => {
36747                 const { points, wayId, fromNodeId, toNodeId } = feature3;
36748                 const itemId = "".concat(wayId).concat(fromNodeId).concat(toNodeId);
36749                 let mid = points.length / 2;
36750                 let loc;
36751                 if (mid % 1 === 0) {
36752                   loc = pointAverage([points[mid - 1], points[mid]]);
36753                 } else {
36754                   mid = points[Math.floor(mid)];
36755                   loc = [mid.lon, mid.lat];
36756                 }
36757                 loc = preventCoincident(loc, false);
36758                 let d2 = new QAItem(loc, this, k2, itemId, {
36759                   issueKey: k2,
36760                   // used as a category
36761                   identifier: {
36762                     // used to post changes
36763                     wayId,
36764                     fromNodeId,
36765                     toNodeId
36766                   },
36767                   objectId: wayId,
36768                   objectType: "way"
36769                 });
36770                 d2.replacements = {
36771                   percentage: feature3.percentOfTrips,
36772                   num_trips: feature3.numberOfTrips,
36773                   highway: linkErrorObject(_t("QA.keepRight.error_parts.highway")),
36774                   from_node: linkEntity("n" + feature3.fromNodeId),
36775                   to_node: linkEntity("n" + feature3.toNodeId)
36776                 };
36777                 _cache2.data[d2.id] = d2;
36778                 _cache2.rtree.insert(encodeIssueRtree2(d2));
36779               });
36780             }
36781             if (data.tiles) {
36782               data.tiles.forEach((feature3) => {
36783                 const { type: type2, x: x2, y: y2, numberOfTrips } = feature3;
36784                 const geoType = type2.toLowerCase();
36785                 const itemId = "".concat(geoType).concat(x2).concat(y2).concat(numberOfTrips);
36786                 let loc = pointAverage(feature3.points);
36787                 loc = preventCoincident(loc, false);
36788                 let d2 = new QAItem(loc, this, "".concat(k2, "-").concat(geoType), itemId, {
36789                   issueKey: k2,
36790                   identifier: { x: x2, y: y2 }
36791                 });
36792                 d2.replacements = {
36793                   num_trips: numberOfTrips,
36794                   geometry_type: _t("QA.improveOSM.geometry_types.".concat(geoType))
36795                 };
36796                 if (numberOfTrips === -1) {
36797                   d2.desc = _t("QA.improveOSM.error_types.mr.description_alt", d2.replacements);
36798                 }
36799                 _cache2.data[d2.id] = d2;
36800                 _cache2.rtree.insert(encodeIssueRtree2(d2));
36801               });
36802             }
36803             if (data.entities) {
36804               data.entities.forEach((feature3) => {
36805                 const { point: point2, id: id2, segments, numberOfPasses, turnType } = feature3;
36806                 const itemId = "".concat(id2.replace(/[,:+#]/g, "_"));
36807                 const loc = preventCoincident([point2.lon, point2.lat], true);
36808                 const ids = id2.split(",");
36809                 const from_way = ids[0];
36810                 const via_node = ids[3];
36811                 const to_way = ids[2].split(":")[1];
36812                 let d2 = new QAItem(loc, this, k2, itemId, {
36813                   issueKey: k2,
36814                   identifier: id2,
36815                   objectId: via_node,
36816                   objectType: "node"
36817                 });
36818                 const [p1, p2] = segments[0].points;
36819                 const dir_of_travel = cardinalDirection(relativeBearing(p1, p2));
36820                 d2.replacements = {
36821                   num_passed: numberOfPasses,
36822                   num_trips: segments[0].numberOfTrips,
36823                   turn_restriction: turnType.toLowerCase(),
36824                   from_way: linkEntity("w" + from_way),
36825                   to_way: linkEntity("w" + to_way),
36826                   travel_direction: dir_of_travel,
36827                   junction: linkErrorObject(_t("QA.keepRight.error_parts.this_node"))
36828                 };
36829                 _cache2.data[d2.id] = d2;
36830                 _cache2.rtree.insert(encodeIssueRtree2(d2));
36831                 dispatch3.call("loaded");
36832               });
36833             }
36834           }).catch(() => {
36835             delete _cache2.inflightTile[tile.id][k2];
36836             if (!Object.keys(_cache2.inflightTile[tile.id]).length) {
36837               delete _cache2.inflightTile[tile.id];
36838               _cache2.loadedTile[tile.id] = true;
36839             }
36840           });
36841         });
36842         _cache2.inflightTile[tile.id] = requests;
36843       });
36844     },
36845     getComments(item) {
36846       if (item.comments) {
36847         return Promise.resolve(item);
36848       }
36849       const key = item.issueKey;
36850       let qParams = {};
36851       if (key === "ow") {
36852         qParams = item.identifier;
36853       } else if (key === "mr") {
36854         qParams.tileX = item.identifier.x;
36855         qParams.tileY = item.identifier.y;
36856       } else if (key === "tr") {
36857         qParams.targetId = item.identifier;
36858       }
36859       const url = "".concat(_impOsmUrls[key], "/retrieveComments?") + utilQsString(qParams);
36860       const cacheComments = (data) => {
36861         item.comments = data.comments ? data.comments.reverse() : [];
36862         this.replaceItem(item);
36863       };
36864       return json_default(url).then(cacheComments).then(() => item);
36865     },
36866     postUpdate(d2, callback) {
36867       if (!osm_default.authenticated()) {
36868         return callback({ message: "Not Authenticated", status: -3 }, d2);
36869       }
36870       if (_cache2.inflightPost[d2.id]) {
36871         return callback({ message: "Error update already inflight", status: -2 }, d2);
36872       }
36873       osm_default.userDetails(sendPayload.bind(this));
36874       function sendPayload(err, user) {
36875         if (err) {
36876           return callback(err, d2);
36877         }
36878         const key = d2.issueKey;
36879         const url = "".concat(_impOsmUrls[key], "/comment");
36880         const payload = {
36881           username: user.display_name,
36882           targetIds: [d2.identifier]
36883         };
36884         if (d2.newStatus) {
36885           payload.status = d2.newStatus;
36886           payload.text = "status changed";
36887         }
36888         if (d2.newComment) {
36889           payload.text = d2.newComment;
36890         }
36891         const controller = new AbortController();
36892         _cache2.inflightPost[d2.id] = controller;
36893         const options2 = {
36894           method: "POST",
36895           signal: controller.signal,
36896           body: JSON.stringify(payload)
36897         };
36898         json_default(url, options2).then(() => {
36899           delete _cache2.inflightPost[d2.id];
36900           if (!d2.newStatus) {
36901             const now3 = /* @__PURE__ */ new Date();
36902             let comments = d2.comments ? d2.comments : [];
36903             comments.push({
36904               username: payload.username,
36905               text: payload.text,
36906               timestamp: now3.getTime() / 1e3
36907             });
36908             this.replaceItem(d2.update({
36909               comments,
36910               newComment: void 0
36911             }));
36912           } else {
36913             this.removeItem(d2);
36914             if (d2.newStatus === "SOLVED") {
36915               if (!(d2.issueKey in _cache2.closed)) {
36916                 _cache2.closed[d2.issueKey] = 0;
36917               }
36918               _cache2.closed[d2.issueKey] += 1;
36919             }
36920           }
36921           if (callback)
36922             callback(null, d2);
36923         }).catch((err2) => {
36924           delete _cache2.inflightPost[d2.id];
36925           if (callback)
36926             callback(err2.message);
36927         });
36928       }
36929     },
36930     // Get all cached QAItems covering the viewport
36931     getItems(projection2) {
36932       const viewport = projection2.clipExtent();
36933       const min3 = [viewport[0][0], viewport[1][1]];
36934       const max3 = [viewport[1][0], viewport[0][1]];
36935       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
36936       return _cache2.rtree.search(bbox2).map((d2) => d2.data);
36937     },
36938     // Get a QAItem from cache
36939     // NOTE: Don't change method name until UI v3 is merged
36940     getError(id2) {
36941       return _cache2.data[id2];
36942     },
36943     // get the name of the icon to display for this item
36944     getIcon(itemType) {
36945       return _impOsmData.icons[itemType];
36946     },
36947     // Replace a single QAItem in the cache
36948     replaceItem(issue) {
36949       if (!(issue instanceof QAItem) || !issue.id)
36950         return;
36951       _cache2.data[issue.id] = issue;
36952       updateRtree2(encodeIssueRtree2(issue), true);
36953       return issue;
36954     },
36955     // Remove a single QAItem from the cache
36956     removeItem(issue) {
36957       if (!(issue instanceof QAItem) || !issue.id)
36958         return;
36959       delete _cache2.data[issue.id];
36960       updateRtree2(encodeIssueRtree2(issue), false);
36961     },
36962     // Used to populate `closed:improveosm:*` changeset tags
36963     getClosedCounts() {
36964       return _cache2.closed;
36965     }
36966   };
36967
36968   // modules/services/osmose.js
36969   var import_rbush3 = __toESM(require_rbush_min());
36970
36971   // node_modules/marked/lib/marked.esm.js
36972   function _getDefaults() {
36973     return {
36974       async: false,
36975       baseUrl: null,
36976       breaks: false,
36977       extensions: null,
36978       gfm: true,
36979       headerIds: false,
36980       headerPrefix: "",
36981       highlight: null,
36982       hooks: null,
36983       langPrefix: "language-",
36984       mangle: false,
36985       pedantic: false,
36986       renderer: null,
36987       sanitize: false,
36988       sanitizer: null,
36989       silent: false,
36990       smartypants: false,
36991       tokenizer: null,
36992       walkTokens: null,
36993       xhtml: false
36994     };
36995   }
36996   var _defaults = _getDefaults();
36997   function changeDefaults(newDefaults) {
36998     _defaults = newDefaults;
36999   }
37000   var escapeTest = /[&<>"']/;
37001   var escapeReplace = new RegExp(escapeTest.source, "g");
37002   var escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
37003   var escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, "g");
37004   var escapeReplacements = {
37005     "&": "&amp;",
37006     "<": "&lt;",
37007     ">": "&gt;",
37008     '"': "&quot;",
37009     "'": "&#39;"
37010   };
37011   var getEscapeReplacement = (ch) => escapeReplacements[ch];
37012   function escape4(html2, encode) {
37013     if (encode) {
37014       if (escapeTest.test(html2)) {
37015         return html2.replace(escapeReplace, getEscapeReplacement);
37016       }
37017     } else {
37018       if (escapeTestNoEncode.test(html2)) {
37019         return html2.replace(escapeReplaceNoEncode, getEscapeReplacement);
37020       }
37021     }
37022     return html2;
37023   }
37024   var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
37025   function unescape3(html2) {
37026     return html2.replace(unescapeTest, (_2, n3) => {
37027       n3 = n3.toLowerCase();
37028       if (n3 === "colon")
37029         return ":";
37030       if (n3.charAt(0) === "#") {
37031         return n3.charAt(1) === "x" ? String.fromCharCode(parseInt(n3.substring(2), 16)) : String.fromCharCode(+n3.substring(1));
37032       }
37033       return "";
37034     });
37035   }
37036   var caret = /(^|[^\[])\^/g;
37037   function edit(regex, opt) {
37038     regex = typeof regex === "string" ? regex : regex.source;
37039     opt = opt || "";
37040     const obj = {
37041       replace: (name, val) => {
37042         val = typeof val === "object" && "source" in val ? val.source : val;
37043         val = val.replace(caret, "$1");
37044         regex = regex.replace(name, val);
37045         return obj;
37046       },
37047       getRegex: () => {
37048         return new RegExp(regex, opt);
37049       }
37050     };
37051     return obj;
37052   }
37053   var nonWordAndColonTest = /[^\w:]/g;
37054   var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
37055   function cleanUrl(sanitize, base, href) {
37056     if (sanitize) {
37057       let prot;
37058       try {
37059         prot = decodeURIComponent(unescape3(href)).replace(nonWordAndColonTest, "").toLowerCase();
37060       } catch (e3) {
37061         return null;
37062       }
37063       if (prot.indexOf("javascript:") === 0 || prot.indexOf("vbscript:") === 0 || prot.indexOf("data:") === 0) {
37064         return null;
37065       }
37066     }
37067     if (base && !originIndependentUrl.test(href)) {
37068       href = resolveUrl(base, href);
37069     }
37070     try {
37071       href = encodeURI(href).replace(/%25/g, "%");
37072     } catch (e3) {
37073       return null;
37074     }
37075     return href;
37076   }
37077   var baseUrls = {};
37078   var justDomain = /^[^:]+:\/*[^/]*$/;
37079   var protocol = /^([^:]+:)[\s\S]*$/;
37080   var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
37081   function resolveUrl(base, href) {
37082     if (!baseUrls[" " + base]) {
37083       if (justDomain.test(base)) {
37084         baseUrls[" " + base] = base + "/";
37085       } else {
37086         baseUrls[" " + base] = rtrim(base, "/", true);
37087       }
37088     }
37089     base = baseUrls[" " + base];
37090     const relativeBase = base.indexOf(":") === -1;
37091     if (href.substring(0, 2) === "//") {
37092       if (relativeBase) {
37093         return href;
37094       }
37095       return base.replace(protocol, "$1") + href;
37096     } else if (href.charAt(0) === "/") {
37097       if (relativeBase) {
37098         return href;
37099       }
37100       return base.replace(domain, "$1") + href;
37101     } else {
37102       return base + href;
37103     }
37104   }
37105   var noopTest = { exec: () => null };
37106   function splitCells(tableRow, count) {
37107     const row = tableRow.replace(/\|/g, (match, offset, str2) => {
37108       let escaped = false, curr = offset;
37109       while (--curr >= 0 && str2[curr] === "\\")
37110         escaped = !escaped;
37111       if (escaped) {
37112         return "|";
37113       } else {
37114         return " |";
37115       }
37116     }), cells = row.split(/ \|/);
37117     let i3 = 0;
37118     if (!cells[0].trim()) {
37119       cells.shift();
37120     }
37121     if (cells.length > 0 && !cells[cells.length - 1].trim()) {
37122       cells.pop();
37123     }
37124     if (count) {
37125       if (cells.length > count) {
37126         cells.splice(count);
37127       } else {
37128         while (cells.length < count)
37129           cells.push("");
37130       }
37131     }
37132     for (; i3 < cells.length; i3++) {
37133       cells[i3] = cells[i3].trim().replace(/\\\|/g, "|");
37134     }
37135     return cells;
37136   }
37137   function rtrim(str2, c2, invert) {
37138     const l2 = str2.length;
37139     if (l2 === 0) {
37140       return "";
37141     }
37142     let suffLen = 0;
37143     while (suffLen < l2) {
37144       const currChar = str2.charAt(l2 - suffLen - 1);
37145       if (currChar === c2 && !invert) {
37146         suffLen++;
37147       } else if (currChar !== c2 && invert) {
37148         suffLen++;
37149       } else {
37150         break;
37151       }
37152     }
37153     return str2.slice(0, l2 - suffLen);
37154   }
37155   function findClosingBracket(str2, b2) {
37156     if (str2.indexOf(b2[1]) === -1) {
37157       return -1;
37158     }
37159     const l2 = str2.length;
37160     let level = 0, i3 = 0;
37161     for (; i3 < l2; i3++) {
37162       if (str2[i3] === "\\") {
37163         i3++;
37164       } else if (str2[i3] === b2[0]) {
37165         level++;
37166       } else if (str2[i3] === b2[1]) {
37167         level--;
37168         if (level < 0) {
37169           return i3;
37170         }
37171       }
37172     }
37173     return -1;
37174   }
37175   function checkDeprecations(opt, callback) {
37176     if (!opt || opt.silent) {
37177       return;
37178     }
37179     if (callback) {
37180       console.warn("marked(): callback is deprecated since version 5.0.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/using_pro#async");
37181     }
37182     if (opt.sanitize || opt.sanitizer) {
37183       console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options");
37184     }
37185     if (opt.highlight || opt.langPrefix !== "language-") {
37186       console.warn("marked(): highlight and langPrefix parameters are deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-highlight.");
37187     }
37188     if (opt.mangle) {
37189       console.warn("marked(): mangle parameter is enabled by default, but is deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install https://www.npmjs.com/package/marked-mangle, or disable by setting `{mangle: false}`.");
37190     }
37191     if (opt.baseUrl) {
37192       console.warn("marked(): baseUrl parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-base-url.");
37193     }
37194     if (opt.smartypants) {
37195       console.warn("marked(): smartypants parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-smartypants.");
37196     }
37197     if (opt.xhtml) {
37198       console.warn("marked(): xhtml parameter is deprecated since version 5.0.0, should not be used and will be removed in the future. Instead use https://www.npmjs.com/package/marked-xhtml.");
37199     }
37200     if (opt.headerIds || opt.headerPrefix) {
37201       console.warn("marked(): headerIds and headerPrefix parameters enabled by default, but are deprecated since version 5.0.0, and will be removed in the future. To clear this warning, install  https://www.npmjs.com/package/marked-gfm-heading-id, or disable by setting `{headerIds: false}`.");
37202     }
37203   }
37204   function outputLink(cap, link2, raw, lexer2) {
37205     const href = link2.href;
37206     const title = link2.title ? escape4(link2.title) : null;
37207     const text2 = cap[1].replace(/\\([\[\]])/g, "$1");
37208     if (cap[0].charAt(0) !== "!") {
37209       lexer2.state.inLink = true;
37210       const token = {
37211         type: "link",
37212         raw,
37213         href,
37214         title,
37215         text: text2,
37216         tokens: lexer2.inlineTokens(text2)
37217       };
37218       lexer2.state.inLink = false;
37219       return token;
37220     }
37221     return {
37222       type: "image",
37223       raw,
37224       href,
37225       title,
37226       text: escape4(text2)
37227     };
37228   }
37229   function indentCodeCompensation(raw, text2) {
37230     const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
37231     if (matchIndentToCode === null) {
37232       return text2;
37233     }
37234     const indentToCode = matchIndentToCode[1];
37235     return text2.split("\n").map((node) => {
37236       const matchIndentInNode = node.match(/^\s+/);
37237       if (matchIndentInNode === null) {
37238         return node;
37239       }
37240       const [indentInNode] = matchIndentInNode;
37241       if (indentInNode.length >= indentToCode.length) {
37242         return node.slice(indentToCode.length);
37243       }
37244       return node;
37245     }).join("\n");
37246   }
37247   var _Tokenizer = class {
37248     constructor(options2) {
37249       __publicField(this, "options");
37250       __publicField(this, "rules");
37251       __publicField(this, "lexer");
37252       this.options = options2 || _defaults;
37253     }
37254     space(src) {
37255       const cap = this.rules.block.newline.exec(src);
37256       if (cap && cap[0].length > 0) {
37257         return {
37258           type: "space",
37259           raw: cap[0]
37260         };
37261       }
37262     }
37263     code(src) {
37264       const cap = this.rules.block.code.exec(src);
37265       if (cap) {
37266         const text2 = cap[0].replace(/^ {1,4}/gm, "");
37267         return {
37268           type: "code",
37269           raw: cap[0],
37270           codeBlockStyle: "indented",
37271           text: !this.options.pedantic ? rtrim(text2, "\n") : text2
37272         };
37273       }
37274     }
37275     fences(src) {
37276       const cap = this.rules.block.fences.exec(src);
37277       if (cap) {
37278         const raw = cap[0];
37279         const text2 = indentCodeCompensation(raw, cap[3] || "");
37280         return {
37281           type: "code",
37282           raw,
37283           lang: cap[2] ? cap[2].trim().replace(this.rules.inline._escapes, "$1") : cap[2],
37284           text: text2
37285         };
37286       }
37287     }
37288     heading(src) {
37289       const cap = this.rules.block.heading.exec(src);
37290       if (cap) {
37291         let text2 = cap[2].trim();
37292         if (/#$/.test(text2)) {
37293           const trimmed = rtrim(text2, "#");
37294           if (this.options.pedantic) {
37295             text2 = trimmed.trim();
37296           } else if (!trimmed || / $/.test(trimmed)) {
37297             text2 = trimmed.trim();
37298           }
37299         }
37300         return {
37301           type: "heading",
37302           raw: cap[0],
37303           depth: cap[1].length,
37304           text: text2,
37305           tokens: this.lexer.inline(text2)
37306         };
37307       }
37308     }
37309     hr(src) {
37310       const cap = this.rules.block.hr.exec(src);
37311       if (cap) {
37312         return {
37313           type: "hr",
37314           raw: cap[0]
37315         };
37316       }
37317     }
37318     blockquote(src) {
37319       const cap = this.rules.block.blockquote.exec(src);
37320       if (cap) {
37321         const text2 = cap[0].replace(/^ *>[ \t]?/gm, "");
37322         const top = this.lexer.state.top;
37323         this.lexer.state.top = true;
37324         const tokens = this.lexer.blockTokens(text2);
37325         this.lexer.state.top = top;
37326         return {
37327           type: "blockquote",
37328           raw: cap[0],
37329           tokens,
37330           text: text2
37331         };
37332       }
37333     }
37334     list(src) {
37335       let cap = this.rules.block.list.exec(src);
37336       if (cap) {
37337         let raw, istask, ischecked, indent2, i3, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly;
37338         let bull = cap[1].trim();
37339         const isordered = bull.length > 1;
37340         const list = {
37341           type: "list",
37342           raw: "",
37343           ordered: isordered,
37344           start: isordered ? +bull.slice(0, -1) : "",
37345           loose: false,
37346           items: []
37347         };
37348         bull = isordered ? "\\d{1,9}\\".concat(bull.slice(-1)) : "\\".concat(bull);
37349         if (this.options.pedantic) {
37350           bull = isordered ? bull : "[*+-]";
37351         }
37352         const itemRegex = new RegExp("^( {0,3}".concat(bull, ")((?:[     ][^\\n]*)?(?:\\n|$))"));
37353         while (src) {
37354           endEarly = false;
37355           if (!(cap = itemRegex.exec(src))) {
37356             break;
37357           }
37358           if (this.rules.block.hr.test(src)) {
37359             break;
37360           }
37361           raw = cap[0];
37362           src = src.substring(raw.length);
37363           line = cap[2].split("\n", 1)[0].replace(/^\t+/, (t2) => " ".repeat(3 * t2.length));
37364           nextLine = src.split("\n", 1)[0];
37365           if (this.options.pedantic) {
37366             indent2 = 2;
37367             itemContents = line.trimLeft();
37368           } else {
37369             indent2 = cap[2].search(/[^ ]/);
37370             indent2 = indent2 > 4 ? 1 : indent2;
37371             itemContents = line.slice(indent2);
37372             indent2 += cap[1].length;
37373           }
37374           blankLine = false;
37375           if (!line && /^ *$/.test(nextLine)) {
37376             raw += nextLine + "\n";
37377             src = src.substring(nextLine.length + 1);
37378             endEarly = true;
37379           }
37380           if (!endEarly) {
37381             const nextBulletRegex = new RegExp("^ {0,".concat(Math.min(3, indent2 - 1), "}(?:[*+-]|\\d{1,9}[.)])((?:[   ][^\\n]*)?(?:\\n|$))"));
37382             const hrRegex = new RegExp("^ {0,".concat(Math.min(3, indent2 - 1), "}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)"));
37383             const fencesBeginRegex = new RegExp("^ {0,".concat(Math.min(3, indent2 - 1), "}(?:```|~~~)"));
37384             const headingBeginRegex = new RegExp("^ {0,".concat(Math.min(3, indent2 - 1), "}#"));
37385             while (src) {
37386               rawLine = src.split("\n", 1)[0];
37387               nextLine = rawLine;
37388               if (this.options.pedantic) {
37389                 nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, "  ");
37390               }
37391               if (fencesBeginRegex.test(nextLine)) {
37392                 break;
37393               }
37394               if (headingBeginRegex.test(nextLine)) {
37395                 break;
37396               }
37397               if (nextBulletRegex.test(nextLine)) {
37398                 break;
37399               }
37400               if (hrRegex.test(src)) {
37401                 break;
37402               }
37403               if (nextLine.search(/[^ ]/) >= indent2 || !nextLine.trim()) {
37404                 itemContents += "\n" + nextLine.slice(indent2);
37405               } else {
37406                 if (blankLine) {
37407                   break;
37408                 }
37409                 if (line.search(/[^ ]/) >= 4) {
37410                   break;
37411                 }
37412                 if (fencesBeginRegex.test(line)) {
37413                   break;
37414                 }
37415                 if (headingBeginRegex.test(line)) {
37416                   break;
37417                 }
37418                 if (hrRegex.test(line)) {
37419                   break;
37420                 }
37421                 itemContents += "\n" + nextLine;
37422               }
37423               if (!blankLine && !nextLine.trim()) {
37424                 blankLine = true;
37425               }
37426               raw += rawLine + "\n";
37427               src = src.substring(rawLine.length + 1);
37428               line = nextLine.slice(indent2);
37429             }
37430           }
37431           if (!list.loose) {
37432             if (endsWithBlankLine) {
37433               list.loose = true;
37434             } else if (/\n *\n *$/.test(raw)) {
37435               endsWithBlankLine = true;
37436             }
37437           }
37438           if (this.options.gfm) {
37439             istask = /^\[[ xX]\] /.exec(itemContents);
37440             if (istask) {
37441               ischecked = istask[0] !== "[ ] ";
37442               itemContents = itemContents.replace(/^\[[ xX]\] +/, "");
37443             }
37444           }
37445           list.items.push({
37446             type: "list_item",
37447             raw,
37448             task: !!istask,
37449             checked: ischecked,
37450             loose: false,
37451             text: itemContents
37452           });
37453           list.raw += raw;
37454         }
37455         list.items[list.items.length - 1].raw = raw.trimRight();
37456         list.items[list.items.length - 1].text = itemContents.trimRight();
37457         list.raw = list.raw.trimRight();
37458         const l2 = list.items.length;
37459         for (i3 = 0; i3 < l2; i3++) {
37460           this.lexer.state.top = false;
37461           list.items[i3].tokens = this.lexer.blockTokens(list.items[i3].text, []);
37462           if (!list.loose) {
37463             const spacers = list.items[i3].tokens.filter((t2) => t2.type === "space");
37464             const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t2) => /\n.*\n/.test(t2.raw));
37465             list.loose = hasMultipleLineBreaks;
37466           }
37467         }
37468         if (list.loose) {
37469           for (i3 = 0; i3 < l2; i3++) {
37470             list.items[i3].loose = true;
37471           }
37472         }
37473         return list;
37474       }
37475     }
37476     html(src) {
37477       const cap = this.rules.block.html.exec(src);
37478       if (cap) {
37479         const token = {
37480           type: "html",
37481           block: true,
37482           raw: cap[0],
37483           pre: !this.options.sanitizer && (cap[1] === "pre" || cap[1] === "script" || cap[1] === "style"),
37484           text: cap[0]
37485         };
37486         if (this.options.sanitize) {
37487           const text2 = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]);
37488           const paragraph = token;
37489           paragraph.type = "paragraph";
37490           paragraph.text = text2;
37491           paragraph.tokens = this.lexer.inline(text2);
37492         }
37493         return token;
37494       }
37495     }
37496     def(src) {
37497       const cap = this.rules.block.def.exec(src);
37498       if (cap) {
37499         const tag = cap[1].toLowerCase().replace(/\s+/g, " ");
37500         const href = cap[2] ? cap[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline._escapes, "$1") : "";
37501         const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline._escapes, "$1") : cap[3];
37502         return {
37503           type: "def",
37504           tag,
37505           raw: cap[0],
37506           href,
37507           title
37508         };
37509       }
37510     }
37511     table(src) {
37512       const cap = this.rules.block.table.exec(src);
37513       if (cap) {
37514         const item = {
37515           type: "table",
37516           raw: cap[0],
37517           header: splitCells(cap[1]).map((c2) => {
37518             return { text: c2 };
37519           }),
37520           align: cap[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
37521           rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : []
37522         };
37523         if (item.header.length === item.align.length) {
37524           let l2 = item.align.length;
37525           let i3, j3, k2, row;
37526           for (i3 = 0; i3 < l2; i3++) {
37527             if (/^ *-+: *$/.test(item.align[i3])) {
37528               item.align[i3] = "right";
37529             } else if (/^ *:-+: *$/.test(item.align[i3])) {
37530               item.align[i3] = "center";
37531             } else if (/^ *:-+ *$/.test(item.align[i3])) {
37532               item.align[i3] = "left";
37533             } else {
37534               item.align[i3] = null;
37535             }
37536           }
37537           l2 = item.rows.length;
37538           for (i3 = 0; i3 < l2; i3++) {
37539             item.rows[i3] = splitCells(item.rows[i3], item.header.length).map((c2) => {
37540               return { text: c2 };
37541             });
37542           }
37543           l2 = item.header.length;
37544           for (j3 = 0; j3 < l2; j3++) {
37545             item.header[j3].tokens = this.lexer.inline(item.header[j3].text);
37546           }
37547           l2 = item.rows.length;
37548           for (j3 = 0; j3 < l2; j3++) {
37549             row = item.rows[j3];
37550             for (k2 = 0; k2 < row.length; k2++) {
37551               row[k2].tokens = this.lexer.inline(row[k2].text);
37552             }
37553           }
37554           return item;
37555         }
37556       }
37557     }
37558     lheading(src) {
37559       const cap = this.rules.block.lheading.exec(src);
37560       if (cap) {
37561         return {
37562           type: "heading",
37563           raw: cap[0],
37564           depth: cap[2].charAt(0) === "=" ? 1 : 2,
37565           text: cap[1],
37566           tokens: this.lexer.inline(cap[1])
37567         };
37568       }
37569     }
37570     paragraph(src) {
37571       const cap = this.rules.block.paragraph.exec(src);
37572       if (cap) {
37573         const text2 = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
37574         return {
37575           type: "paragraph",
37576           raw: cap[0],
37577           text: text2,
37578           tokens: this.lexer.inline(text2)
37579         };
37580       }
37581     }
37582     text(src) {
37583       const cap = this.rules.block.text.exec(src);
37584       if (cap) {
37585         return {
37586           type: "text",
37587           raw: cap[0],
37588           text: cap[0],
37589           tokens: this.lexer.inline(cap[0])
37590         };
37591       }
37592     }
37593     escape(src) {
37594       const cap = this.rules.inline.escape.exec(src);
37595       if (cap) {
37596         return {
37597           type: "escape",
37598           raw: cap[0],
37599           text: escape4(cap[1])
37600         };
37601       }
37602     }
37603     tag(src) {
37604       const cap = this.rules.inline.tag.exec(src);
37605       if (cap) {
37606         if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
37607           this.lexer.state.inLink = true;
37608         } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
37609           this.lexer.state.inLink = false;
37610         }
37611         if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
37612           this.lexer.state.inRawBlock = true;
37613         } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
37614           this.lexer.state.inRawBlock = false;
37615         }
37616         return {
37617           type: this.options.sanitize ? "text" : "html",
37618           raw: cap[0],
37619           inLink: this.lexer.state.inLink,
37620           inRawBlock: this.lexer.state.inRawBlock,
37621           block: false,
37622           text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0]
37623         };
37624       }
37625     }
37626     link(src) {
37627       const cap = this.rules.inline.link.exec(src);
37628       if (cap) {
37629         const trimmedUrl = cap[2].trim();
37630         if (!this.options.pedantic && /^</.test(trimmedUrl)) {
37631           if (!/>$/.test(trimmedUrl)) {
37632             return;
37633           }
37634           const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
37635           if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
37636             return;
37637           }
37638         } else {
37639           const lastParenIndex = findClosingBracket(cap[2], "()");
37640           if (lastParenIndex > -1) {
37641             const start2 = cap[0].indexOf("!") === 0 ? 5 : 4;
37642             const linkLen = start2 + cap[1].length + lastParenIndex;
37643             cap[2] = cap[2].substring(0, lastParenIndex);
37644             cap[0] = cap[0].substring(0, linkLen).trim();
37645             cap[3] = "";
37646           }
37647         }
37648         let href = cap[2];
37649         let title = "";
37650         if (this.options.pedantic) {
37651           const link2 = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
37652           if (link2) {
37653             href = link2[1];
37654             title = link2[3];
37655           }
37656         } else {
37657           title = cap[3] ? cap[3].slice(1, -1) : "";
37658         }
37659         href = href.trim();
37660         if (/^</.test(href)) {
37661           if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
37662             href = href.slice(1);
37663           } else {
37664             href = href.slice(1, -1);
37665           }
37666         }
37667         return outputLink(cap, {
37668           href: href ? href.replace(this.rules.inline._escapes, "$1") : href,
37669           title: title ? title.replace(this.rules.inline._escapes, "$1") : title
37670         }, cap[0], this.lexer);
37671       }
37672     }
37673     reflink(src, links) {
37674       let cap;
37675       if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
37676         let link2 = (cap[2] || cap[1]).replace(/\s+/g, " ");
37677         link2 = links[link2.toLowerCase()];
37678         if (!link2) {
37679           const text2 = cap[0].charAt(0);
37680           return {
37681             type: "text",
37682             raw: text2,
37683             text: text2
37684           };
37685         }
37686         return outputLink(cap, link2, cap[0], this.lexer);
37687       }
37688     }
37689     emStrong(src, maskedSrc, prevChar = "") {
37690       let match = this.rules.inline.emStrong.lDelim.exec(src);
37691       if (!match)
37692         return;
37693       if (match[3] && prevChar.match(new RegExp("[\\p{L}\\p{N}]", "u")))
37694         return;
37695       const nextChar = match[1] || match[2] || "";
37696       if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
37697         const lLength = [...match[0]].length - 1;
37698         let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
37699         const endReg = match[0][0] === "*" ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
37700         endReg.lastIndex = 0;
37701         maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
37702         while ((match = endReg.exec(maskedSrc)) != null) {
37703           rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
37704           if (!rDelim)
37705             continue;
37706           rLength = [...rDelim].length;
37707           if (match[3] || match[4]) {
37708             delimTotal += rLength;
37709             continue;
37710           } else if (match[5] || match[6]) {
37711             if (lLength % 3 && !((lLength + rLength) % 3)) {
37712               midDelimTotal += rLength;
37713               continue;
37714             }
37715           }
37716           delimTotal -= rLength;
37717           if (delimTotal > 0)
37718             continue;
37719           rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
37720           const raw = [...src].slice(0, lLength + match.index + rLength + 1).join("");
37721           if (Math.min(lLength, rLength) % 2) {
37722             const text3 = raw.slice(1, -1);
37723             return {
37724               type: "em",
37725               raw,
37726               text: text3,
37727               tokens: this.lexer.inlineTokens(text3)
37728             };
37729           }
37730           const text2 = raw.slice(2, -2);
37731           return {
37732             type: "strong",
37733             raw,
37734             text: text2,
37735             tokens: this.lexer.inlineTokens(text2)
37736           };
37737         }
37738       }
37739     }
37740     codespan(src) {
37741       const cap = this.rules.inline.code.exec(src);
37742       if (cap) {
37743         let text2 = cap[2].replace(/\n/g, " ");
37744         const hasNonSpaceChars = /[^ ]/.test(text2);
37745         const hasSpaceCharsOnBothEnds = /^ /.test(text2) && / $/.test(text2);
37746         if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
37747           text2 = text2.substring(1, text2.length - 1);
37748         }
37749         text2 = escape4(text2, true);
37750         return {
37751           type: "codespan",
37752           raw: cap[0],
37753           text: text2
37754         };
37755       }
37756     }
37757     br(src) {
37758       const cap = this.rules.inline.br.exec(src);
37759       if (cap) {
37760         return {
37761           type: "br",
37762           raw: cap[0]
37763         };
37764       }
37765     }
37766     del(src) {
37767       const cap = this.rules.inline.del.exec(src);
37768       if (cap) {
37769         return {
37770           type: "del",
37771           raw: cap[0],
37772           text: cap[2],
37773           tokens: this.lexer.inlineTokens(cap[2])
37774         };
37775       }
37776     }
37777     autolink(src, mangle2) {
37778       const cap = this.rules.inline.autolink.exec(src);
37779       if (cap) {
37780         let text2, href;
37781         if (cap[2] === "@") {
37782           text2 = escape4(this.options.mangle ? mangle2(cap[1]) : cap[1]);
37783           href = "mailto:" + text2;
37784         } else {
37785           text2 = escape4(cap[1]);
37786           href = text2;
37787         }
37788         return {
37789           type: "link",
37790           raw: cap[0],
37791           text: text2,
37792           href,
37793           tokens: [
37794             {
37795               type: "text",
37796               raw: text2,
37797               text: text2
37798             }
37799           ]
37800         };
37801       }
37802     }
37803     url(src, mangle2) {
37804       let cap;
37805       if (cap = this.rules.inline.url.exec(src)) {
37806         let text2, href;
37807         if (cap[2] === "@") {
37808           text2 = escape4(this.options.mangle ? mangle2(cap[0]) : cap[0]);
37809           href = "mailto:" + text2;
37810         } else {
37811           let prevCapZero;
37812           do {
37813             prevCapZero = cap[0];
37814             cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
37815           } while (prevCapZero !== cap[0]);
37816           text2 = escape4(cap[0]);
37817           if (cap[1] === "www.") {
37818             href = "http://" + cap[0];
37819           } else {
37820             href = cap[0];
37821           }
37822         }
37823         return {
37824           type: "link",
37825           raw: cap[0],
37826           text: text2,
37827           href,
37828           tokens: [
37829             {
37830               type: "text",
37831               raw: text2,
37832               text: text2
37833             }
37834           ]
37835         };
37836       }
37837     }
37838     inlineText(src, smartypants2) {
37839       const cap = this.rules.inline.text.exec(src);
37840       if (cap) {
37841         let text2;
37842         if (this.lexer.state.inRawBlock) {
37843           text2 = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape4(cap[0]) : cap[0];
37844         } else {
37845           text2 = escape4(this.options.smartypants ? smartypants2(cap[0]) : cap[0]);
37846         }
37847         return {
37848           type: "text",
37849           raw: cap[0],
37850           text: text2
37851         };
37852       }
37853     }
37854   };
37855   var block = {
37856     newline: /^(?: *(?:\n|$))+/,
37857     code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
37858     fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
37859     hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
37860     heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
37861     blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
37862     list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
37863     html: "^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",
37864     def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
37865     table: noopTest,
37866     lheading: /^((?:(?!^bull ).|\n(?!\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
37867     // regex template, placeholders will be replaced according to different paragraph
37868     // interruption rules of commonmark and the original markdown spec:
37869     _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
37870     text: /^[^\n]+/
37871   };
37872   block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
37873   block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
37874   block.def = edit(block.def).replace("label", block._label).replace("title", block._title).getRegex();
37875   block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
37876   block.listItemStart = edit(/^( *)(bull) */).replace("bull", block.bullet).getRegex();
37877   block.list = edit(block.list).replace(/bull/g, block.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + block.def.source + ")").getRegex();
37878   block._tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
37879   block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
37880   block.html = edit(block.html, "i").replace("comment", block._comment).replace("tag", block._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
37881   block.lheading = edit(block.lheading).replace(/bull/g, block.bullet).getRegex();
37882   block.paragraph = edit(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
37883   block.blockquote = edit(block.blockquote).replace("paragraph", block.paragraph).getRegex();
37884   block.normal = __spreadValues({}, block);
37885   block.gfm = __spreadProps(__spreadValues({}, block.normal), {
37886     table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
37887     // Cells
37888   });
37889   block.gfm.table = edit(block.gfm.table).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
37890   block.gfm.paragraph = edit(block._paragraph).replace("hr", block.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", block.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", block._tag).getRegex();
37891   block.pedantic = __spreadProps(__spreadValues({}, block.normal), {
37892     html: edit("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", block._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
37893     def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
37894     heading: /^(#{1,6})(.*)(?:\n+|$)/,
37895     fences: noopTest,
37896     lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
37897     paragraph: edit(block.normal._paragraph).replace("hr", block.hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", block.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
37898   });
37899   var inline = {
37900     escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
37901     autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
37902     url: noopTest,
37903     tag: "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",
37904     link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
37905     reflink: /^!?\[(label)\]\[(ref)\]/,
37906     nolink: /^!?\[(ref)\](?:\[\])?/,
37907     reflinkSearch: "reflink|nolink(?!\\()",
37908     emStrong: {
37909       lDelim: /^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,
37910       //         (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left.  (5) and (6) can be either Left or Right.
37911       //         | Skip orphan inside strong      | Consume to delim | (1) #***              | (2) a***#, a***                    | (3) #***a, ***a                  | (4) ***#                 | (5) #***#                         | (6) a***a
37912       rDelimAst: /^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,
37913       rDelimUnd: /^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/
37914       // ^- Not allowed for _
37915     },
37916     code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
37917     br: /^( {2,}|\\)\n(?!\s*$)/,
37918     del: noopTest,
37919     text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
37920     punctuation: /^((?![*_])[\spunctuation])/
37921   };
37922   inline._punctuation = "\\p{P}$+<=>`^|~";
37923   inline.punctuation = edit(inline.punctuation, "u").replace(/punctuation/g, inline._punctuation).getRegex();
37924   inline.blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
37925   inline.anyPunctuation = /\\[punct]/g;
37926   inline._escapes = /\\([punct])/g;
37927   inline._comment = edit(block._comment).replace("(?:-->|$)", "-->").getRegex();
37928   inline.emStrong.lDelim = edit(inline.emStrong.lDelim, "u").replace(/punct/g, inline._punctuation).getRegex();
37929   inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, "gu").replace(/punct/g, inline._punctuation).getRegex();
37930   inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, "gu").replace(/punct/g, inline._punctuation).getRegex();
37931   inline.anyPunctuation = edit(inline.anyPunctuation, "gu").replace(/punct/g, inline._punctuation).getRegex();
37932   inline._escapes = edit(inline._escapes, "gu").replace(/punct/g, inline._punctuation).getRegex();
37933   inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
37934   inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
37935   inline.autolink = edit(inline.autolink).replace("scheme", inline._scheme).replace("email", inline._email).getRegex();
37936   inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
37937   inline.tag = edit(inline.tag).replace("comment", inline._comment).replace("attribute", inline._attribute).getRegex();
37938   inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
37939   inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
37940   inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
37941   inline.link = edit(inline.link).replace("label", inline._label).replace("href", inline._href).replace("title", inline._title).getRegex();
37942   inline.reflink = edit(inline.reflink).replace("label", inline._label).replace("ref", block._label).getRegex();
37943   inline.nolink = edit(inline.nolink).replace("ref", block._label).getRegex();
37944   inline.reflinkSearch = edit(inline.reflinkSearch, "g").replace("reflink", inline.reflink).replace("nolink", inline.nolink).getRegex();
37945   inline.normal = __spreadValues({}, inline);
37946   inline.pedantic = __spreadProps(__spreadValues({}, inline.normal), {
37947     strong: {
37948       start: /^__|\*\*/,
37949       middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
37950       endAst: /\*\*(?!\*)/g,
37951       endUnd: /__(?!_)/g
37952     },
37953     em: {
37954       start: /^_|\*/,
37955       middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
37956       endAst: /\*(?!\*)/g,
37957       endUnd: /_(?!_)/g
37958     },
37959     link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", inline._label).getRegex(),
37960     reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", inline._label).getRegex()
37961   });
37962   inline.gfm = __spreadProps(__spreadValues({}, inline.normal), {
37963     escape: edit(inline.escape).replace("])", "~|])").getRegex(),
37964     _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
37965     url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
37966     _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
37967     del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
37968     text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
37969   });
37970   inline.gfm.url = edit(inline.gfm.url, "i").replace("email", inline.gfm._extended_email).getRegex();
37971   inline.breaks = __spreadProps(__spreadValues({}, inline.gfm), {
37972     br: edit(inline.br).replace("{2,}", "*").getRegex(),
37973     text: edit(inline.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
37974   });
37975   function smartypants(text2) {
37976     return text2.replace(/---/g, "\u2014").replace(/--/g, "\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018").replace(/'/g, "\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C").replace(/"/g, "\u201D").replace(/\.{3}/g, "\u2026");
37977   }
37978   function mangle(text2) {
37979     let out = "", i3, ch;
37980     const l2 = text2.length;
37981     for (i3 = 0; i3 < l2; i3++) {
37982       ch = text2.charCodeAt(i3);
37983       if (Math.random() > 0.5) {
37984         ch = "x" + ch.toString(16);
37985       }
37986       out += "&#" + ch + ";";
37987     }
37988     return out;
37989   }
37990   var _Lexer = class __Lexer {
37991     constructor(options2) {
37992       __publicField(this, "tokens");
37993       __publicField(this, "options");
37994       __publicField(this, "state");
37995       __publicField(this, "tokenizer");
37996       __publicField(this, "inlineQueue");
37997       this.tokens = [];
37998       this.tokens.links = /* @__PURE__ */ Object.create(null);
37999       this.options = options2 || _defaults;
38000       this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
38001       this.tokenizer = this.options.tokenizer;
38002       this.tokenizer.options = this.options;
38003       this.tokenizer.lexer = this;
38004       this.inlineQueue = [];
38005       this.state = {
38006         inLink: false,
38007         inRawBlock: false,
38008         top: true
38009       };
38010       const rules = {
38011         block: block.normal,
38012         inline: inline.normal
38013       };
38014       if (this.options.pedantic) {
38015         rules.block = block.pedantic;
38016         rules.inline = inline.pedantic;
38017       } else if (this.options.gfm) {
38018         rules.block = block.gfm;
38019         if (this.options.breaks) {
38020           rules.inline = inline.breaks;
38021         } else {
38022           rules.inline = inline.gfm;
38023         }
38024       }
38025       this.tokenizer.rules = rules;
38026     }
38027     /**
38028      * Expose Rules
38029      */
38030     static get rules() {
38031       return {
38032         block,
38033         inline
38034       };
38035     }
38036     /**
38037      * Static Lex Method
38038      */
38039     static lex(src, options2) {
38040       const lexer2 = new __Lexer(options2);
38041       return lexer2.lex(src);
38042     }
38043     /**
38044      * Static Lex Inline Method
38045      */
38046     static lexInline(src, options2) {
38047       const lexer2 = new __Lexer(options2);
38048       return lexer2.inlineTokens(src);
38049     }
38050     /**
38051      * Preprocessing
38052      */
38053     lex(src) {
38054       src = src.replace(/\r\n|\r/g, "\n");
38055       this.blockTokens(src, this.tokens);
38056       let next;
38057       while (next = this.inlineQueue.shift()) {
38058         this.inlineTokens(next.src, next.tokens);
38059       }
38060       return this.tokens;
38061     }
38062     blockTokens(src, tokens = []) {
38063       if (this.options.pedantic) {
38064         src = src.replace(/\t/g, "    ").replace(/^ +$/gm, "");
38065       } else {
38066         src = src.replace(/^( *)(\t+)/gm, (_2, leading, tabs) => {
38067           return leading + "    ".repeat(tabs.length);
38068         });
38069       }
38070       let token;
38071       let lastToken;
38072       let cutSrc;
38073       let lastParagraphClipped;
38074       while (src) {
38075         if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((extTokenizer) => {
38076           if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
38077             src = src.substring(token.raw.length);
38078             tokens.push(token);
38079             return true;
38080           }
38081           return false;
38082         })) {
38083           continue;
38084         }
38085         if (token = this.tokenizer.space(src)) {
38086           src = src.substring(token.raw.length);
38087           if (token.raw.length === 1 && tokens.length > 0) {
38088             tokens[tokens.length - 1].raw += "\n";
38089           } else {
38090             tokens.push(token);
38091           }
38092           continue;
38093         }
38094         if (token = this.tokenizer.code(src)) {
38095           src = src.substring(token.raw.length);
38096           lastToken = tokens[tokens.length - 1];
38097           if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
38098             lastToken.raw += "\n" + token.raw;
38099             lastToken.text += "\n" + token.text;
38100             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38101           } else {
38102             tokens.push(token);
38103           }
38104           continue;
38105         }
38106         if (token = this.tokenizer.fences(src)) {
38107           src = src.substring(token.raw.length);
38108           tokens.push(token);
38109           continue;
38110         }
38111         if (token = this.tokenizer.heading(src)) {
38112           src = src.substring(token.raw.length);
38113           tokens.push(token);
38114           continue;
38115         }
38116         if (token = this.tokenizer.hr(src)) {
38117           src = src.substring(token.raw.length);
38118           tokens.push(token);
38119           continue;
38120         }
38121         if (token = this.tokenizer.blockquote(src)) {
38122           src = src.substring(token.raw.length);
38123           tokens.push(token);
38124           continue;
38125         }
38126         if (token = this.tokenizer.list(src)) {
38127           src = src.substring(token.raw.length);
38128           tokens.push(token);
38129           continue;
38130         }
38131         if (token = this.tokenizer.html(src)) {
38132           src = src.substring(token.raw.length);
38133           tokens.push(token);
38134           continue;
38135         }
38136         if (token = this.tokenizer.def(src)) {
38137           src = src.substring(token.raw.length);
38138           lastToken = tokens[tokens.length - 1];
38139           if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
38140             lastToken.raw += "\n" + token.raw;
38141             lastToken.text += "\n" + token.raw;
38142             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38143           } else if (!this.tokens.links[token.tag]) {
38144             this.tokens.links[token.tag] = {
38145               href: token.href,
38146               title: token.title
38147             };
38148           }
38149           continue;
38150         }
38151         if (token = this.tokenizer.table(src)) {
38152           src = src.substring(token.raw.length);
38153           tokens.push(token);
38154           continue;
38155         }
38156         if (token = this.tokenizer.lheading(src)) {
38157           src = src.substring(token.raw.length);
38158           tokens.push(token);
38159           continue;
38160         }
38161         cutSrc = src;
38162         if (this.options.extensions && this.options.extensions.startBlock) {
38163           let startIndex = Infinity;
38164           const tempSrc = src.slice(1);
38165           let tempStart;
38166           this.options.extensions.startBlock.forEach((getStartIndex) => {
38167             tempStart = getStartIndex.call({ lexer: this }, tempSrc);
38168             if (typeof tempStart === "number" && tempStart >= 0) {
38169               startIndex = Math.min(startIndex, tempStart);
38170             }
38171           });
38172           if (startIndex < Infinity && startIndex >= 0) {
38173             cutSrc = src.substring(0, startIndex + 1);
38174           }
38175         }
38176         if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
38177           lastToken = tokens[tokens.length - 1];
38178           if (lastParagraphClipped && lastToken.type === "paragraph") {
38179             lastToken.raw += "\n" + token.raw;
38180             lastToken.text += "\n" + token.text;
38181             this.inlineQueue.pop();
38182             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38183           } else {
38184             tokens.push(token);
38185           }
38186           lastParagraphClipped = cutSrc.length !== src.length;
38187           src = src.substring(token.raw.length);
38188           continue;
38189         }
38190         if (token = this.tokenizer.text(src)) {
38191           src = src.substring(token.raw.length);
38192           lastToken = tokens[tokens.length - 1];
38193           if (lastToken && lastToken.type === "text") {
38194             lastToken.raw += "\n" + token.raw;
38195             lastToken.text += "\n" + token.text;
38196             this.inlineQueue.pop();
38197             this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38198           } else {
38199             tokens.push(token);
38200           }
38201           continue;
38202         }
38203         if (src) {
38204           const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
38205           if (this.options.silent) {
38206             console.error(errMsg);
38207             break;
38208           } else {
38209             throw new Error(errMsg);
38210           }
38211         }
38212       }
38213       this.state.top = true;
38214       return tokens;
38215     }
38216     inline(src, tokens = []) {
38217       this.inlineQueue.push({ src, tokens });
38218       return tokens;
38219     }
38220     /**
38221      * Lexing/Compiling
38222      */
38223     inlineTokens(src, tokens = []) {
38224       let token, lastToken, cutSrc;
38225       let maskedSrc = src;
38226       let match;
38227       let keepPrevChar, prevChar;
38228       if (this.tokens.links) {
38229         const links = Object.keys(this.tokens.links);
38230         if (links.length > 0) {
38231           while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
38232             if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
38233               maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
38234             }
38235           }
38236         }
38237       }
38238       while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
38239         maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
38240       }
38241       while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
38242         maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
38243       }
38244       while (src) {
38245         if (!keepPrevChar) {
38246           prevChar = "";
38247         }
38248         keepPrevChar = false;
38249         if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((extTokenizer) => {
38250           if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
38251             src = src.substring(token.raw.length);
38252             tokens.push(token);
38253             return true;
38254           }
38255           return false;
38256         })) {
38257           continue;
38258         }
38259         if (token = this.tokenizer.escape(src)) {
38260           src = src.substring(token.raw.length);
38261           tokens.push(token);
38262           continue;
38263         }
38264         if (token = this.tokenizer.tag(src)) {
38265           src = src.substring(token.raw.length);
38266           lastToken = tokens[tokens.length - 1];
38267           if (lastToken && token.type === "text" && lastToken.type === "text") {
38268             lastToken.raw += token.raw;
38269             lastToken.text += token.text;
38270           } else {
38271             tokens.push(token);
38272           }
38273           continue;
38274         }
38275         if (token = this.tokenizer.link(src)) {
38276           src = src.substring(token.raw.length);
38277           tokens.push(token);
38278           continue;
38279         }
38280         if (token = this.tokenizer.reflink(src, this.tokens.links)) {
38281           src = src.substring(token.raw.length);
38282           lastToken = tokens[tokens.length - 1];
38283           if (lastToken && token.type === "text" && lastToken.type === "text") {
38284             lastToken.raw += token.raw;
38285             lastToken.text += token.text;
38286           } else {
38287             tokens.push(token);
38288           }
38289           continue;
38290         }
38291         if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
38292           src = src.substring(token.raw.length);
38293           tokens.push(token);
38294           continue;
38295         }
38296         if (token = this.tokenizer.codespan(src)) {
38297           src = src.substring(token.raw.length);
38298           tokens.push(token);
38299           continue;
38300         }
38301         if (token = this.tokenizer.br(src)) {
38302           src = src.substring(token.raw.length);
38303           tokens.push(token);
38304           continue;
38305         }
38306         if (token = this.tokenizer.del(src)) {
38307           src = src.substring(token.raw.length);
38308           tokens.push(token);
38309           continue;
38310         }
38311         if (token = this.tokenizer.autolink(src, mangle)) {
38312           src = src.substring(token.raw.length);
38313           tokens.push(token);
38314           continue;
38315         }
38316         if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
38317           src = src.substring(token.raw.length);
38318           tokens.push(token);
38319           continue;
38320         }
38321         cutSrc = src;
38322         if (this.options.extensions && this.options.extensions.startInline) {
38323           let startIndex = Infinity;
38324           const tempSrc = src.slice(1);
38325           let tempStart;
38326           this.options.extensions.startInline.forEach((getStartIndex) => {
38327             tempStart = getStartIndex.call({ lexer: this }, tempSrc);
38328             if (typeof tempStart === "number" && tempStart >= 0) {
38329               startIndex = Math.min(startIndex, tempStart);
38330             }
38331           });
38332           if (startIndex < Infinity && startIndex >= 0) {
38333             cutSrc = src.substring(0, startIndex + 1);
38334           }
38335         }
38336         if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
38337           src = src.substring(token.raw.length);
38338           if (token.raw.slice(-1) !== "_") {
38339             prevChar = token.raw.slice(-1);
38340           }
38341           keepPrevChar = true;
38342           lastToken = tokens[tokens.length - 1];
38343           if (lastToken && lastToken.type === "text") {
38344             lastToken.raw += token.raw;
38345             lastToken.text += token.text;
38346           } else {
38347             tokens.push(token);
38348           }
38349           continue;
38350         }
38351         if (src) {
38352           const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
38353           if (this.options.silent) {
38354             console.error(errMsg);
38355             break;
38356           } else {
38357             throw new Error(errMsg);
38358           }
38359         }
38360       }
38361       return tokens;
38362     }
38363   };
38364   var _Renderer = class {
38365     constructor(options2) {
38366       __publicField(this, "options");
38367       this.options = options2 || _defaults;
38368     }
38369     code(code, infostring, escaped) {
38370       const lang = (infostring || "").match(/\S*/)[0];
38371       if (this.options.highlight) {
38372         const out = this.options.highlight(code, lang);
38373         if (out != null && out !== code) {
38374           escaped = true;
38375           code = out;
38376         }
38377       }
38378       code = code.replace(/\n$/, "") + "\n";
38379       if (!lang) {
38380         return "<pre><code>" + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
38381       }
38382       return '<pre><code class="' + this.options.langPrefix + escape4(lang) + '">' + (escaped ? code : escape4(code, true)) + "</code></pre>\n";
38383     }
38384     blockquote(quote2) {
38385       return "<blockquote>\n".concat(quote2, "</blockquote>\n");
38386     }
38387     html(html2, block2) {
38388       return html2;
38389     }
38390     heading(text2, level, raw, slugger) {
38391       if (this.options.headerIds) {
38392         const id2 = this.options.headerPrefix + slugger.slug(raw);
38393         return "<h".concat(level, ' id="').concat(id2, '">').concat(text2, "</h").concat(level, ">\n");
38394       }
38395       return "<h".concat(level, ">").concat(text2, "</h").concat(level, ">\n");
38396     }
38397     hr() {
38398       return this.options.xhtml ? "<hr/>\n" : "<hr>\n";
38399     }
38400     list(body, ordered, start2) {
38401       const type2 = ordered ? "ol" : "ul", startatt = ordered && start2 !== 1 ? ' start="' + start2 + '"' : "";
38402       return "<" + type2 + startatt + ">\n" + body + "</" + type2 + ">\n";
38403     }
38404     listitem(text2, task, checked) {
38405       return "<li>".concat(text2, "</li>\n");
38406     }
38407     checkbox(checked) {
38408       return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox"' + (this.options.xhtml ? " /" : "") + "> ";
38409     }
38410     paragraph(text2) {
38411       return "<p>".concat(text2, "</p>\n");
38412     }
38413     table(header, body) {
38414       if (body)
38415         body = "<tbody>".concat(body, "</tbody>");
38416       return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
38417     }
38418     tablerow(content) {
38419       return "<tr>\n".concat(content, "</tr>\n");
38420     }
38421     tablecell(content, flags) {
38422       const type2 = flags.header ? "th" : "td";
38423       const tag = flags.align ? "<".concat(type2, ' align="').concat(flags.align, '">') : "<".concat(type2, ">");
38424       return tag + content + "</".concat(type2, ">\n");
38425     }
38426     /**
38427      * span level renderer
38428      */
38429     strong(text2) {
38430       return "<strong>".concat(text2, "</strong>");
38431     }
38432     em(text2) {
38433       return "<em>".concat(text2, "</em>");
38434     }
38435     codespan(text2) {
38436       return "<code>".concat(text2, "</code>");
38437     }
38438     br() {
38439       return this.options.xhtml ? "<br/>" : "<br>";
38440     }
38441     del(text2) {
38442       return "<del>".concat(text2, "</del>");
38443     }
38444     link(href, title, text2) {
38445       href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
38446       if (href === null) {
38447         return text2;
38448       }
38449       let out = '<a href="' + href + '"';
38450       if (title) {
38451         out += ' title="' + title + '"';
38452       }
38453       out += ">" + text2 + "</a>";
38454       return out;
38455     }
38456     image(href, title, text2) {
38457       href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
38458       if (href === null) {
38459         return text2;
38460       }
38461       let out = '<img src="'.concat(href, '" alt="').concat(text2, '"');
38462       if (title) {
38463         out += ' title="'.concat(title, '"');
38464       }
38465       out += this.options.xhtml ? "/>" : ">";
38466       return out;
38467     }
38468     text(text2) {
38469       return text2;
38470     }
38471   };
38472   var _TextRenderer = class {
38473     // no need for block level renderers
38474     strong(text2) {
38475       return text2;
38476     }
38477     em(text2) {
38478       return text2;
38479     }
38480     codespan(text2) {
38481       return text2;
38482     }
38483     del(text2) {
38484       return text2;
38485     }
38486     html(text2) {
38487       return text2;
38488     }
38489     text(text2) {
38490       return text2;
38491     }
38492     link(href, title, text2) {
38493       return "" + text2;
38494     }
38495     image(href, title, text2) {
38496       return "" + text2;
38497     }
38498     br() {
38499       return "";
38500     }
38501   };
38502   var _Slugger = class {
38503     constructor() {
38504       __publicField(this, "seen");
38505       this.seen = {};
38506     }
38507     serialize(value) {
38508       return value.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig, "").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "").replace(/\s/g, "-");
38509     }
38510     /**
38511      * Finds the next safe (unique) slug to use
38512      */
38513     getNextSafeSlug(originalSlug, isDryRun) {
38514       let slug = originalSlug;
38515       let occurenceAccumulator = 0;
38516       if (this.seen.hasOwnProperty(slug)) {
38517         occurenceAccumulator = this.seen[originalSlug];
38518         do {
38519           occurenceAccumulator++;
38520           slug = originalSlug + "-" + occurenceAccumulator;
38521         } while (this.seen.hasOwnProperty(slug));
38522       }
38523       if (!isDryRun) {
38524         this.seen[originalSlug] = occurenceAccumulator;
38525         this.seen[slug] = 0;
38526       }
38527       return slug;
38528     }
38529     /**
38530      * Convert string to unique id
38531      */
38532     slug(value, options2 = {}) {
38533       const slug = this.serialize(value);
38534       return this.getNextSafeSlug(slug, options2.dryrun);
38535     }
38536   };
38537   var _Parser = class __Parser {
38538     constructor(options2) {
38539       __publicField(this, "options");
38540       __publicField(this, "renderer");
38541       __publicField(this, "textRenderer");
38542       __publicField(this, "slugger");
38543       this.options = options2 || _defaults;
38544       this.options.renderer = this.options.renderer || new _Renderer();
38545       this.renderer = this.options.renderer;
38546       this.renderer.options = this.options;
38547       this.textRenderer = new _TextRenderer();
38548       this.slugger = new _Slugger();
38549     }
38550     /**
38551      * Static Parse Method
38552      */
38553     static parse(tokens, options2) {
38554       const parser3 = new __Parser(options2);
38555       return parser3.parse(tokens);
38556     }
38557     /**
38558      * Static Parse Inline Method
38559      */
38560     static parseInline(tokens, options2) {
38561       const parser3 = new __Parser(options2);
38562       return parser3.parseInline(tokens);
38563     }
38564     /**
38565      * Parse Loop
38566      */
38567     parse(tokens, top = true) {
38568       let out = "", i3, j3, k2, l2, l3, row, cell, header, body, token, ordered, start2, loose, itemBody, item, checked, task, checkbox, ret;
38569       const l4 = tokens.length;
38570       for (i3 = 0; i3 < l4; i3++) {
38571         token = tokens[i3];
38572         if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
38573           ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
38574           if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(token.type)) {
38575             out += ret || "";
38576             continue;
38577           }
38578         }
38579         switch (token.type) {
38580           case "space": {
38581             continue;
38582           }
38583           case "hr": {
38584             out += this.renderer.hr();
38585             continue;
38586           }
38587           case "heading": {
38588             out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape3(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
38589             continue;
38590           }
38591           case "code": {
38592             out += this.renderer.code(token.text, token.lang, !!token.escaped);
38593             continue;
38594           }
38595           case "table": {
38596             header = "";
38597             cell = "";
38598             l2 = token.header.length;
38599             for (j3 = 0; j3 < l2; j3++) {
38600               cell += this.renderer.tablecell(this.parseInline(token.header[j3].tokens), { header: true, align: token.align[j3] });
38601             }
38602             header += this.renderer.tablerow(cell);
38603             body = "";
38604             l2 = token.rows.length;
38605             for (j3 = 0; j3 < l2; j3++) {
38606               row = token.rows[j3];
38607               cell = "";
38608               l3 = row.length;
38609               for (k2 = 0; k2 < l3; k2++) {
38610                 cell += this.renderer.tablecell(this.parseInline(row[k2].tokens), { header: false, align: token.align[k2] });
38611               }
38612               body += this.renderer.tablerow(cell);
38613             }
38614             out += this.renderer.table(header, body);
38615             continue;
38616           }
38617           case "blockquote": {
38618             body = this.parse(token.tokens);
38619             out += this.renderer.blockquote(body);
38620             continue;
38621           }
38622           case "list": {
38623             ordered = token.ordered;
38624             start2 = token.start;
38625             loose = token.loose;
38626             l2 = token.items.length;
38627             body = "";
38628             for (j3 = 0; j3 < l2; j3++) {
38629               item = token.items[j3];
38630               checked = item.checked;
38631               task = item.task;
38632               itemBody = "";
38633               if (item.task) {
38634                 checkbox = this.renderer.checkbox(!!checked);
38635                 if (loose) {
38636                   if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
38637                     item.tokens[0].text = checkbox + " " + item.tokens[0].text;
38638                     if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
38639                       item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
38640                     }
38641                   } else {
38642                     item.tokens.unshift({
38643                       type: "text",
38644                       text: checkbox
38645                     });
38646                   }
38647                 } else {
38648                   itemBody += checkbox;
38649                 }
38650               }
38651               itemBody += this.parse(item.tokens, loose);
38652               body += this.renderer.listitem(itemBody, task, !!checked);
38653             }
38654             out += this.renderer.list(body, ordered, start2);
38655             continue;
38656           }
38657           case "html": {
38658             out += this.renderer.html(token.text, token.block);
38659             continue;
38660           }
38661           case "paragraph": {
38662             out += this.renderer.paragraph(this.parseInline(token.tokens));
38663             continue;
38664           }
38665           case "text": {
38666             body = token.tokens ? this.parseInline(token.tokens) : token.text;
38667             while (i3 + 1 < l4 && tokens[i3 + 1].type === "text") {
38668               token = tokens[++i3];
38669               body += "\n" + (token.tokens ? this.parseInline(token.tokens) : token.text);
38670             }
38671             out += top ? this.renderer.paragraph(body) : body;
38672             continue;
38673           }
38674           default: {
38675             const errMsg = 'Token with "' + token.type + '" type was not found.';
38676             if (this.options.silent) {
38677               console.error(errMsg);
38678               return "";
38679             } else {
38680               throw new Error(errMsg);
38681             }
38682           }
38683         }
38684       }
38685       return out;
38686     }
38687     /**
38688      * Parse Inline Tokens
38689      */
38690     parseInline(tokens, renderer) {
38691       renderer = renderer || this.renderer;
38692       let out = "", i3, token, ret;
38693       const l2 = tokens.length;
38694       for (i3 = 0; i3 < l2; i3++) {
38695         token = tokens[i3];
38696         if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
38697           ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
38698           if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(token.type)) {
38699             out += ret || "";
38700             continue;
38701           }
38702         }
38703         switch (token.type) {
38704           case "escape": {
38705             out += renderer.text(token.text);
38706             break;
38707           }
38708           case "html": {
38709             out += renderer.html(token.text);
38710             break;
38711           }
38712           case "link": {
38713             out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
38714             break;
38715           }
38716           case "image": {
38717             out += renderer.image(token.href, token.title, token.text);
38718             break;
38719           }
38720           case "strong": {
38721             out += renderer.strong(this.parseInline(token.tokens, renderer));
38722             break;
38723           }
38724           case "em": {
38725             out += renderer.em(this.parseInline(token.tokens, renderer));
38726             break;
38727           }
38728           case "codespan": {
38729             out += renderer.codespan(token.text);
38730             break;
38731           }
38732           case "br": {
38733             out += renderer.br();
38734             break;
38735           }
38736           case "del": {
38737             out += renderer.del(this.parseInline(token.tokens, renderer));
38738             break;
38739           }
38740           case "text": {
38741             out += renderer.text(token.text);
38742             break;
38743           }
38744           default: {
38745             const errMsg = 'Token with "' + token.type + '" type was not found.';
38746             if (this.options.silent) {
38747               console.error(errMsg);
38748               return "";
38749             } else {
38750               throw new Error(errMsg);
38751             }
38752           }
38753         }
38754       }
38755       return out;
38756     }
38757   };
38758   var _Hooks = class {
38759     constructor(options2) {
38760       __publicField(this, "options");
38761       this.options = options2 || _defaults;
38762     }
38763     /**
38764      * Process markdown before marked
38765      */
38766     preprocess(markdown) {
38767       return markdown;
38768     }
38769     /**
38770      * Process HTML after marked is finished
38771      */
38772     postprocess(html2) {
38773       return html2;
38774     }
38775   };
38776   __publicField(_Hooks, "passThroughHooks", /* @__PURE__ */ new Set([
38777     "preprocess",
38778     "postprocess"
38779   ]));
38780   var _parseMarkdown, parseMarkdown_fn, _onError, onError_fn;
38781   var Marked = class {
38782     constructor(...args) {
38783       __privateAdd(this, _parseMarkdown);
38784       __privateAdd(this, _onError);
38785       __publicField(this, "defaults", _getDefaults());
38786       __publicField(this, "options", this.setOptions);
38787       __publicField(this, "parse", __privateMethod(this, _parseMarkdown, parseMarkdown_fn).call(this, _Lexer.lex, _Parser.parse));
38788       __publicField(this, "parseInline", __privateMethod(this, _parseMarkdown, parseMarkdown_fn).call(this, _Lexer.lexInline, _Parser.parseInline));
38789       __publicField(this, "Parser", _Parser);
38790       __publicField(this, "parser", _Parser.parse);
38791       __publicField(this, "Renderer", _Renderer);
38792       __publicField(this, "TextRenderer", _TextRenderer);
38793       __publicField(this, "Lexer", _Lexer);
38794       __publicField(this, "lexer", _Lexer.lex);
38795       __publicField(this, "Tokenizer", _Tokenizer);
38796       __publicField(this, "Slugger", _Slugger);
38797       __publicField(this, "Hooks", _Hooks);
38798       this.use(...args);
38799     }
38800     /**
38801      * Run callback for every token
38802      */
38803     walkTokens(tokens, callback) {
38804       let values = [];
38805       for (const token of tokens) {
38806         values = values.concat(callback.call(this, token));
38807         switch (token.type) {
38808           case "table": {
38809             for (const cell of token.header) {
38810               values = values.concat(this.walkTokens(cell.tokens, callback));
38811             }
38812             for (const row of token.rows) {
38813               for (const cell of row) {
38814                 values = values.concat(this.walkTokens(cell.tokens, callback));
38815               }
38816             }
38817             break;
38818           }
38819           case "list": {
38820             values = values.concat(this.walkTokens(token.items, callback));
38821             break;
38822           }
38823           default: {
38824             if (this.defaults.extensions && this.defaults.extensions.childTokens && this.defaults.extensions.childTokens[token.type]) {
38825               this.defaults.extensions.childTokens[token.type].forEach((childTokens) => {
38826                 values = values.concat(this.walkTokens(token[childTokens], callback));
38827               });
38828             } else if (token.tokens) {
38829               values = values.concat(this.walkTokens(token.tokens, callback));
38830             }
38831           }
38832         }
38833       }
38834       return values;
38835     }
38836     use(...args) {
38837       const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };
38838       args.forEach((pack) => {
38839         const opts = __spreadValues({}, pack);
38840         opts.async = this.defaults.async || opts.async || false;
38841         if (pack.extensions) {
38842           pack.extensions.forEach((ext) => {
38843             if (!ext.name) {
38844               throw new Error("extension name required");
38845             }
38846             if ("renderer" in ext) {
38847               const prevRenderer = extensions.renderers[ext.name];
38848               if (prevRenderer) {
38849                 extensions.renderers[ext.name] = function(...args2) {
38850                   let ret = ext.renderer.apply(this, args2);
38851                   if (ret === false) {
38852                     ret = prevRenderer.apply(this, args2);
38853                   }
38854                   return ret;
38855                 };
38856               } else {
38857                 extensions.renderers[ext.name] = ext.renderer;
38858               }
38859             }
38860             if ("tokenizer" in ext) {
38861               if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
38862                 throw new Error("extension level must be 'block' or 'inline'");
38863               }
38864               if (extensions[ext.level]) {
38865                 extensions[ext.level].unshift(ext.tokenizer);
38866               } else {
38867                 extensions[ext.level] = [ext.tokenizer];
38868               }
38869               if (ext.start) {
38870                 if (ext.level === "block") {
38871                   if (extensions.startBlock) {
38872                     extensions.startBlock.push(ext.start);
38873                   } else {
38874                     extensions.startBlock = [ext.start];
38875                   }
38876                 } else if (ext.level === "inline") {
38877                   if (extensions.startInline) {
38878                     extensions.startInline.push(ext.start);
38879                   } else {
38880                     extensions.startInline = [ext.start];
38881                   }
38882                 }
38883               }
38884             }
38885             if ("childTokens" in ext && ext.childTokens) {
38886               extensions.childTokens[ext.name] = ext.childTokens;
38887             }
38888           });
38889           opts.extensions = extensions;
38890         }
38891         if (pack.renderer) {
38892           const renderer = this.defaults.renderer || new _Renderer(this.defaults);
38893           for (const prop in pack.renderer) {
38894             const rendererFunc = pack.renderer[prop];
38895             const rendererKey = prop;
38896             const prevRenderer = renderer[rendererKey];
38897             renderer[rendererKey] = (...args2) => {
38898               let ret = rendererFunc.apply(renderer, args2);
38899               if (ret === false) {
38900                 ret = prevRenderer.apply(renderer, args2);
38901               }
38902               return ret || "";
38903             };
38904           }
38905           opts.renderer = renderer;
38906         }
38907         if (pack.tokenizer) {
38908           const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
38909           for (const prop in pack.tokenizer) {
38910             const tokenizerFunc = pack.tokenizer[prop];
38911             const tokenizerKey = prop;
38912             const prevTokenizer = tokenizer[tokenizerKey];
38913             tokenizer[tokenizerKey] = (...args2) => {
38914               let ret = tokenizerFunc.apply(tokenizer, args2);
38915               if (ret === false) {
38916                 ret = prevTokenizer.apply(tokenizer, args2);
38917               }
38918               return ret;
38919             };
38920           }
38921           opts.tokenizer = tokenizer;
38922         }
38923         if (pack.hooks) {
38924           const hooks = this.defaults.hooks || new _Hooks();
38925           for (const prop in pack.hooks) {
38926             const hooksFunc = pack.hooks[prop];
38927             const hooksKey = prop;
38928             const prevHook = hooks[hooksKey];
38929             if (_Hooks.passThroughHooks.has(prop)) {
38930               hooks[hooksKey] = (arg) => {
38931                 if (this.defaults.async) {
38932                   return Promise.resolve(hooksFunc.call(hooks, arg)).then((ret2) => {
38933                     return prevHook.call(hooks, ret2);
38934                   });
38935                 }
38936                 const ret = hooksFunc.call(hooks, arg);
38937                 return prevHook.call(hooks, ret);
38938               };
38939             } else {
38940               hooks[hooksKey] = (...args2) => {
38941                 let ret = hooksFunc.apply(hooks, args2);
38942                 if (ret === false) {
38943                   ret = prevHook.apply(hooks, args2);
38944                 }
38945                 return ret;
38946               };
38947             }
38948           }
38949           opts.hooks = hooks;
38950         }
38951         if (pack.walkTokens) {
38952           const walkTokens2 = this.defaults.walkTokens;
38953           opts.walkTokens = function(token) {
38954             let values = [];
38955             values.push(pack.walkTokens.call(this, token));
38956             if (walkTokens2) {
38957               values = values.concat(walkTokens2.call(this, token));
38958             }
38959             return values;
38960           };
38961         }
38962         this.defaults = __spreadValues(__spreadValues({}, this.defaults), opts);
38963       });
38964       return this;
38965     }
38966     setOptions(opt) {
38967       this.defaults = __spreadValues(__spreadValues({}, this.defaults), opt);
38968       return this;
38969     }
38970   };
38971   _parseMarkdown = new WeakSet();
38972   parseMarkdown_fn = function(lexer2, parser3) {
38973     return (src, optOrCallback, callback) => {
38974       if (typeof optOrCallback === "function") {
38975         callback = optOrCallback;
38976         optOrCallback = null;
38977       }
38978       const origOpt = __spreadValues({}, optOrCallback);
38979       const opt = __spreadValues(__spreadValues({}, this.defaults), origOpt);
38980       const throwError = __privateMethod(this, _onError, onError_fn).call(this, !!opt.silent, !!opt.async, callback);
38981       if (typeof src === "undefined" || src === null) {
38982         return throwError(new Error("marked(): input parameter is undefined or null"));
38983       }
38984       if (typeof src !== "string") {
38985         return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
38986       }
38987       checkDeprecations(opt, callback);
38988       if (opt.hooks) {
38989         opt.hooks.options = opt;
38990       }
38991       if (callback) {
38992         const highlight = opt.highlight;
38993         let tokens;
38994         try {
38995           if (opt.hooks) {
38996             src = opt.hooks.preprocess(src);
38997           }
38998           tokens = lexer2(src, opt);
38999         } catch (e3) {
39000           return throwError(e3);
39001         }
39002         const done = (err) => {
39003           let out;
39004           if (!err) {
39005             try {
39006               if (opt.walkTokens) {
39007                 this.walkTokens(tokens, opt.walkTokens);
39008               }
39009               out = parser3(tokens, opt);
39010               if (opt.hooks) {
39011                 out = opt.hooks.postprocess(out);
39012               }
39013             } catch (e3) {
39014               err = e3;
39015             }
39016           }
39017           opt.highlight = highlight;
39018           return err ? throwError(err) : callback(null, out);
39019         };
39020         if (!highlight || highlight.length < 3) {
39021           return done();
39022         }
39023         delete opt.highlight;
39024         if (!tokens.length)
39025           return done();
39026         let pending = 0;
39027         this.walkTokens(tokens, (token) => {
39028           if (token.type === "code") {
39029             pending++;
39030             setTimeout(() => {
39031               highlight(token.text, token.lang, (err, code) => {
39032                 if (err) {
39033                   return done(err);
39034                 }
39035                 if (code != null && code !== token.text) {
39036                   token.text = code;
39037                   token.escaped = true;
39038                 }
39039                 pending--;
39040                 if (pending === 0) {
39041                   done();
39042                 }
39043               });
39044             }, 0);
39045           }
39046         });
39047         if (pending === 0) {
39048           done();
39049         }
39050         return;
39051       }
39052       if (opt.async) {
39053         return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser3(tokens, opt)).then((html2) => opt.hooks ? opt.hooks.postprocess(html2) : html2).catch(throwError);
39054       }
39055       try {
39056         if (opt.hooks) {
39057           src = opt.hooks.preprocess(src);
39058         }
39059         const tokens = lexer2(src, opt);
39060         if (opt.walkTokens) {
39061           this.walkTokens(tokens, opt.walkTokens);
39062         }
39063         let html2 = parser3(tokens, opt);
39064         if (opt.hooks) {
39065           html2 = opt.hooks.postprocess(html2);
39066         }
39067         return html2;
39068       } catch (e3) {
39069         return throwError(e3);
39070       }
39071     };
39072   };
39073   _onError = new WeakSet();
39074   onError_fn = function(silent, async, callback) {
39075     return (e3) => {
39076       e3.message += "\nPlease report this to https://github.com/markedjs/marked.";
39077       if (silent) {
39078         const msg = "<p>An error occurred:</p><pre>" + escape4(e3.message + "", true) + "</pre>";
39079         if (async) {
39080           return Promise.resolve(msg);
39081         }
39082         if (callback) {
39083           callback(null, msg);
39084           return;
39085         }
39086         return msg;
39087       }
39088       if (async) {
39089         return Promise.reject(e3);
39090       }
39091       if (callback) {
39092         callback(e3);
39093         return;
39094       }
39095       throw e3;
39096     };
39097   };
39098   var markedInstance = new Marked();
39099   function marked(src, opt, callback) {
39100     return markedInstance.parse(src, opt, callback);
39101   }
39102   marked.options = marked.setOptions = function(options2) {
39103     markedInstance.setOptions(options2);
39104     marked.defaults = markedInstance.defaults;
39105     changeDefaults(marked.defaults);
39106     return marked;
39107   };
39108   marked.getDefaults = _getDefaults;
39109   marked.defaults = _defaults;
39110   marked.use = function(...args) {
39111     markedInstance.use(...args);
39112     marked.defaults = markedInstance.defaults;
39113     changeDefaults(marked.defaults);
39114     return marked;
39115   };
39116   marked.walkTokens = function(tokens, callback) {
39117     return markedInstance.walkTokens(tokens, callback);
39118   };
39119   marked.parseInline = markedInstance.parseInline;
39120   marked.Parser = _Parser;
39121   marked.parser = _Parser.parse;
39122   marked.Renderer = _Renderer;
39123   marked.TextRenderer = _TextRenderer;
39124   marked.Lexer = _Lexer;
39125   marked.lexer = _Lexer.lex;
39126   marked.Tokenizer = _Tokenizer;
39127   marked.Slugger = _Slugger;
39128   marked.Hooks = _Hooks;
39129   marked.parse = marked;
39130   var options = marked.options;
39131   var setOptions = marked.setOptions;
39132   var use = marked.use;
39133   var walkTokens = marked.walkTokens;
39134   var parseInline = marked.parseInline;
39135   var parser2 = _Parser.parse;
39136   var lexer = _Lexer.lex;
39137
39138   // modules/services/osmose.js
39139   var tiler3 = utilTiler();
39140   var dispatch4 = dispatch_default("loaded");
39141   var _tileZoom3 = 14;
39142   var _osmoseUrlRoot = "https://osmose.openstreetmap.fr/api/0.3";
39143   var _osmoseData = { icons: {}, items: [] };
39144   var _cache3;
39145   function abortRequest3(controller) {
39146     if (controller) {
39147       controller.abort();
39148     }
39149   }
39150   function abortUnwantedRequests3(cache, tiles) {
39151     Object.keys(cache.inflightTile).forEach((k2) => {
39152       let wanted = tiles.find((tile) => k2 === tile.id);
39153       if (!wanted) {
39154         abortRequest3(cache.inflightTile[k2]);
39155         delete cache.inflightTile[k2];
39156       }
39157     });
39158   }
39159   function encodeIssueRtree3(d2) {
39160     return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
39161   }
39162   function updateRtree3(item, replace) {
39163     _cache3.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
39164     if (replace) {
39165       _cache3.rtree.insert(item);
39166     }
39167   }
39168   function preventCoincident2(loc) {
39169     let coincident = false;
39170     do {
39171       let delta = coincident ? [1e-5, 0] : [0, 1e-5];
39172       loc = geoVecAdd(loc, delta);
39173       let bbox2 = geoExtent(loc).bbox();
39174       coincident = _cache3.rtree.search(bbox2).length;
39175     } while (coincident);
39176     return loc;
39177   }
39178   var osmose_default = {
39179     title: "osmose",
39180     init() {
39181       _mainFileFetcher.get("qa_data").then((d2) => {
39182         _osmoseData = d2.osmose;
39183         _osmoseData.items = Object.keys(d2.osmose.icons).map((s2) => s2.split("-")[0]).reduce((unique, item) => unique.indexOf(item) !== -1 ? unique : [...unique, item], []);
39184       });
39185       if (!_cache3) {
39186         this.reset();
39187       }
39188       this.event = utilRebind(this, dispatch4, "on");
39189     },
39190     reset() {
39191       let _strings = {};
39192       let _colors = {};
39193       if (_cache3) {
39194         Object.values(_cache3.inflightTile).forEach(abortRequest3);
39195         _strings = _cache3.strings;
39196         _colors = _cache3.colors;
39197       }
39198       _cache3 = {
39199         data: {},
39200         loadedTile: {},
39201         inflightTile: {},
39202         inflightPost: {},
39203         closed: {},
39204         rtree: new import_rbush3.default(),
39205         strings: _strings,
39206         colors: _colors
39207       };
39208     },
39209     loadIssues(projection2) {
39210       let params = {
39211         // Tiles return a maximum # of issues
39212         // So we want to filter our request for only types iD supports
39213         item: _osmoseData.items
39214       };
39215       let tiles = tiler3.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
39216       abortUnwantedRequests3(_cache3, tiles);
39217       tiles.forEach((tile) => {
39218         if (_cache3.loadedTile[tile.id] || _cache3.inflightTile[tile.id])
39219           return;
39220         let [x2, y2, z2] = tile.xyz;
39221         let url = "".concat(_osmoseUrlRoot, "/issues/").concat(z2, "/").concat(x2, "/").concat(y2, ".geojson?") + utilQsString(params);
39222         let controller = new AbortController();
39223         _cache3.inflightTile[tile.id] = controller;
39224         json_default(url, { signal: controller.signal }).then((data) => {
39225           delete _cache3.inflightTile[tile.id];
39226           _cache3.loadedTile[tile.id] = true;
39227           if (data.features) {
39228             data.features.forEach((issue) => {
39229               const { item, class: cl, uuid: id2 } = issue.properties;
39230               const itemType = "".concat(item, "-").concat(cl);
39231               if (itemType in _osmoseData.icons) {
39232                 let loc = issue.geometry.coordinates;
39233                 loc = preventCoincident2(loc);
39234                 let d2 = new QAItem(loc, this, itemType, id2, { item });
39235                 if (item === 8300 || item === 8360) {
39236                   d2.elems = [];
39237                 }
39238                 _cache3.data[d2.id] = d2;
39239                 _cache3.rtree.insert(encodeIssueRtree3(d2));
39240               }
39241             });
39242           }
39243           dispatch4.call("loaded");
39244         }).catch(() => {
39245           delete _cache3.inflightTile[tile.id];
39246           _cache3.loadedTile[tile.id] = true;
39247         });
39248       });
39249     },
39250     loadIssueDetail(issue) {
39251       if (issue.elems !== void 0) {
39252         return Promise.resolve(issue);
39253       }
39254       const url = "".concat(_osmoseUrlRoot, "/issue/").concat(issue.id, "?langs=").concat(_mainLocalizer.localeCode());
39255       const cacheDetails = (data) => {
39256         issue.elems = data.elems.map((e3) => e3.type.substring(0, 1) + e3.id);
39257         issue.detail = data.subtitle ? marked(data.subtitle.auto) : "";
39258         this.replaceItem(issue);
39259       };
39260       return json_default(url).then(cacheDetails).then(() => issue);
39261     },
39262     loadStrings(locale2 = _mainLocalizer.localeCode()) {
39263       const items = Object.keys(_osmoseData.icons);
39264       if (locale2 in _cache3.strings && Object.keys(_cache3.strings[locale2]).length === items.length) {
39265         return Promise.resolve(_cache3.strings[locale2]);
39266       }
39267       if (!(locale2 in _cache3.strings)) {
39268         _cache3.strings[locale2] = {};
39269       }
39270       const allRequests = items.map((itemType) => {
39271         if (itemType in _cache3.strings[locale2])
39272           return null;
39273         const cacheData = (data) => {
39274           const [cat = { items: [] }] = data.categories;
39275           const [item2 = { class: [] }] = cat.items;
39276           const [cl2 = null] = item2.class;
39277           if (!cl2) {
39278             console.log("Osmose strings request (".concat(itemType, ") had unexpected data"));
39279             return;
39280           }
39281           const { item: itemInt, color: color2 } = item2;
39282           if (/^#[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/.test(color2)) {
39283             _cache3.colors[itemInt] = color2;
39284           }
39285           const { title, detail, fix, trap } = cl2;
39286           let issueStrings = {};
39287           if (title)
39288             issueStrings.title = title.auto;
39289           if (detail)
39290             issueStrings.detail = marked(detail.auto);
39291           if (trap)
39292             issueStrings.trap = marked(trap.auto);
39293           if (fix)
39294             issueStrings.fix = marked(fix.auto);
39295           _cache3.strings[locale2][itemType] = issueStrings;
39296         };
39297         const [item, cl] = itemType.split("-");
39298         const url = "".concat(_osmoseUrlRoot, "/items/").concat(item, "/class/").concat(cl, "?langs=").concat(locale2);
39299         return json_default(url).then(cacheData);
39300       }).filter(Boolean);
39301       return Promise.all(allRequests).then(() => _cache3.strings[locale2]);
39302     },
39303     getStrings(itemType, locale2 = _mainLocalizer.localeCode()) {
39304       return locale2 in _cache3.strings ? _cache3.strings[locale2][itemType] : {};
39305     },
39306     getColor(itemType) {
39307       return itemType in _cache3.colors ? _cache3.colors[itemType] : "#FFFFFF";
39308     },
39309     postUpdate(issue, callback) {
39310       if (_cache3.inflightPost[issue.id]) {
39311         return callback({ message: "Issue update already inflight", status: -2 }, issue);
39312       }
39313       const url = "".concat(_osmoseUrlRoot, "/issue/").concat(issue.id, "/").concat(issue.newStatus);
39314       const controller = new AbortController();
39315       const after = () => {
39316         delete _cache3.inflightPost[issue.id];
39317         this.removeItem(issue);
39318         if (issue.newStatus === "done") {
39319           if (!(issue.item in _cache3.closed)) {
39320             _cache3.closed[issue.item] = 0;
39321           }
39322           _cache3.closed[issue.item] += 1;
39323         }
39324         if (callback)
39325           callback(null, issue);
39326       };
39327       _cache3.inflightPost[issue.id] = controller;
39328       fetch(url, { signal: controller.signal }).then(after).catch((err) => {
39329         delete _cache3.inflightPost[issue.id];
39330         if (callback)
39331           callback(err.message);
39332       });
39333     },
39334     // Get all cached QAItems covering the viewport
39335     getItems(projection2) {
39336       const viewport = projection2.clipExtent();
39337       const min3 = [viewport[0][0], viewport[1][1]];
39338       const max3 = [viewport[1][0], viewport[0][1]];
39339       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
39340       return _cache3.rtree.search(bbox2).map((d2) => d2.data);
39341     },
39342     // Get a QAItem from cache
39343     // NOTE: Don't change method name until UI v3 is merged
39344     getError(id2) {
39345       return _cache3.data[id2];
39346     },
39347     // get the name of the icon to display for this item
39348     getIcon(itemType) {
39349       return _osmoseData.icons[itemType];
39350     },
39351     // Replace a single QAItem in the cache
39352     replaceItem(item) {
39353       if (!(item instanceof QAItem) || !item.id)
39354         return;
39355       _cache3.data[item.id] = item;
39356       updateRtree3(encodeIssueRtree3(item), true);
39357       return item;
39358     },
39359     // Remove a single QAItem from the cache
39360     removeItem(item) {
39361       if (!(item instanceof QAItem) || !item.id)
39362         return;
39363       delete _cache3.data[item.id];
39364       updateRtree3(encodeIssueRtree3(item), false);
39365     },
39366     // Used to populate `closed:osmose:*` changeset tags
39367     getClosedCounts() {
39368       return _cache3.closed;
39369     },
39370     itemURL(item) {
39371       return "https://osmose.openstreetmap.fr/en/error/".concat(item.id);
39372     }
39373   };
39374
39375   // modules/services/mapillary.js
39376   var import_pbf = __toESM(require_pbf());
39377   var import_rbush4 = __toESM(require_rbush_min());
39378   var import_vector_tile = __toESM(require_vector_tile());
39379   var accessToken = "MLY|4100327730013843|5bb78b81720791946a9a7b956c57b7cf";
39380   var apiUrl = "https://graph.mapillary.com/";
39381   var baseTileUrl = "https://tiles.mapillary.com/maps/vtp";
39382   var mapFeatureTileUrl = "".concat(baseTileUrl, "/mly_map_feature_point/2/{z}/{x}/{y}?access_token=").concat(accessToken);
39383   var tileUrl = "".concat(baseTileUrl, "/mly1_public/2/{z}/{x}/{y}?access_token=").concat(accessToken);
39384   var trafficSignTileUrl = "".concat(baseTileUrl, "/mly_map_feature_traffic_sign/2/{z}/{x}/{y}?access_token=").concat(accessToken);
39385   var viewercss = "mapillary-js/mapillary.css";
39386   var viewerjs = "mapillary-js/mapillary.js";
39387   var minZoom = 14;
39388   var dispatch5 = dispatch_default("change", "loadedImages", "loadedSigns", "loadedMapFeatures", "bearingChanged", "imageChanged");
39389   var _loadViewerPromise;
39390   var _mlyActiveImage;
39391   var _mlyCache;
39392   var _mlyFallback = false;
39393   var _mlyHighlightedDetection;
39394   var _mlyShowFeatureDetections = false;
39395   var _mlyShowSignDetections = false;
39396   var _mlyViewer;
39397   var _mlyViewerFilter = ["all"];
39398   function loadTiles(which, url, maxZoom2, projection2) {
39399     const tiler9 = utilTiler().zoomExtent([minZoom, maxZoom2]).skipNullIsland(true);
39400     const tiles = tiler9.getTiles(projection2);
39401     tiles.forEach(function(tile) {
39402       loadTile(which, url, tile);
39403     });
39404   }
39405   function loadTile(which, url, tile) {
39406     const cache = _mlyCache.requests;
39407     const tileId = "".concat(tile.id, "-").concat(which);
39408     if (cache.loaded[tileId] || cache.inflight[tileId])
39409       return;
39410     const controller = new AbortController();
39411     cache.inflight[tileId] = controller;
39412     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
39413     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
39414       if (!response.ok) {
39415         throw new Error(response.status + " " + response.statusText);
39416       }
39417       cache.loaded[tileId] = true;
39418       delete cache.inflight[tileId];
39419       return response.arrayBuffer();
39420     }).then(function(data) {
39421       if (!data) {
39422         throw new Error("No Data");
39423       }
39424       loadTileDataToCache(data, tile, which);
39425       if (which === "images") {
39426         dispatch5.call("loadedImages");
39427       } else if (which === "signs") {
39428         dispatch5.call("loadedSigns");
39429       } else if (which === "points") {
39430         dispatch5.call("loadedMapFeatures");
39431       }
39432     }).catch(function() {
39433       cache.loaded[tileId] = true;
39434       delete cache.inflight[tileId];
39435     });
39436   }
39437   function loadTileDataToCache(data, tile, which) {
39438     const vectorTile = new import_vector_tile.VectorTile(new import_pbf.default(data));
39439     let features, cache, layer, i3, feature3, loc, d2;
39440     if (vectorTile.layers.hasOwnProperty("image")) {
39441       features = [];
39442       cache = _mlyCache.images;
39443       layer = vectorTile.layers.image;
39444       for (i3 = 0; i3 < layer.length; i3++) {
39445         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
39446         loc = feature3.geometry.coordinates;
39447         d2 = {
39448           loc,
39449           captured_at: feature3.properties.captured_at,
39450           ca: feature3.properties.compass_angle,
39451           id: feature3.properties.id,
39452           is_pano: feature3.properties.is_pano,
39453           sequence_id: feature3.properties.sequence_id
39454         };
39455         cache.forImageId[d2.id] = d2;
39456         features.push({
39457           minX: loc[0],
39458           minY: loc[1],
39459           maxX: loc[0],
39460           maxY: loc[1],
39461           data: d2
39462         });
39463       }
39464       if (cache.rtree) {
39465         cache.rtree.load(features);
39466       }
39467     }
39468     if (vectorTile.layers.hasOwnProperty("sequence")) {
39469       features = [];
39470       cache = _mlyCache.sequences;
39471       layer = vectorTile.layers.sequence;
39472       for (i3 = 0; i3 < layer.length; i3++) {
39473         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
39474         if (cache.lineString[feature3.properties.id]) {
39475           cache.lineString[feature3.properties.id].push(feature3);
39476         } else {
39477           cache.lineString[feature3.properties.id] = [feature3];
39478         }
39479       }
39480     }
39481     if (vectorTile.layers.hasOwnProperty("point")) {
39482       features = [];
39483       cache = _mlyCache[which];
39484       layer = vectorTile.layers.point;
39485       for (i3 = 0; i3 < layer.length; i3++) {
39486         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
39487         loc = feature3.geometry.coordinates;
39488         d2 = {
39489           loc,
39490           id: feature3.properties.id,
39491           first_seen_at: feature3.properties.first_seen_at,
39492           last_seen_at: feature3.properties.last_seen_at,
39493           value: feature3.properties.value
39494         };
39495         features.push({
39496           minX: loc[0],
39497           minY: loc[1],
39498           maxX: loc[0],
39499           maxY: loc[1],
39500           data: d2
39501         });
39502       }
39503       if (cache.rtree) {
39504         cache.rtree.load(features);
39505       }
39506     }
39507     if (vectorTile.layers.hasOwnProperty("traffic_sign")) {
39508       features = [];
39509       cache = _mlyCache[which];
39510       layer = vectorTile.layers.traffic_sign;
39511       for (i3 = 0; i3 < layer.length; i3++) {
39512         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
39513         loc = feature3.geometry.coordinates;
39514         d2 = {
39515           loc,
39516           id: feature3.properties.id,
39517           first_seen_at: feature3.properties.first_seen_at,
39518           last_seen_at: feature3.properties.last_seen_at,
39519           value: feature3.properties.value
39520         };
39521         features.push({
39522           minX: loc[0],
39523           minY: loc[1],
39524           maxX: loc[0],
39525           maxY: loc[1],
39526           data: d2
39527         });
39528       }
39529       if (cache.rtree) {
39530         cache.rtree.load(features);
39531       }
39532     }
39533   }
39534   function loadData(url) {
39535     return fetch(url).then(function(response) {
39536       if (!response.ok) {
39537         throw new Error(response.status + " " + response.statusText);
39538       }
39539       return response.json();
39540     }).then(function(result) {
39541       if (!result) {
39542         return [];
39543       }
39544       return result.data || [];
39545     });
39546   }
39547   function partitionViewport(projection2) {
39548     const z2 = geoScaleToZoom(projection2.scale());
39549     const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
39550     const tiler9 = utilTiler().zoomExtent([z22, z22]);
39551     return tiler9.getTiles(projection2).map(function(tile) {
39552       return tile.extent;
39553     });
39554   }
39555   function searchLimited(limit, projection2, rtree) {
39556     limit = limit || 5;
39557     return partitionViewport(projection2).reduce(function(result, extent) {
39558       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
39559         return d2.data;
39560       });
39561       return found.length ? result.concat(found) : result;
39562     }, []);
39563   }
39564   var mapillary_default = {
39565     // Initialize Mapillary
39566     init: function() {
39567       if (!_mlyCache) {
39568         this.reset();
39569       }
39570       this.event = utilRebind(this, dispatch5, "on");
39571     },
39572     // Reset cache and state
39573     reset: function() {
39574       if (_mlyCache) {
39575         Object.values(_mlyCache.requests.inflight).forEach(function(request3) {
39576           request3.abort();
39577         });
39578       }
39579       _mlyCache = {
39580         images: { rtree: new import_rbush4.default(), forImageId: {} },
39581         image_detections: { forImageId: {} },
39582         signs: { rtree: new import_rbush4.default() },
39583         points: { rtree: new import_rbush4.default() },
39584         sequences: { rtree: new import_rbush4.default(), lineString: {} },
39585         requests: { loaded: {}, inflight: {} }
39586       };
39587       _mlyActiveImage = null;
39588     },
39589     // Get visible images
39590     images: function(projection2) {
39591       const limit = 5;
39592       return searchLimited(limit, projection2, _mlyCache.images.rtree);
39593     },
39594     // Get visible traffic signs
39595     signs: function(projection2) {
39596       const limit = 5;
39597       return searchLimited(limit, projection2, _mlyCache.signs.rtree);
39598     },
39599     // Get visible map (point) features
39600     mapFeatures: function(projection2) {
39601       const limit = 5;
39602       return searchLimited(limit, projection2, _mlyCache.points.rtree);
39603     },
39604     // Get cached image by id
39605     cachedImage: function(imageId) {
39606       return _mlyCache.images.forImageId[imageId];
39607     },
39608     // Get visible sequences
39609     sequences: function(projection2) {
39610       const viewport = projection2.clipExtent();
39611       const min3 = [viewport[0][0], viewport[1][1]];
39612       const max3 = [viewport[1][0], viewport[0][1]];
39613       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
39614       const sequenceIds = {};
39615       let lineStrings = [];
39616       _mlyCache.images.rtree.search(bbox2).forEach(function(d2) {
39617         if (d2.data.sequence_id) {
39618           sequenceIds[d2.data.sequence_id] = true;
39619         }
39620       });
39621       Object.keys(sequenceIds).forEach(function(sequenceId) {
39622         if (_mlyCache.sequences.lineString[sequenceId]) {
39623           lineStrings = lineStrings.concat(_mlyCache.sequences.lineString[sequenceId]);
39624         }
39625       });
39626       return lineStrings;
39627     },
39628     // Load images in the visible area
39629     loadImages: function(projection2) {
39630       loadTiles("images", tileUrl, 14, projection2);
39631     },
39632     // Load traffic signs in the visible area
39633     loadSigns: function(projection2) {
39634       loadTiles("signs", trafficSignTileUrl, 14, projection2);
39635     },
39636     // Load map (point) features in the visible area
39637     loadMapFeatures: function(projection2) {
39638       loadTiles("points", mapFeatureTileUrl, 14, projection2);
39639     },
39640     // Return a promise that resolves when the image viewer (Mapillary JS) library has finished loading
39641     ensureViewerLoaded: function(context) {
39642       if (_loadViewerPromise)
39643         return _loadViewerPromise;
39644       const wrap2 = context.container().select(".photoviewer").selectAll(".mly-wrapper").data([0]);
39645       wrap2.enter().append("div").attr("id", "ideditor-mly").attr("class", "photo-wrapper mly-wrapper").classed("hide", true);
39646       const that = this;
39647       _loadViewerPromise = new Promise((resolve, reject) => {
39648         let loadedCount = 0;
39649         function loaded() {
39650           loadedCount += 1;
39651           if (loadedCount === 2)
39652             resolve();
39653         }
39654         const head = select_default2("head");
39655         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() {
39656           reject();
39657         });
39658         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() {
39659           reject();
39660         });
39661       }).catch(function() {
39662         _loadViewerPromise = null;
39663       }).then(function() {
39664         that.initViewer(context);
39665       });
39666       return _loadViewerPromise;
39667     },
39668     // Load traffic sign image sprites
39669     loadSignResources: function(context) {
39670       context.ui().svgDefs.addSprites(
39671         ["mapillary-sprite"],
39672         false
39673         /* don't override colors */
39674       );
39675       return this;
39676     },
39677     // Load map (point) feature image sprites
39678     loadObjectResources: function(context) {
39679       context.ui().svgDefs.addSprites(
39680         ["mapillary-object-sprite"],
39681         false
39682         /* don't override colors */
39683       );
39684       return this;
39685     },
39686     // Remove previous detections in image viewer
39687     resetTags: function() {
39688       if (_mlyViewer && !_mlyFallback) {
39689         _mlyViewer.getComponent("tag").removeAll();
39690       }
39691     },
39692     // Show map feature detections in image viewer
39693     showFeatureDetections: function(value) {
39694       _mlyShowFeatureDetections = value;
39695       if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
39696         this.resetTags();
39697       }
39698     },
39699     // Show traffic sign detections in image viewer
39700     showSignDetections: function(value) {
39701       _mlyShowSignDetections = value;
39702       if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
39703         this.resetTags();
39704       }
39705     },
39706     // Apply filter to image viewer
39707     filterViewer: function(context) {
39708       const showsPano = context.photos().showsPanoramic();
39709       const showsFlat = context.photos().showsFlat();
39710       const fromDate = context.photos().fromDate();
39711       const toDate = context.photos().toDate();
39712       const filter2 = ["all"];
39713       if (!showsPano)
39714         filter2.push(["!=", "cameraType", "spherical"]);
39715       if (!showsFlat && showsPano)
39716         filter2.push(["==", "pano", true]);
39717       if (fromDate) {
39718         filter2.push([">=", "capturedAt", new Date(fromDate).getTime()]);
39719       }
39720       if (toDate) {
39721         filter2.push([">=", "capturedAt", new Date(toDate).getTime()]);
39722       }
39723       if (_mlyViewer) {
39724         _mlyViewer.setFilter(filter2);
39725       }
39726       _mlyViewerFilter = filter2;
39727       return filter2;
39728     },
39729     // Make the image viewer visible
39730     showViewer: function(context) {
39731       const wrap2 = context.container().select(".photoviewer").classed("hide", false);
39732       const isHidden = wrap2.selectAll(".photo-wrapper.mly-wrapper.hide").size();
39733       if (isHidden && _mlyViewer) {
39734         wrap2.selectAll(".photo-wrapper:not(.mly-wrapper)").classed("hide", true);
39735         wrap2.selectAll(".photo-wrapper.mly-wrapper").classed("hide", false);
39736         _mlyViewer.resize();
39737       }
39738       return this;
39739     },
39740     // Hide the image viewer and resets map markers
39741     hideViewer: function(context) {
39742       _mlyActiveImage = null;
39743       if (!_mlyFallback && _mlyViewer) {
39744         _mlyViewer.getComponent("sequence").stop();
39745       }
39746       const viewer = context.container().select(".photoviewer");
39747       if (!viewer.empty())
39748         viewer.datum(null);
39749       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
39750       this.updateUrlImage(null);
39751       dispatch5.call("imageChanged");
39752       dispatch5.call("loadedMapFeatures");
39753       dispatch5.call("loadedSigns");
39754       return this.setStyles(context, null);
39755     },
39756     // Update the URL with current image id
39757     updateUrlImage: function(imageId) {
39758       if (!window.mocha) {
39759         const hash = utilStringQs(window.location.hash);
39760         if (imageId) {
39761           hash.photo = "mapillary/" + imageId;
39762         } else {
39763           delete hash.photo;
39764         }
39765         window.location.replace("#" + utilQsString(hash, true));
39766       }
39767     },
39768     // Highlight the detection in the viewer that is related to the clicked map feature
39769     highlightDetection: function(detection) {
39770       if (detection) {
39771         _mlyHighlightedDetection = detection.id;
39772       }
39773       return this;
39774     },
39775     // Initialize image viewer (Mapillar JS)
39776     initViewer: function(context) {
39777       const that = this;
39778       if (!window.mapillary)
39779         return;
39780       const opts = {
39781         accessToken,
39782         component: {
39783           cover: false,
39784           keyboard: false,
39785           tag: true
39786         },
39787         container: "ideditor-mly"
39788       };
39789       if (!mapillary.isSupported() && mapillary.isFallbackSupported()) {
39790         _mlyFallback = true;
39791         opts.component = {
39792           cover: false,
39793           direction: false,
39794           imagePlane: false,
39795           keyboard: false,
39796           mouse: false,
39797           sequence: false,
39798           tag: false,
39799           image: true,
39800           // fallback
39801           navigation: true
39802           // fallback
39803         };
39804       }
39805       _mlyViewer = new mapillary.Viewer(opts);
39806       _mlyViewer.on("image", imageChanged);
39807       _mlyViewer.on("bearing", bearingChanged);
39808       if (_mlyViewerFilter) {
39809         _mlyViewer.setFilter(_mlyViewerFilter);
39810       }
39811       context.ui().photoviewer.on("resize.mapillary", function() {
39812         if (_mlyViewer)
39813           _mlyViewer.resize();
39814       });
39815       function imageChanged(node) {
39816         that.resetTags();
39817         const image = node.image;
39818         that.setActiveImage(image);
39819         that.setStyles(context, null);
39820         const loc = [image.originalLngLat.lng, image.originalLngLat.lat];
39821         context.map().centerEase(loc);
39822         that.updateUrlImage(image.id);
39823         if (_mlyShowFeatureDetections || _mlyShowSignDetections) {
39824           that.updateDetections(image.id, "".concat(apiUrl, "/").concat(image.id, "/detections?access_token=").concat(accessToken, "&fields=id,image,geometry,value"));
39825         }
39826         dispatch5.call("imageChanged");
39827       }
39828       function bearingChanged(e3) {
39829         dispatch5.call("bearingChanged", void 0, e3);
39830       }
39831     },
39832     // Move to an image
39833     selectImage: function(context, imageId) {
39834       if (_mlyViewer && imageId) {
39835         _mlyViewer.moveTo(imageId).catch(function(e3) {
39836           console.error("mly3", e3);
39837         });
39838       }
39839       return this;
39840     },
39841     // Return the currently displayed image
39842     getActiveImage: function() {
39843       return _mlyActiveImage;
39844     },
39845     // Return a list of detection objects for the given id
39846     getDetections: function(id2) {
39847       return loadData("".concat(apiUrl, "/").concat(id2, "/detections?access_token=").concat(accessToken, "&fields=id,value,image"));
39848     },
39849     // Set the currently visible image
39850     setActiveImage: function(image) {
39851       if (image) {
39852         _mlyActiveImage = {
39853           ca: image.originalCompassAngle,
39854           id: image.id,
39855           loc: [image.originalLngLat.lng, image.originalLngLat.lat],
39856           is_pano: image.cameraType === "spherical",
39857           sequence_id: image.sequenceId
39858         };
39859       } else {
39860         _mlyActiveImage = null;
39861       }
39862     },
39863     // Update the currently highlighted sequence and selected bubble.
39864     setStyles: function(context, hovered) {
39865       const hoveredImageId = hovered && hovered.id;
39866       const hoveredSequenceId = hovered && hovered.sequence_id;
39867       const selectedSequenceId = _mlyActiveImage && _mlyActiveImage.sequence_id;
39868       context.container().selectAll(".layer-mapillary .viewfield-group").classed("highlighted", function(d2) {
39869         return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
39870       }).classed("hovered", function(d2) {
39871         return d2.id === hoveredImageId;
39872       });
39873       context.container().selectAll(".layer-mapillary .sequence").classed("highlighted", function(d2) {
39874         return d2.properties.id === hoveredSequenceId;
39875       }).classed("currentView", function(d2) {
39876         return d2.properties.id === selectedSequenceId;
39877       });
39878       return this;
39879     },
39880     // Get detections for the current image and shows them in the image viewer
39881     updateDetections: function(imageId, url) {
39882       if (!_mlyViewer || _mlyFallback)
39883         return;
39884       if (!imageId)
39885         return;
39886       const cache = _mlyCache.image_detections;
39887       if (cache.forImageId[imageId]) {
39888         showDetections(_mlyCache.image_detections.forImageId[imageId]);
39889       } else {
39890         loadData(url).then((detections) => {
39891           detections.forEach(function(detection) {
39892             if (!cache.forImageId[imageId]) {
39893               cache.forImageId[imageId] = [];
39894             }
39895             cache.forImageId[imageId].push({
39896               geometry: detection.geometry,
39897               id: detection.id,
39898               image_id: imageId,
39899               value: detection.value
39900             });
39901           });
39902           showDetections(_mlyCache.image_detections.forImageId[imageId] || []);
39903         });
39904       }
39905       function showDetections(detections) {
39906         const tagComponent = _mlyViewer.getComponent("tag");
39907         detections.forEach(function(data) {
39908           const tag = makeTag(data);
39909           if (tag) {
39910             tagComponent.add([tag]);
39911           }
39912         });
39913       }
39914       function makeTag(data) {
39915         const valueParts = data.value.split("--");
39916         if (!valueParts.length)
39917           return;
39918         let tag;
39919         let text2;
39920         let color2 = 16777215;
39921         if (_mlyHighlightedDetection === data.id) {
39922           color2 = 16776960;
39923           text2 = valueParts[1];
39924           if (text2 === "flat" || text2 === "discrete" || text2 === "sign") {
39925             text2 = valueParts[2];
39926           }
39927           text2 = text2.replace(/-/g, " ");
39928           text2 = text2.charAt(0).toUpperCase() + text2.slice(1);
39929           _mlyHighlightedDetection = null;
39930         }
39931         var decodedGeometry = window.atob(data.geometry);
39932         var uintArray = new Uint8Array(decodedGeometry.length);
39933         for (var i3 = 0; i3 < decodedGeometry.length; i3++) {
39934           uintArray[i3] = decodedGeometry.charCodeAt(i3);
39935         }
39936         const tile = new import_vector_tile.VectorTile(new import_pbf.default(uintArray.buffer));
39937         const layer = tile.layers["mpy-or"];
39938         const geometries = layer.feature(0).loadGeometry();
39939         const polygon2 = geometries.map((ring) => ring.map((point2) => [point2.x / layer.extent, point2.y / layer.extent]));
39940         tag = new mapillary.OutlineTag(
39941           data.id,
39942           new mapillary.PolygonGeometry(polygon2[0]),
39943           {
39944             text: text2,
39945             textColor: color2,
39946             lineColor: color2,
39947             lineWidth: 2,
39948             fillColor: color2,
39949             fillOpacity: 0.3
39950           }
39951         );
39952         return tag;
39953       }
39954     },
39955     // Return the current cache
39956     cache: function() {
39957       return _mlyCache;
39958     }
39959   };
39960
39961   // modules/core/validation/models.js
39962   function validationIssue(attrs) {
39963     this.type = attrs.type;
39964     this.subtype = attrs.subtype;
39965     this.severity = attrs.severity;
39966     this.message = attrs.message;
39967     this.reference = attrs.reference;
39968     this.entityIds = attrs.entityIds;
39969     this.loc = attrs.loc;
39970     this.data = attrs.data;
39971     this.dynamicFixes = attrs.dynamicFixes;
39972     this.hash = attrs.hash;
39973     this.id = generateID.apply(this);
39974     this.key = generateKey.apply(this);
39975     this.autoFix = null;
39976     function generateID() {
39977       var parts = [this.type];
39978       if (this.hash) {
39979         parts.push(this.hash);
39980       }
39981       if (this.subtype) {
39982         parts.push(this.subtype);
39983       }
39984       if (this.entityIds) {
39985         var entityKeys = this.entityIds.slice().sort();
39986         parts.push.apply(parts, entityKeys);
39987       }
39988       return parts.join(":");
39989     }
39990     function generateKey() {
39991       return this.id + ":" + Date.now().toString();
39992     }
39993     this.extent = function(resolver) {
39994       if (this.loc) {
39995         return geoExtent(this.loc);
39996       }
39997       if (this.entityIds && this.entityIds.length) {
39998         return this.entityIds.reduce(function(extent, entityId) {
39999           return extent.extend(resolver.entity(entityId).extent(resolver));
40000         }, geoExtent());
40001       }
40002       return null;
40003     };
40004     this.fixes = function(context) {
40005       var fixes = this.dynamicFixes ? this.dynamicFixes(context) : [];
40006       var issue = this;
40007       if (issue.severity === "warning") {
40008         fixes.push(new validationIssueFix({
40009           title: _t.append("issues.fix.ignore_issue.title"),
40010           icon: "iD-icon-close",
40011           onClick: function() {
40012             context.validator().ignoreIssue(this.issue.id);
40013           }
40014         }));
40015       }
40016       fixes.forEach(function(fix) {
40017         fix.id = fix.title.stringId;
40018         fix.issue = issue;
40019         if (fix.autoArgs) {
40020           issue.autoFix = fix;
40021         }
40022       });
40023       return fixes;
40024     };
40025   }
40026   function validationIssueFix(attrs) {
40027     this.title = attrs.title;
40028     this.onClick = attrs.onClick;
40029     this.disabledReason = attrs.disabledReason;
40030     this.icon = attrs.icon;
40031     this.entityIds = attrs.entityIds || [];
40032     this.autoArgs = attrs.autoArgs;
40033     this.issue = null;
40034   }
40035
40036   // modules/services/maprules.js
40037   var buildRuleChecks = function() {
40038     return {
40039       equals: function(equals) {
40040         return function(tags) {
40041           return Object.keys(equals).every(function(k2) {
40042             return equals[k2] === tags[k2];
40043           });
40044         };
40045       },
40046       notEquals: function(notEquals) {
40047         return function(tags) {
40048           return Object.keys(notEquals).some(function(k2) {
40049             return notEquals[k2] !== tags[k2];
40050           });
40051         };
40052       },
40053       absence: function(absence) {
40054         return function(tags) {
40055           return Object.keys(tags).indexOf(absence) === -1;
40056         };
40057       },
40058       presence: function(presence) {
40059         return function(tags) {
40060           return Object.keys(tags).indexOf(presence) > -1;
40061         };
40062       },
40063       greaterThan: function(greaterThan) {
40064         var key = Object.keys(greaterThan)[0];
40065         var value = greaterThan[key];
40066         return function(tags) {
40067           return tags[key] > value;
40068         };
40069       },
40070       greaterThanEqual: function(greaterThanEqual) {
40071         var key = Object.keys(greaterThanEqual)[0];
40072         var value = greaterThanEqual[key];
40073         return function(tags) {
40074           return tags[key] >= value;
40075         };
40076       },
40077       lessThan: function(lessThan) {
40078         var key = Object.keys(lessThan)[0];
40079         var value = lessThan[key];
40080         return function(tags) {
40081           return tags[key] < value;
40082         };
40083       },
40084       lessThanEqual: function(lessThanEqual) {
40085         var key = Object.keys(lessThanEqual)[0];
40086         var value = lessThanEqual[key];
40087         return function(tags) {
40088           return tags[key] <= value;
40089         };
40090       },
40091       positiveRegex: function(positiveRegex) {
40092         var tagKey = Object.keys(positiveRegex)[0];
40093         var expression = positiveRegex[tagKey].join("|");
40094         var regex = new RegExp(expression);
40095         return function(tags) {
40096           return regex.test(tags[tagKey]);
40097         };
40098       },
40099       negativeRegex: function(negativeRegex) {
40100         var tagKey = Object.keys(negativeRegex)[0];
40101         var expression = negativeRegex[tagKey].join("|");
40102         var regex = new RegExp(expression);
40103         return function(tags) {
40104           return !regex.test(tags[tagKey]);
40105         };
40106       }
40107     };
40108   };
40109   var buildLineKeys = function() {
40110     return {
40111       highway: {
40112         rest_area: true,
40113         services: true
40114       },
40115       railway: {
40116         roundhouse: true,
40117         station: true,
40118         traverser: true,
40119         turntable: true,
40120         wash: true
40121       }
40122     };
40123   };
40124   var maprules_default = {
40125     init: function() {
40126       this._ruleChecks = buildRuleChecks();
40127       this._validationRules = [];
40128       this._areaKeys = osmAreaKeys;
40129       this._lineKeys = buildLineKeys();
40130     },
40131     // list of rules only relevant to tag checks...
40132     filterRuleChecks: function(selector) {
40133       var _ruleChecks = this._ruleChecks;
40134       return Object.keys(selector).reduce(function(rules, key) {
40135         if (["geometry", "error", "warning"].indexOf(key) === -1) {
40136           rules.push(_ruleChecks[key](selector[key]));
40137         }
40138         return rules;
40139       }, []);
40140     },
40141     // builds tagMap from mapcss-parse selector object...
40142     buildTagMap: function(selector) {
40143       var getRegexValues = function(regexes) {
40144         return regexes.map(function(regex) {
40145           return regex.replace(/\$|\^/g, "");
40146         });
40147       };
40148       var tagMap = Object.keys(selector).reduce(function(expectedTags, key) {
40149         var values;
40150         var isRegex = /regex/gi.test(key);
40151         var isEqual4 = /equals/gi.test(key);
40152         if (isRegex || isEqual4) {
40153           Object.keys(selector[key]).forEach(function(selectorKey) {
40154             values = isEqual4 ? [selector[key][selectorKey]] : getRegexValues(selector[key][selectorKey]);
40155             if (expectedTags.hasOwnProperty(selectorKey)) {
40156               values = values.concat(expectedTags[selectorKey]);
40157             }
40158             expectedTags[selectorKey] = values;
40159           });
40160         } else if (/(greater|less)Than(Equal)?|presence/g.test(key)) {
40161           var tagKey = /presence/.test(key) ? selector[key] : Object.keys(selector[key])[0];
40162           values = [selector[key][tagKey]];
40163           if (expectedTags.hasOwnProperty(tagKey)) {
40164             values = values.concat(expectedTags[tagKey]);
40165           }
40166           expectedTags[tagKey] = values;
40167         }
40168         return expectedTags;
40169       }, {});
40170       return tagMap;
40171     },
40172     // inspired by osmWay#isArea()
40173     inferGeometry: function(tagMap) {
40174       var _lineKeys = this._lineKeys;
40175       var _areaKeys = this._areaKeys;
40176       var keyValueDoesNotImplyArea = function(key2) {
40177         return utilArrayIntersection(tagMap[key2], Object.keys(_areaKeys[key2])).length > 0;
40178       };
40179       var keyValueImpliesLine = function(key2) {
40180         return utilArrayIntersection(tagMap[key2], Object.keys(_lineKeys[key2])).length > 0;
40181       };
40182       if (tagMap.hasOwnProperty("area")) {
40183         if (tagMap.area.indexOf("yes") > -1) {
40184           return "area";
40185         }
40186         if (tagMap.area.indexOf("no") > -1) {
40187           return "line";
40188         }
40189       }
40190       for (var key in tagMap) {
40191         if (key in _areaKeys && !keyValueDoesNotImplyArea(key)) {
40192           return "area";
40193         }
40194         if (key in _lineKeys && keyValueImpliesLine(key)) {
40195           return "area";
40196         }
40197       }
40198       return "line";
40199     },
40200     // adds from mapcss-parse selector check...
40201     addRule: function(selector) {
40202       var rule = {
40203         // checks relevant to mapcss-selector
40204         checks: this.filterRuleChecks(selector),
40205         // true if all conditions for a tag error are true..
40206         matches: function(entity) {
40207           return this.checks.every(function(check) {
40208             return check(entity.tags);
40209           });
40210         },
40211         // borrowed from Way#isArea()
40212         inferredGeometry: this.inferGeometry(this.buildTagMap(selector), this._areaKeys),
40213         geometryMatches: function(entity, graph) {
40214           if (entity.type === "node" || entity.type === "relation") {
40215             return selector.geometry === entity.type;
40216           } else if (entity.type === "way") {
40217             return this.inferredGeometry === entity.geometry(graph);
40218           }
40219         },
40220         // when geometries match and tag matches are present, return a warning...
40221         findIssues: function(entity, graph, issues) {
40222           if (this.geometryMatches(entity, graph) && this.matches(entity)) {
40223             var severity = Object.keys(selector).indexOf("error") > -1 ? "error" : "warning";
40224             var message = selector[severity];
40225             issues.push(new validationIssue({
40226               type: "maprules",
40227               severity,
40228               message: function() {
40229                 return message;
40230               },
40231               entityIds: [entity.id]
40232             }));
40233           }
40234         }
40235       };
40236       this._validationRules.push(rule);
40237     },
40238     clearRules: function() {
40239       this._validationRules = [];
40240     },
40241     // returns validationRules...
40242     validationRules: function() {
40243       return this._validationRules;
40244     },
40245     // returns ruleChecks
40246     ruleChecks: function() {
40247       return this._ruleChecks;
40248     }
40249   };
40250
40251   // modules/services/nominatim.js
40252   var import_rbush7 = __toESM(require_rbush_min());
40253
40254   // modules/core/difference.js
40255   var import_fast_deep_equal3 = __toESM(require_fast_deep_equal());
40256   function coreDifference(base, head) {
40257     var _changes = {};
40258     var _didChange = {};
40259     var _diff = {};
40260     function checkEntityID(id2) {
40261       var h2 = head.entities[id2];
40262       var b2 = base.entities[id2];
40263       if (h2 === b2)
40264         return;
40265       if (_changes[id2])
40266         return;
40267       if (!h2 && b2) {
40268         _changes[id2] = { base: b2, head: h2 };
40269         _didChange.deletion = true;
40270         return;
40271       }
40272       if (h2 && !b2) {
40273         _changes[id2] = { base: b2, head: h2 };
40274         _didChange.addition = true;
40275         return;
40276       }
40277       if (h2 && b2) {
40278         if (h2.members && b2.members && !(0, import_fast_deep_equal3.default)(h2.members, b2.members)) {
40279           _changes[id2] = { base: b2, head: h2 };
40280           _didChange.geometry = true;
40281           _didChange.properties = true;
40282           return;
40283         }
40284         if (h2.loc && b2.loc && !geoVecEqual(h2.loc, b2.loc)) {
40285           _changes[id2] = { base: b2, head: h2 };
40286           _didChange.geometry = true;
40287         }
40288         if (h2.nodes && b2.nodes && !(0, import_fast_deep_equal3.default)(h2.nodes, b2.nodes)) {
40289           _changes[id2] = { base: b2, head: h2 };
40290           _didChange.geometry = true;
40291         }
40292         if (h2.tags && b2.tags && !(0, import_fast_deep_equal3.default)(h2.tags, b2.tags)) {
40293           _changes[id2] = { base: b2, head: h2 };
40294           _didChange.properties = true;
40295         }
40296       }
40297     }
40298     function load() {
40299       var ids = utilArrayUniq(Object.keys(head.entities).concat(Object.keys(base.entities)));
40300       for (var i3 = 0; i3 < ids.length; i3++) {
40301         checkEntityID(ids[i3]);
40302       }
40303     }
40304     load();
40305     _diff.length = function length() {
40306       return Object.keys(_changes).length;
40307     };
40308     _diff.changes = function changes() {
40309       return _changes;
40310     };
40311     _diff.didChange = _didChange;
40312     _diff.extantIDs = function extantIDs(includeRelMembers) {
40313       var result = /* @__PURE__ */ new Set();
40314       Object.keys(_changes).forEach(function(id2) {
40315         if (_changes[id2].head) {
40316           result.add(id2);
40317         }
40318         var h2 = _changes[id2].head;
40319         var b2 = _changes[id2].base;
40320         var entity = h2 || b2;
40321         if (includeRelMembers && entity.type === "relation") {
40322           var mh = h2 ? h2.members.map(function(m2) {
40323             return m2.id;
40324           }) : [];
40325           var mb = b2 ? b2.members.map(function(m2) {
40326             return m2.id;
40327           }) : [];
40328           utilArrayUnion(mh, mb).forEach(function(memberID) {
40329             if (head.hasEntity(memberID)) {
40330               result.add(memberID);
40331             }
40332           });
40333         }
40334       });
40335       return Array.from(result);
40336     };
40337     _diff.modified = function modified() {
40338       var result = [];
40339       Object.values(_changes).forEach(function(change) {
40340         if (change.base && change.head) {
40341           result.push(change.head);
40342         }
40343       });
40344       return result;
40345     };
40346     _diff.created = function created() {
40347       var result = [];
40348       Object.values(_changes).forEach(function(change) {
40349         if (!change.base && change.head) {
40350           result.push(change.head);
40351         }
40352       });
40353       return result;
40354     };
40355     _diff.deleted = function deleted() {
40356       var result = [];
40357       Object.values(_changes).forEach(function(change) {
40358         if (change.base && !change.head) {
40359           result.push(change.base);
40360         }
40361       });
40362       return result;
40363     };
40364     _diff.summary = function summary() {
40365       var relevant = {};
40366       var keys2 = Object.keys(_changes);
40367       for (var i3 = 0; i3 < keys2.length; i3++) {
40368         var change = _changes[keys2[i3]];
40369         if (change.head && change.head.geometry(head) !== "vertex") {
40370           addEntity(change.head, head, change.base ? "modified" : "created");
40371         } else if (change.base && change.base.geometry(base) !== "vertex") {
40372           addEntity(change.base, base, "deleted");
40373         } else if (change.base && change.head) {
40374           var moved = !(0, import_fast_deep_equal3.default)(change.base.loc, change.head.loc);
40375           var retagged = !(0, import_fast_deep_equal3.default)(change.base.tags, change.head.tags);
40376           if (moved) {
40377             addParents(change.head);
40378           }
40379           if (retagged || moved && change.head.hasInterestingTags()) {
40380             addEntity(change.head, head, "modified");
40381           }
40382         } else if (change.head && change.head.hasInterestingTags()) {
40383           addEntity(change.head, head, "created");
40384         } else if (change.base && change.base.hasInterestingTags()) {
40385           addEntity(change.base, base, "deleted");
40386         }
40387       }
40388       return Object.values(relevant);
40389       function addEntity(entity, graph, changeType) {
40390         relevant[entity.id] = {
40391           entity,
40392           graph,
40393           changeType
40394         };
40395       }
40396       function addParents(entity) {
40397         var parents = head.parentWays(entity);
40398         for (var j3 = parents.length - 1; j3 >= 0; j3--) {
40399           var parent = parents[j3];
40400           if (!(parent.id in relevant)) {
40401             addEntity(parent, head, "modified");
40402           }
40403         }
40404       }
40405     };
40406     _diff.complete = function complete(extent) {
40407       var result = {};
40408       var id2, change;
40409       for (id2 in _changes) {
40410         change = _changes[id2];
40411         var h2 = change.head;
40412         var b2 = change.base;
40413         var entity = h2 || b2;
40414         var i3;
40415         if (extent && (!h2 || !h2.intersects(extent, head)) && (!b2 || !b2.intersects(extent, base))) {
40416           continue;
40417         }
40418         result[id2] = h2;
40419         if (entity.type === "way") {
40420           var nh = h2 ? h2.nodes : [];
40421           var nb = b2 ? b2.nodes : [];
40422           var diff;
40423           diff = utilArrayDifference(nh, nb);
40424           for (i3 = 0; i3 < diff.length; i3++) {
40425             result[diff[i3]] = head.hasEntity(diff[i3]);
40426           }
40427           diff = utilArrayDifference(nb, nh);
40428           for (i3 = 0; i3 < diff.length; i3++) {
40429             result[diff[i3]] = head.hasEntity(diff[i3]);
40430           }
40431         }
40432         if (entity.type === "relation" && entity.isMultipolygon()) {
40433           var mh = h2 ? h2.members.map(function(m2) {
40434             return m2.id;
40435           }) : [];
40436           var mb = b2 ? b2.members.map(function(m2) {
40437             return m2.id;
40438           }) : [];
40439           var ids = utilArrayUnion(mh, mb);
40440           for (i3 = 0; i3 < ids.length; i3++) {
40441             var member = head.hasEntity(ids[i3]);
40442             if (!member)
40443               continue;
40444             if (extent && !member.intersects(extent, head))
40445               continue;
40446             result[ids[i3]] = member;
40447           }
40448         }
40449         addParents(head.parentWays(entity), result);
40450         addParents(head.parentRelations(entity), result);
40451       }
40452       return result;
40453       function addParents(parents, result2) {
40454         for (var i4 = 0; i4 < parents.length; i4++) {
40455           var parent = parents[i4];
40456           if (parent.id in result2)
40457             continue;
40458           result2[parent.id] = parent;
40459           addParents(head.parentRelations(parent), result2);
40460         }
40461       }
40462     };
40463     return _diff;
40464   }
40465
40466   // modules/core/tree.js
40467   var import_rbush5 = __toESM(require_rbush_min());
40468   function coreTree(head) {
40469     var _rtree = new import_rbush5.default();
40470     var _bboxes = {};
40471     var _segmentsRTree = new import_rbush5.default();
40472     var _segmentsBBoxes = {};
40473     var _segmentsByWayId = {};
40474     var tree = {};
40475     function entityBBox(entity) {
40476       var bbox2 = entity.extent(head).bbox();
40477       bbox2.id = entity.id;
40478       _bboxes[entity.id] = bbox2;
40479       return bbox2;
40480     }
40481     function segmentBBox(segment) {
40482       var extent = segment.extent(head);
40483       if (!extent)
40484         return null;
40485       var bbox2 = extent.bbox();
40486       bbox2.segment = segment;
40487       _segmentsBBoxes[segment.id] = bbox2;
40488       return bbox2;
40489     }
40490     function removeEntity(entity) {
40491       _rtree.remove(_bboxes[entity.id]);
40492       delete _bboxes[entity.id];
40493       if (_segmentsByWayId[entity.id]) {
40494         _segmentsByWayId[entity.id].forEach(function(segment) {
40495           _segmentsRTree.remove(_segmentsBBoxes[segment.id]);
40496           delete _segmentsBBoxes[segment.id];
40497         });
40498         delete _segmentsByWayId[entity.id];
40499       }
40500     }
40501     function loadEntities(entities) {
40502       _rtree.load(entities.map(entityBBox));
40503       var segments = [];
40504       entities.forEach(function(entity) {
40505         if (entity.segments) {
40506           var entitySegments = entity.segments(head);
40507           _segmentsByWayId[entity.id] = entitySegments;
40508           segments = segments.concat(entitySegments);
40509         }
40510       });
40511       if (segments.length)
40512         _segmentsRTree.load(segments.map(segmentBBox).filter(Boolean));
40513     }
40514     function updateParents(entity, insertions, memo) {
40515       head.parentWays(entity).forEach(function(way) {
40516         if (_bboxes[way.id]) {
40517           removeEntity(way);
40518           insertions[way.id] = way;
40519         }
40520         updateParents(way, insertions, memo);
40521       });
40522       head.parentRelations(entity).forEach(function(relation) {
40523         if (memo[entity.id])
40524           return;
40525         memo[entity.id] = true;
40526         if (_bboxes[relation.id]) {
40527           removeEntity(relation);
40528           insertions[relation.id] = relation;
40529         }
40530         updateParents(relation, insertions, memo);
40531       });
40532     }
40533     tree.rebase = function(entities, force) {
40534       var insertions = {};
40535       for (var i3 = 0; i3 < entities.length; i3++) {
40536         var entity = entities[i3];
40537         if (!entity.visible)
40538           continue;
40539         if (head.entities.hasOwnProperty(entity.id) || _bboxes[entity.id]) {
40540           if (!force) {
40541             continue;
40542           } else if (_bboxes[entity.id]) {
40543             removeEntity(entity);
40544           }
40545         }
40546         insertions[entity.id] = entity;
40547         updateParents(entity, insertions, {});
40548       }
40549       loadEntities(Object.values(insertions));
40550       return tree;
40551     };
40552     function updateToGraph(graph) {
40553       if (graph === head)
40554         return;
40555       var diff = coreDifference(head, graph);
40556       head = graph;
40557       var changed = diff.didChange;
40558       if (!changed.addition && !changed.deletion && !changed.geometry)
40559         return;
40560       var insertions = {};
40561       if (changed.deletion) {
40562         diff.deleted().forEach(function(entity) {
40563           removeEntity(entity);
40564         });
40565       }
40566       if (changed.geometry) {
40567         diff.modified().forEach(function(entity) {
40568           removeEntity(entity);
40569           insertions[entity.id] = entity;
40570           updateParents(entity, insertions, {});
40571         });
40572       }
40573       if (changed.addition) {
40574         diff.created().forEach(function(entity) {
40575           insertions[entity.id] = entity;
40576         });
40577       }
40578       loadEntities(Object.values(insertions));
40579     }
40580     tree.intersects = function(extent, graph) {
40581       updateToGraph(graph);
40582       return _rtree.search(extent.bbox()).map(function(bbox2) {
40583         return graph.entity(bbox2.id);
40584       });
40585     };
40586     tree.waySegments = function(extent, graph) {
40587       updateToGraph(graph);
40588       return _segmentsRTree.search(extent.bbox()).map(function(bbox2) {
40589         return bbox2.segment;
40590       });
40591     };
40592     return tree;
40593   }
40594
40595   // modules/svg/icon.js
40596   function svgIcon(name, svgklass, useklass) {
40597     return function drawIcon(selection2) {
40598       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);
40599     };
40600   }
40601
40602   // modules/ui/modal.js
40603   function uiModal(selection2, blocking) {
40604     let keybinding = utilKeybinding("modal");
40605     let previous = selection2.select("div.modal");
40606     let animate = previous.empty();
40607     previous.transition().duration(200).style("opacity", 0).remove();
40608     let shaded = selection2.append("div").attr("class", "shaded").style("opacity", 0);
40609     shaded.close = () => {
40610       shaded.transition().duration(200).style("opacity", 0).remove();
40611       modal.transition().duration(200).style("top", "0px");
40612       select_default2(document).call(keybinding.unbind);
40613     };
40614     let modal = shaded.append("div").attr("class", "modal fillL");
40615     modal.append("input").attr("class", "keytrap keytrap-first").on("focus.keytrap", moveFocusToLast);
40616     if (!blocking) {
40617       shaded.on("click.remove-modal", (d3_event) => {
40618         if (d3_event.target === this) {
40619           shaded.close();
40620         }
40621       });
40622       modal.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", shaded.close).call(svgIcon("#iD-icon-close"));
40623       keybinding.on("\u232B", shaded.close).on("\u238B", shaded.close);
40624       select_default2(document).call(keybinding);
40625     }
40626     modal.append("div").attr("class", "content");
40627     modal.append("input").attr("class", "keytrap keytrap-last").on("focus.keytrap", moveFocusToFirst);
40628     if (animate) {
40629       shaded.transition().style("opacity", 1);
40630     } else {
40631       shaded.style("opacity", 1);
40632     }
40633     return shaded;
40634     function moveFocusToFirst() {
40635       let node = modal.select("a, button, input:not(.keytrap), select, textarea").node();
40636       if (node) {
40637         node.focus();
40638       } else {
40639         select_default2(this).node().blur();
40640       }
40641     }
40642     function moveFocusToLast() {
40643       let nodes = modal.selectAll("a, button, input:not(.keytrap), select, textarea").nodes();
40644       if (nodes.length) {
40645         nodes[nodes.length - 1].focus();
40646       } else {
40647         select_default2(this).node().blur();
40648       }
40649     }
40650   }
40651
40652   // modules/ui/loading.js
40653   function uiLoading(context) {
40654     let _modalSelection = select_default2(null);
40655     let _message = "";
40656     let _blocking = false;
40657     let loading = (selection2) => {
40658       _modalSelection = uiModal(selection2, _blocking);
40659       let loadertext = _modalSelection.select(".content").classed("loading-modal", true).append("div").attr("class", "modal-section fillL");
40660       loadertext.append("img").attr("class", "loader").attr("src", context.imagePath("loader-white.gif"));
40661       loadertext.append("h3").html(_message);
40662       _modalSelection.select("button.close").attr("class", "hide");
40663       return loading;
40664     };
40665     loading.message = function(val) {
40666       if (!arguments.length)
40667         return _message;
40668       _message = val;
40669       return loading;
40670     };
40671     loading.blocking = function(val) {
40672       if (!arguments.length)
40673         return _blocking;
40674       _blocking = val;
40675       return loading;
40676     };
40677     loading.close = () => {
40678       _modalSelection.remove();
40679     };
40680     loading.isShown = () => {
40681       return _modalSelection && !_modalSelection.empty() && _modalSelection.node().parentNode;
40682     };
40683     return loading;
40684   }
40685
40686   // modules/core/history.js
40687   function coreHistory(context) {
40688     var dispatch14 = dispatch_default("reset", "change", "merge", "restore", "undone", "redone", "storage_error");
40689     var lock = utilSessionMutex("lock");
40690     var _hasUnresolvedRestorableChanges = lock.lock() && !!corePreferences(getKey("saved_history"));
40691     var duration = 150;
40692     var _imageryUsed = [];
40693     var _photoOverlaysUsed = [];
40694     var _checkpoints = {};
40695     var _pausedGraph;
40696     var _stack;
40697     var _index;
40698     var _tree;
40699     function _act(actions, t2) {
40700       actions = Array.prototype.slice.call(actions);
40701       var annotation;
40702       if (typeof actions[actions.length - 1] !== "function") {
40703         annotation = actions.pop();
40704       }
40705       var graph = _stack[_index].graph;
40706       for (var i3 = 0; i3 < actions.length; i3++) {
40707         graph = actions[i3](graph, t2);
40708       }
40709       return {
40710         graph,
40711         annotation,
40712         imageryUsed: _imageryUsed,
40713         photoOverlaysUsed: _photoOverlaysUsed,
40714         transform: context.projection.transform(),
40715         selectedIDs: context.selectedIDs()
40716       };
40717     }
40718     function _perform(args, t2) {
40719       var previous = _stack[_index].graph;
40720       _stack = _stack.slice(0, _index + 1);
40721       var actionResult = _act(args, t2);
40722       _stack.push(actionResult);
40723       _index++;
40724       return change(previous);
40725     }
40726     function _replace(args, t2) {
40727       var previous = _stack[_index].graph;
40728       var actionResult = _act(args, t2);
40729       _stack[_index] = actionResult;
40730       return change(previous);
40731     }
40732     function _overwrite(args, t2) {
40733       var previous = _stack[_index].graph;
40734       if (_index > 0) {
40735         _index--;
40736         _stack.pop();
40737       }
40738       _stack = _stack.slice(0, _index + 1);
40739       var actionResult = _act(args, t2);
40740       _stack.push(actionResult);
40741       _index++;
40742       return change(previous);
40743     }
40744     function change(previous) {
40745       var difference = coreDifference(previous, history.graph());
40746       if (!_pausedGraph) {
40747         dispatch14.call("change", this, difference);
40748       }
40749       return difference;
40750     }
40751     function getKey(n3) {
40752       return "iD_" + window.location.origin + "_" + n3;
40753     }
40754     var history = {
40755       graph: function() {
40756         return _stack[_index].graph;
40757       },
40758       tree: function() {
40759         return _tree;
40760       },
40761       base: function() {
40762         return _stack[0].graph;
40763       },
40764       merge: function(entities) {
40765         var stack = _stack.map(function(state) {
40766           return state.graph;
40767         });
40768         _stack[0].graph.rebase(entities, stack, false);
40769         _tree.rebase(entities, false);
40770         dispatch14.call("merge", this, entities);
40771       },
40772       perform: function() {
40773         select_default2(document).interrupt("history.perform");
40774         var transitionable = false;
40775         var action0 = arguments[0];
40776         if (arguments.length === 1 || arguments.length === 2 && typeof arguments[1] !== "function") {
40777           transitionable = !!action0.transitionable;
40778         }
40779         if (transitionable) {
40780           var origArguments = arguments;
40781           select_default2(document).transition("history.perform").duration(duration).ease(linear2).tween("history.tween", function() {
40782             return function(t2) {
40783               if (t2 < 1)
40784                 _overwrite([action0], t2);
40785             };
40786           }).on("start", function() {
40787             _perform([action0], 0);
40788           }).on("end interrupt", function() {
40789             _overwrite(origArguments, 1);
40790           });
40791         } else {
40792           return _perform(arguments);
40793         }
40794       },
40795       replace: function() {
40796         select_default2(document).interrupt("history.perform");
40797         return _replace(arguments, 1);
40798       },
40799       // Same as calling pop and then perform
40800       overwrite: function() {
40801         select_default2(document).interrupt("history.perform");
40802         return _overwrite(arguments, 1);
40803       },
40804       pop: function(n3) {
40805         select_default2(document).interrupt("history.perform");
40806         var previous = _stack[_index].graph;
40807         if (isNaN(+n3) || +n3 < 0) {
40808           n3 = 1;
40809         }
40810         while (n3-- > 0 && _index > 0) {
40811           _index--;
40812           _stack.pop();
40813         }
40814         return change(previous);
40815       },
40816       // Back to the previous annotated state or _index = 0.
40817       undo: function() {
40818         select_default2(document).interrupt("history.perform");
40819         var previousStack = _stack[_index];
40820         var previous = previousStack.graph;
40821         while (_index > 0) {
40822           _index--;
40823           if (_stack[_index].annotation)
40824             break;
40825         }
40826         dispatch14.call("undone", this, _stack[_index], previousStack);
40827         return change(previous);
40828       },
40829       // Forward to the next annotated state.
40830       redo: function() {
40831         select_default2(document).interrupt("history.perform");
40832         var previousStack = _stack[_index];
40833         var previous = previousStack.graph;
40834         var tryIndex = _index;
40835         while (tryIndex < _stack.length - 1) {
40836           tryIndex++;
40837           if (_stack[tryIndex].annotation) {
40838             _index = tryIndex;
40839             dispatch14.call("redone", this, _stack[_index], previousStack);
40840             break;
40841           }
40842         }
40843         return change(previous);
40844       },
40845       pauseChangeDispatch: function() {
40846         if (!_pausedGraph) {
40847           _pausedGraph = _stack[_index].graph;
40848         }
40849       },
40850       resumeChangeDispatch: function() {
40851         if (_pausedGraph) {
40852           var previous = _pausedGraph;
40853           _pausedGraph = null;
40854           return change(previous);
40855         }
40856       },
40857       undoAnnotation: function() {
40858         var i3 = _index;
40859         while (i3 >= 0) {
40860           if (_stack[i3].annotation)
40861             return _stack[i3].annotation;
40862           i3--;
40863         }
40864       },
40865       redoAnnotation: function() {
40866         var i3 = _index + 1;
40867         while (i3 <= _stack.length - 1) {
40868           if (_stack[i3].annotation)
40869             return _stack[i3].annotation;
40870           i3++;
40871         }
40872       },
40873       // Returns the entities from the active graph with bounding boxes
40874       // overlapping the given `extent`.
40875       intersects: function(extent) {
40876         return _tree.intersects(extent, _stack[_index].graph);
40877       },
40878       difference: function() {
40879         var base = _stack[0].graph;
40880         var head = _stack[_index].graph;
40881         return coreDifference(base, head);
40882       },
40883       changes: function(action) {
40884         var base = _stack[0].graph;
40885         var head = _stack[_index].graph;
40886         if (action) {
40887           head = action(head);
40888         }
40889         var difference = coreDifference(base, head);
40890         return {
40891           modified: difference.modified(),
40892           created: difference.created(),
40893           deleted: difference.deleted()
40894         };
40895       },
40896       hasChanges: function() {
40897         return this.difference().length() > 0;
40898       },
40899       imageryUsed: function(sources) {
40900         if (sources) {
40901           _imageryUsed = sources;
40902           return history;
40903         } else {
40904           var s2 = /* @__PURE__ */ new Set();
40905           _stack.slice(1, _index + 1).forEach(function(state) {
40906             state.imageryUsed.forEach(function(source) {
40907               if (source !== "Custom") {
40908                 s2.add(source);
40909               }
40910             });
40911           });
40912           return Array.from(s2);
40913         }
40914       },
40915       photoOverlaysUsed: function(sources) {
40916         if (sources) {
40917           _photoOverlaysUsed = sources;
40918           return history;
40919         } else {
40920           var s2 = /* @__PURE__ */ new Set();
40921           _stack.slice(1, _index + 1).forEach(function(state) {
40922             if (state.photoOverlaysUsed && Array.isArray(state.photoOverlaysUsed)) {
40923               state.photoOverlaysUsed.forEach(function(photoOverlay) {
40924                 s2.add(photoOverlay);
40925               });
40926             }
40927           });
40928           return Array.from(s2);
40929         }
40930       },
40931       // save the current history state
40932       checkpoint: function(key) {
40933         _checkpoints[key] = {
40934           stack: _stack,
40935           index: _index
40936         };
40937         return history;
40938       },
40939       // restore history state to a given checkpoint or reset completely
40940       reset: function(key) {
40941         if (key !== void 0 && _checkpoints.hasOwnProperty(key)) {
40942           _stack = _checkpoints[key].stack;
40943           _index = _checkpoints[key].index;
40944         } else {
40945           _stack = [{ graph: coreGraph() }];
40946           _index = 0;
40947           _tree = coreTree(_stack[0].graph);
40948           _checkpoints = {};
40949         }
40950         dispatch14.call("reset");
40951         dispatch14.call("change");
40952         return history;
40953       },
40954       // `toIntroGraph()` is used to export the intro graph used by the walkthrough.
40955       //
40956       // To use it:
40957       //  1. Start the walkthrough.
40958       //  2. Get to a "free editing" tutorial step
40959       //  3. Make your edits to the walkthrough map
40960       //  4. In your browser dev console run:
40961       //        `id.history().toIntroGraph()`
40962       //  5. This outputs stringified JSON to the browser console
40963       //  6. Copy it to `data/intro_graph.json` and prettify it in your code editor
40964       toIntroGraph: function() {
40965         var nextID = { n: 0, r: 0, w: 0 };
40966         var permIDs = {};
40967         var graph = this.graph();
40968         var baseEntities = {};
40969         Object.values(graph.base().entities).forEach(function(entity) {
40970           var copy2 = copyIntroEntity(entity);
40971           baseEntities[copy2.id] = copy2;
40972         });
40973         Object.keys(graph.entities).forEach(function(id2) {
40974           var entity = graph.entities[id2];
40975           if (entity) {
40976             var copy2 = copyIntroEntity(entity);
40977             baseEntities[copy2.id] = copy2;
40978           } else {
40979             delete baseEntities[id2];
40980           }
40981         });
40982         Object.values(baseEntities).forEach(function(entity) {
40983           if (Array.isArray(entity.nodes)) {
40984             entity.nodes = entity.nodes.map(function(node) {
40985               return permIDs[node] || node;
40986             });
40987           }
40988           if (Array.isArray(entity.members)) {
40989             entity.members = entity.members.map(function(member) {
40990               member.id = permIDs[member.id] || member.id;
40991               return member;
40992             });
40993           }
40994         });
40995         return JSON.stringify({ dataIntroGraph: baseEntities });
40996         function copyIntroEntity(source) {
40997           var copy2 = utilObjectOmit(source, ["type", "user", "v", "version", "visible"]);
40998           if (copy2.tags && !Object.keys(copy2.tags)) {
40999             delete copy2.tags;
41000           }
41001           if (Array.isArray(copy2.loc)) {
41002             copy2.loc[0] = +copy2.loc[0].toFixed(6);
41003             copy2.loc[1] = +copy2.loc[1].toFixed(6);
41004           }
41005           var match = source.id.match(/([nrw])-\d*/);
41006           if (match !== null) {
41007             var nrw = match[1];
41008             var permID;
41009             do {
41010               permID = nrw + ++nextID[nrw];
41011             } while (baseEntities.hasOwnProperty(permID));
41012             copy2.id = permIDs[source.id] = permID;
41013           }
41014           return copy2;
41015         }
41016       },
41017       toJSON: function() {
41018         if (!this.hasChanges())
41019           return;
41020         var allEntities = {};
41021         var baseEntities = {};
41022         var base = _stack[0];
41023         var s2 = _stack.map(function(i3) {
41024           var modified = [];
41025           var deleted = [];
41026           Object.keys(i3.graph.entities).forEach(function(id2) {
41027             var entity = i3.graph.entities[id2];
41028             if (entity) {
41029               var key = osmEntity.key(entity);
41030               allEntities[key] = entity;
41031               modified.push(key);
41032             } else {
41033               deleted.push(id2);
41034             }
41035             if (id2 in base.graph.entities) {
41036               baseEntities[id2] = base.graph.entities[id2];
41037             }
41038             if (entity && entity.nodes) {
41039               entity.nodes.forEach(function(nodeID) {
41040                 if (nodeID in base.graph.entities) {
41041                   baseEntities[nodeID] = base.graph.entities[nodeID];
41042                 }
41043               });
41044             }
41045             var baseParents = base.graph._parentWays[id2];
41046             if (baseParents) {
41047               baseParents.forEach(function(parentID) {
41048                 if (parentID in base.graph.entities) {
41049                   baseEntities[parentID] = base.graph.entities[parentID];
41050                 }
41051               });
41052             }
41053           });
41054           var x2 = {};
41055           if (modified.length)
41056             x2.modified = modified;
41057           if (deleted.length)
41058             x2.deleted = deleted;
41059           if (i3.imageryUsed)
41060             x2.imageryUsed = i3.imageryUsed;
41061           if (i3.photoOverlaysUsed)
41062             x2.photoOverlaysUsed = i3.photoOverlaysUsed;
41063           if (i3.annotation)
41064             x2.annotation = i3.annotation;
41065           if (i3.transform)
41066             x2.transform = i3.transform;
41067           if (i3.selectedIDs)
41068             x2.selectedIDs = i3.selectedIDs;
41069           return x2;
41070         });
41071         return JSON.stringify({
41072           version: 3,
41073           entities: Object.values(allEntities),
41074           baseEntities: Object.values(baseEntities),
41075           stack: s2,
41076           nextIDs: osmEntity.id.next,
41077           index: _index,
41078           // note the time the changes were saved
41079           timestamp: (/* @__PURE__ */ new Date()).getTime()
41080         });
41081       },
41082       fromJSON: function(json, loadChildNodes) {
41083         var h2 = JSON.parse(json);
41084         var loadComplete = true;
41085         osmEntity.id.next = h2.nextIDs;
41086         _index = h2.index;
41087         if (h2.version === 2 || h2.version === 3) {
41088           var allEntities = {};
41089           h2.entities.forEach(function(entity) {
41090             allEntities[osmEntity.key(entity)] = osmEntity(entity);
41091           });
41092           if (h2.version === 3) {
41093             var baseEntities = h2.baseEntities.map(function(d2) {
41094               return osmEntity(d2);
41095             });
41096             var stack = _stack.map(function(state) {
41097               return state.graph;
41098             });
41099             _stack[0].graph.rebase(baseEntities, stack, true);
41100             _tree.rebase(baseEntities, true);
41101             if (loadChildNodes) {
41102               var osm = context.connection();
41103               var baseWays = baseEntities.filter(function(e3) {
41104                 return e3.type === "way";
41105               });
41106               var nodeIDs = baseWays.reduce(function(acc, way) {
41107                 return utilArrayUnion(acc, way.nodes);
41108               }, []);
41109               var missing = nodeIDs.filter(function(n3) {
41110                 return !_stack[0].graph.hasEntity(n3);
41111               });
41112               if (missing.length && osm) {
41113                 loadComplete = false;
41114                 context.map().redrawEnable(false);
41115                 var loading = uiLoading(context).blocking(true);
41116                 context.container().call(loading);
41117                 var childNodesLoaded = function(err, result) {
41118                   if (!err) {
41119                     var visibleGroups = utilArrayGroupBy(result.data, "visible");
41120                     var visibles = visibleGroups.true || [];
41121                     var invisibles = visibleGroups.false || [];
41122                     if (visibles.length) {
41123                       var visibleIDs = visibles.map(function(entity) {
41124                         return entity.id;
41125                       });
41126                       var stack2 = _stack.map(function(state) {
41127                         return state.graph;
41128                       });
41129                       missing = utilArrayDifference(missing, visibleIDs);
41130                       _stack[0].graph.rebase(visibles, stack2, true);
41131                       _tree.rebase(visibles, true);
41132                     }
41133                     invisibles.forEach(function(entity) {
41134                       osm.loadEntityVersion(entity.id, +entity.version - 1, childNodesLoaded);
41135                     });
41136                   }
41137                   if (err || !missing.length) {
41138                     loading.close();
41139                     context.map().redrawEnable(true);
41140                     dispatch14.call("change");
41141                     dispatch14.call("restore", this);
41142                   }
41143                 };
41144                 osm.loadMultiple(missing, childNodesLoaded);
41145               }
41146             }
41147           }
41148           _stack = h2.stack.map(function(d2) {
41149             var entities = {}, entity;
41150             if (d2.modified) {
41151               d2.modified.forEach(function(key) {
41152                 entity = allEntities[key];
41153                 entities[entity.id] = entity;
41154               });
41155             }
41156             if (d2.deleted) {
41157               d2.deleted.forEach(function(id2) {
41158                 entities[id2] = void 0;
41159               });
41160             }
41161             return {
41162               graph: coreGraph(_stack[0].graph).load(entities),
41163               annotation: d2.annotation,
41164               imageryUsed: d2.imageryUsed,
41165               photoOverlaysUsed: d2.photoOverlaysUsed,
41166               transform: d2.transform,
41167               selectedIDs: d2.selectedIDs
41168             };
41169           });
41170         } else {
41171           _stack = h2.stack.map(function(d2) {
41172             var entities = {};
41173             for (var i3 in d2.entities) {
41174               var entity = d2.entities[i3];
41175               entities[i3] = entity === "undefined" ? void 0 : osmEntity(entity);
41176             }
41177             d2.graph = coreGraph(_stack[0].graph).load(entities);
41178             return d2;
41179           });
41180         }
41181         var transform2 = _stack[_index].transform;
41182         if (transform2) {
41183           context.map().transformEase(transform2, 0);
41184         }
41185         if (loadComplete) {
41186           dispatch14.call("change");
41187           dispatch14.call("restore", this);
41188         }
41189         return history;
41190       },
41191       lock: function() {
41192         return lock.lock();
41193       },
41194       unlock: function() {
41195         lock.unlock();
41196       },
41197       save: function() {
41198         if (lock.locked() && // don't overwrite existing, unresolved changes
41199         !_hasUnresolvedRestorableChanges) {
41200           const success = corePreferences(getKey("saved_history"), history.toJSON() || null);
41201           if (!success)
41202             dispatch14.call("storage_error");
41203         }
41204         return history;
41205       },
41206       // delete the history version saved in localStorage
41207       clearSaved: function() {
41208         context.debouncedSave.cancel();
41209         if (lock.locked()) {
41210           _hasUnresolvedRestorableChanges = false;
41211           corePreferences(getKey("saved_history"), null);
41212           corePreferences("comment", null);
41213           corePreferences("hashtags", null);
41214           corePreferences("source", null);
41215         }
41216         return history;
41217       },
41218       savedHistoryJSON: function() {
41219         return corePreferences(getKey("saved_history"));
41220       },
41221       hasRestorableChanges: function() {
41222         return _hasUnresolvedRestorableChanges;
41223       },
41224       // load history from a version stored in localStorage
41225       restore: function() {
41226         if (lock.locked()) {
41227           _hasUnresolvedRestorableChanges = false;
41228           var json = this.savedHistoryJSON();
41229           if (json)
41230             history.fromJSON(json, true);
41231         }
41232       },
41233       _getKey: getKey
41234     };
41235     history.reset();
41236     return utilRebind(history, dispatch14, "on");
41237   }
41238
41239   // modules/validations/index.js
41240   var validations_exports = {};
41241   __export(validations_exports, {
41242     validationAlmostJunction: () => validationAlmostJunction,
41243     validationCloseNodes: () => validationCloseNodes,
41244     validationCrossingWays: () => validationCrossingWays,
41245     validationDisconnectedWay: () => validationDisconnectedWay,
41246     validationFormatting: () => validationFormatting,
41247     validationHelpRequest: () => validationHelpRequest,
41248     validationImpossibleOneway: () => validationImpossibleOneway,
41249     validationIncompatibleSource: () => validationIncompatibleSource,
41250     validationMaprules: () => validationMaprules,
41251     validationMismatchedGeometry: () => validationMismatchedGeometry,
41252     validationMissingRole: () => validationMissingRole,
41253     validationMissingTag: () => validationMissingTag,
41254     validationOutdatedTags: () => validationOutdatedTags,
41255     validationPrivateData: () => validationPrivateData,
41256     validationSuspiciousName: () => validationSuspiciousName,
41257     validationUnsquareWay: () => validationUnsquareWay
41258   });
41259
41260   // modules/validations/almost_junction.js
41261   function validationAlmostJunction(context) {
41262     const type2 = "almost_junction";
41263     const EXTEND_TH_METERS = 5;
41264     const WELD_TH_METERS = 0.75;
41265     const CLOSE_NODE_TH = EXTEND_TH_METERS - WELD_TH_METERS;
41266     const SIG_ANGLE_TH = Math.atan(WELD_TH_METERS / EXTEND_TH_METERS);
41267     function isHighway(entity) {
41268       return entity.type === "way" && osmRoutableHighwayTagValues[entity.tags.highway];
41269     }
41270     function isTaggedAsNotContinuing(node) {
41271       return node.tags.noexit === "yes" || node.tags.amenity === "parking_entrance" || node.tags.entrance && node.tags.entrance !== "no";
41272     }
41273     const validation = function checkAlmostJunction(entity, graph) {
41274       if (!isHighway(entity))
41275         return [];
41276       if (entity.isDegenerate())
41277         return [];
41278       const tree = context.history().tree();
41279       const extendableNodeInfos = findConnectableEndNodesByExtension(entity);
41280       let issues = [];
41281       extendableNodeInfos.forEach((extendableNodeInfo) => {
41282         issues.push(new validationIssue({
41283           type: type2,
41284           subtype: "highway-highway",
41285           severity: "warning",
41286           message: function(context2) {
41287             const entity1 = context2.hasEntity(this.entityIds[0]);
41288             if (this.entityIds[0] === this.entityIds[2]) {
41289               return entity1 ? _t.append("issues.almost_junction.self.message", {
41290                 feature: utilDisplayLabel(entity1, context2.graph())
41291               }) : "";
41292             } else {
41293               const entity2 = context2.hasEntity(this.entityIds[2]);
41294               return entity1 && entity2 ? _t.append("issues.almost_junction.message", {
41295                 feature: utilDisplayLabel(entity1, context2.graph()),
41296                 feature2: utilDisplayLabel(entity2, context2.graph())
41297               }) : "";
41298             }
41299           },
41300           reference: showReference,
41301           entityIds: [
41302             entity.id,
41303             extendableNodeInfo.node.id,
41304             extendableNodeInfo.wid
41305           ],
41306           loc: extendableNodeInfo.node.loc,
41307           hash: JSON.stringify(extendableNodeInfo.node.loc),
41308           data: {
41309             midId: extendableNodeInfo.mid.id,
41310             edge: extendableNodeInfo.edge,
41311             cross_loc: extendableNodeInfo.cross_loc
41312           },
41313           dynamicFixes: makeFixes
41314         }));
41315       });
41316       return issues;
41317       function makeFixes(context2) {
41318         let fixes = [new validationIssueFix({
41319           icon: "iD-icon-abutment",
41320           title: _t.append("issues.fix.connect_features.title"),
41321           onClick: function(context3) {
41322             const annotation = _t("issues.fix.connect_almost_junction.annotation");
41323             const [, endNodeId, crossWayId] = this.issue.entityIds;
41324             const midNode = context3.entity(this.issue.data.midId);
41325             const endNode = context3.entity(endNodeId);
41326             const crossWay = context3.entity(crossWayId);
41327             const nearEndNodes = findNearbyEndNodes(endNode, crossWay);
41328             if (nearEndNodes.length > 0) {
41329               const collinear = findSmallJoinAngle(midNode, endNode, nearEndNodes);
41330               if (collinear) {
41331                 context3.perform(
41332                   actionMergeNodes([collinear.id, endNode.id], collinear.loc),
41333                   annotation
41334                 );
41335                 return;
41336               }
41337             }
41338             const targetEdge = this.issue.data.edge;
41339             const crossLoc = this.issue.data.cross_loc;
41340             const edgeNodes = [context3.entity(targetEdge[0]), context3.entity(targetEdge[1])];
41341             const closestNodeInfo = geoSphericalClosestNode(edgeNodes, crossLoc);
41342             if (closestNodeInfo.distance < WELD_TH_METERS) {
41343               context3.perform(
41344                 actionMergeNodes([closestNodeInfo.node.id, endNode.id], closestNodeInfo.node.loc),
41345                 annotation
41346               );
41347             } else {
41348               context3.perform(
41349                 actionAddMidpoint({ loc: crossLoc, edge: targetEdge }, endNode),
41350                 annotation
41351               );
41352             }
41353           }
41354         })];
41355         const node = context2.hasEntity(this.entityIds[1]);
41356         if (node && !node.hasInterestingTags()) {
41357           fixes.push(new validationIssueFix({
41358             icon: "maki-barrier",
41359             title: _t.append("issues.fix.tag_as_disconnected.title"),
41360             onClick: function(context3) {
41361               const nodeID = this.issue.entityIds[1];
41362               const tags = Object.assign({}, context3.entity(nodeID).tags);
41363               tags.noexit = "yes";
41364               context3.perform(
41365                 actionChangeTags(nodeID, tags),
41366                 _t("issues.fix.tag_as_disconnected.annotation")
41367               );
41368             }
41369           }));
41370         }
41371         return fixes;
41372       }
41373       function showReference(selection2) {
41374         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.almost_junction.highway-highway.reference"));
41375       }
41376       function isExtendableCandidate(node, way) {
41377         const osm = services.osm;
41378         if (osm && !osm.isDataLoaded(node.loc)) {
41379           return false;
41380         }
41381         if (isTaggedAsNotContinuing(node) || graph.parentWays(node).length !== 1) {
41382           return false;
41383         }
41384         let occurrences = 0;
41385         for (const index in way.nodes) {
41386           if (way.nodes[index] === node.id) {
41387             occurrences += 1;
41388             if (occurrences > 1) {
41389               return false;
41390             }
41391           }
41392         }
41393         return true;
41394       }
41395       function findConnectableEndNodesByExtension(way) {
41396         let results = [];
41397         if (way.isClosed())
41398           return results;
41399         let testNodes;
41400         const indices = [0, way.nodes.length - 1];
41401         indices.forEach((nodeIndex) => {
41402           const nodeID = way.nodes[nodeIndex];
41403           const node = graph.entity(nodeID);
41404           if (!isExtendableCandidate(node, way))
41405             return;
41406           const connectionInfo = canConnectByExtend(way, nodeIndex);
41407           if (!connectionInfo)
41408             return;
41409           testNodes = graph.childNodes(way).slice();
41410           testNodes[nodeIndex] = testNodes[nodeIndex].move(connectionInfo.cross_loc);
41411           if (geoHasSelfIntersections(testNodes, nodeID))
41412             return;
41413           results.push(connectionInfo);
41414         });
41415         return results;
41416       }
41417       function findNearbyEndNodes(node, way) {
41418         return [
41419           way.nodes[0],
41420           way.nodes[way.nodes.length - 1]
41421         ].map((d2) => graph.entity(d2)).filter((d2) => {
41422           return d2.id !== node.id && geoSphericalDistance(node.loc, d2.loc) <= CLOSE_NODE_TH;
41423         });
41424       }
41425       function findSmallJoinAngle(midNode, tipNode, endNodes) {
41426         let joinTo;
41427         let minAngle = Infinity;
41428         endNodes.forEach((endNode) => {
41429           const a1 = geoAngle(midNode, tipNode, context.projection) + Math.PI;
41430           const a2 = geoAngle(midNode, endNode, context.projection) + Math.PI;
41431           const diff = Math.max(a1, a2) - Math.min(a1, a2);
41432           if (diff < minAngle) {
41433             joinTo = endNode;
41434             minAngle = diff;
41435           }
41436         });
41437         if (minAngle <= SIG_ANGLE_TH)
41438           return joinTo;
41439         return null;
41440       }
41441       function hasTag(tags, key) {
41442         return tags[key] !== void 0 && tags[key] !== "no";
41443       }
41444       function canConnectWays(way, way2) {
41445         if (way.id === way2.id)
41446           return true;
41447         if ((hasTag(way.tags, "bridge") || hasTag(way2.tags, "bridge")) && !(hasTag(way.tags, "bridge") && hasTag(way2.tags, "bridge")))
41448           return false;
41449         if ((hasTag(way.tags, "tunnel") || hasTag(way2.tags, "tunnel")) && !(hasTag(way.tags, "tunnel") && hasTag(way2.tags, "tunnel")))
41450           return false;
41451         const layer1 = way.tags.layer || "0", layer2 = way2.tags.layer || "0";
41452         if (layer1 !== layer2)
41453           return false;
41454         const level1 = way.tags.level || "0", level2 = way2.tags.level || "0";
41455         if (level1 !== level2)
41456           return false;
41457         return true;
41458       }
41459       function canConnectByExtend(way, endNodeIdx) {
41460         const tipNid = way.nodes[endNodeIdx];
41461         const midNid = endNodeIdx === 0 ? way.nodes[1] : way.nodes[way.nodes.length - 2];
41462         const tipNode = graph.entity(tipNid);
41463         const midNode = graph.entity(midNid);
41464         const lon = tipNode.loc[0];
41465         const lat = tipNode.loc[1];
41466         const lon_range = geoMetersToLon(EXTEND_TH_METERS, lat) / 2;
41467         const lat_range = geoMetersToLat(EXTEND_TH_METERS) / 2;
41468         const queryExtent = geoExtent([
41469           [lon - lon_range, lat - lat_range],
41470           [lon + lon_range, lat + lat_range]
41471         ]);
41472         const edgeLen = geoSphericalDistance(midNode.loc, tipNode.loc);
41473         const t2 = EXTEND_TH_METERS / edgeLen + 1;
41474         const extTipLoc = geoVecInterp(midNode.loc, tipNode.loc, t2);
41475         const segmentInfos = tree.waySegments(queryExtent, graph);
41476         for (let i3 = 0; i3 < segmentInfos.length; i3++) {
41477           let segmentInfo = segmentInfos[i3];
41478           let way2 = graph.entity(segmentInfo.wayId);
41479           if (!isHighway(way2))
41480             continue;
41481           if (!canConnectWays(way, way2))
41482             continue;
41483           let nAid = segmentInfo.nodes[0], nBid = segmentInfo.nodes[1];
41484           if (nAid === tipNid || nBid === tipNid)
41485             continue;
41486           let nA = graph.entity(nAid), nB = graph.entity(nBid);
41487           let crossLoc = geoLineIntersection([tipNode.loc, extTipLoc], [nA.loc, nB.loc]);
41488           if (crossLoc) {
41489             return {
41490               mid: midNode,
41491               node: tipNode,
41492               wid: way2.id,
41493               edge: [nA.id, nB.id],
41494               cross_loc: crossLoc
41495             };
41496           }
41497         }
41498         return null;
41499       }
41500     };
41501     validation.type = type2;
41502     return validation;
41503   }
41504
41505   // modules/validations/close_nodes.js
41506   function validationCloseNodes(context) {
41507     var type2 = "close_nodes";
41508     var pointThresholdMeters = 0.2;
41509     var validation = function(entity, graph) {
41510       if (entity.type === "node") {
41511         return getIssuesForNode(entity);
41512       } else if (entity.type === "way") {
41513         return getIssuesForWay(entity);
41514       }
41515       return [];
41516       function getIssuesForNode(node) {
41517         var parentWays = graph.parentWays(node);
41518         if (parentWays.length) {
41519           return getIssuesForVertex(node, parentWays);
41520         } else {
41521           return getIssuesForDetachedPoint(node);
41522         }
41523       }
41524       function wayTypeFor(way) {
41525         if (way.tags.boundary && way.tags.boundary !== "no")
41526           return "boundary";
41527         if (way.tags.indoor && way.tags.indoor !== "no")
41528           return "indoor";
41529         if (way.tags.building && way.tags.building !== "no" || way.tags["building:part"] && way.tags["building:part"] !== "no")
41530           return "building";
41531         if (osmPathHighwayTagValues[way.tags.highway])
41532           return "path";
41533         var parentRelations = graph.parentRelations(way);
41534         for (var i3 in parentRelations) {
41535           var relation = parentRelations[i3];
41536           if (relation.tags.type === "boundary")
41537             return "boundary";
41538           if (relation.isMultipolygon()) {
41539             if (relation.tags.indoor && relation.tags.indoor !== "no")
41540               return "indoor";
41541             if (relation.tags.building && relation.tags.building !== "no" || relation.tags["building:part"] && relation.tags["building:part"] !== "no")
41542               return "building";
41543           }
41544         }
41545         return "other";
41546       }
41547       function shouldCheckWay(way) {
41548         if (way.nodes.length <= 2 || way.isClosed() && way.nodes.length <= 4)
41549           return false;
41550         var bbox2 = way.extent(graph).bbox();
41551         var hypotenuseMeters = geoSphericalDistance([bbox2.minX, bbox2.minY], [bbox2.maxX, bbox2.maxY]);
41552         if (hypotenuseMeters < 1.5)
41553           return false;
41554         return true;
41555       }
41556       function getIssuesForWay(way) {
41557         if (!shouldCheckWay(way))
41558           return [];
41559         var issues = [], nodes = graph.childNodes(way);
41560         for (var i3 = 0; i3 < nodes.length - 1; i3++) {
41561           var node1 = nodes[i3];
41562           var node2 = nodes[i3 + 1];
41563           var issue = getWayIssueIfAny(node1, node2, way);
41564           if (issue)
41565             issues.push(issue);
41566         }
41567         return issues;
41568       }
41569       function getIssuesForVertex(node, parentWays) {
41570         var issues = [];
41571         function checkForCloseness(node1, node2, way) {
41572           var issue = getWayIssueIfAny(node1, node2, way);
41573           if (issue)
41574             issues.push(issue);
41575         }
41576         for (var i3 = 0; i3 < parentWays.length; i3++) {
41577           var parentWay = parentWays[i3];
41578           if (!shouldCheckWay(parentWay))
41579             continue;
41580           var lastIndex = parentWay.nodes.length - 1;
41581           for (var j3 = 0; j3 < parentWay.nodes.length; j3++) {
41582             if (j3 !== 0) {
41583               if (parentWay.nodes[j3 - 1] === node.id) {
41584                 checkForCloseness(node, graph.entity(parentWay.nodes[j3]), parentWay);
41585               }
41586             }
41587             if (j3 !== lastIndex) {
41588               if (parentWay.nodes[j3 + 1] === node.id) {
41589                 checkForCloseness(graph.entity(parentWay.nodes[j3]), node, parentWay);
41590               }
41591             }
41592           }
41593         }
41594         return issues;
41595       }
41596       function thresholdMetersForWay(way) {
41597         if (!shouldCheckWay(way))
41598           return 0;
41599         var wayType = wayTypeFor(way);
41600         if (wayType === "boundary")
41601           return 0;
41602         if (wayType === "indoor")
41603           return 0.01;
41604         if (wayType === "building")
41605           return 0.05;
41606         if (wayType === "path")
41607           return 0.1;
41608         return 0.2;
41609       }
41610       function getIssuesForDetachedPoint(node) {
41611         var issues = [];
41612         var lon = node.loc[0];
41613         var lat = node.loc[1];
41614         var lon_range = geoMetersToLon(pointThresholdMeters, lat) / 2;
41615         var lat_range = geoMetersToLat(pointThresholdMeters) / 2;
41616         var queryExtent = geoExtent([
41617           [lon - lon_range, lat - lat_range],
41618           [lon + lon_range, lat + lat_range]
41619         ]);
41620         var intersected = context.history().tree().intersects(queryExtent, graph);
41621         for (var j3 = 0; j3 < intersected.length; j3++) {
41622           var nearby = intersected[j3];
41623           if (nearby.id === node.id)
41624             continue;
41625           if (nearby.type !== "node" || nearby.geometry(graph) !== "point")
41626             continue;
41627           if (nearby.loc === node.loc || geoSphericalDistance(node.loc, nearby.loc) < pointThresholdMeters) {
41628             if ("memorial:type" in node.tags && "memorial:type" in nearby.tags && node.tags["memorial:type"] === "stolperstein" && nearby.tags["memorial:type"] === "stolperstein")
41629               continue;
41630             if ("memorial" in node.tags && "memorial" in nearby.tags && node.tags.memorial === "stolperstein" && nearby.tags.memorial === "stolperstein")
41631               continue;
41632             var zAxisKeys = { layer: true, level: true, "addr:housenumber": true, "addr:unit": true };
41633             var zAxisDifferentiates = false;
41634             for (var key in zAxisKeys) {
41635               var nodeValue = node.tags[key] || "0";
41636               var nearbyValue = nearby.tags[key] || "0";
41637               if (nodeValue !== nearbyValue) {
41638                 zAxisDifferentiates = true;
41639                 break;
41640               }
41641             }
41642             if (zAxisDifferentiates)
41643               continue;
41644             issues.push(new validationIssue({
41645               type: type2,
41646               subtype: "detached",
41647               severity: "warning",
41648               message: function(context2) {
41649                 var entity2 = context2.hasEntity(this.entityIds[0]), entity22 = context2.hasEntity(this.entityIds[1]);
41650                 return entity2 && entity22 ? _t.append("issues.close_nodes.detached.message", {
41651                   feature: utilDisplayLabel(entity2, context2.graph()),
41652                   feature2: utilDisplayLabel(entity22, context2.graph())
41653                 }) : "";
41654               },
41655               reference: showReference,
41656               entityIds: [node.id, nearby.id],
41657               dynamicFixes: function() {
41658                 return [
41659                   new validationIssueFix({
41660                     icon: "iD-operation-disconnect",
41661                     title: _t.append("issues.fix.move_points_apart.title")
41662                   }),
41663                   new validationIssueFix({
41664                     icon: "iD-icon-layers",
41665                     title: _t.append("issues.fix.use_different_layers_or_levels.title")
41666                   })
41667                 ];
41668               }
41669             }));
41670           }
41671         }
41672         return issues;
41673         function showReference(selection2) {
41674           var referenceText = _t("issues.close_nodes.detached.reference");
41675           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
41676         }
41677       }
41678       function getWayIssueIfAny(node1, node2, way) {
41679         if (node1.id === node2.id || node1.hasInterestingTags() && node2.hasInterestingTags()) {
41680           return null;
41681         }
41682         if (node1.loc !== node2.loc) {
41683           var parentWays1 = graph.parentWays(node1);
41684           var parentWays2 = new Set(graph.parentWays(node2));
41685           var sharedWays = parentWays1.filter(function(parentWay) {
41686             return parentWays2.has(parentWay);
41687           });
41688           var thresholds = sharedWays.map(function(parentWay) {
41689             return thresholdMetersForWay(parentWay);
41690           });
41691           var threshold = Math.min(...thresholds);
41692           var distance = geoSphericalDistance(node1.loc, node2.loc);
41693           if (distance > threshold)
41694             return null;
41695         }
41696         return new validationIssue({
41697           type: type2,
41698           subtype: "vertices",
41699           severity: "warning",
41700           message: function(context2) {
41701             var entity2 = context2.hasEntity(this.entityIds[0]);
41702             return entity2 ? _t.append("issues.close_nodes.message", { way: utilDisplayLabel(entity2, context2.graph()) }) : "";
41703           },
41704           reference: showReference,
41705           entityIds: [way.id, node1.id, node2.id],
41706           loc: node1.loc,
41707           dynamicFixes: function() {
41708             return [
41709               new validationIssueFix({
41710                 icon: "iD-icon-plus",
41711                 title: _t.append("issues.fix.merge_points.title"),
41712                 onClick: function(context2) {
41713                   var entityIds = this.issue.entityIds;
41714                   var action = actionMergeNodes([entityIds[1], entityIds[2]]);
41715                   context2.perform(action, _t("issues.fix.merge_close_vertices.annotation"));
41716                 }
41717               }),
41718               new validationIssueFix({
41719                 icon: "iD-operation-disconnect",
41720                 title: _t.append("issues.fix.move_points_apart.title")
41721               })
41722             ];
41723           }
41724         });
41725         function showReference(selection2) {
41726           var referenceText = _t("issues.close_nodes.reference");
41727           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
41728         }
41729       }
41730     };
41731     validation.type = type2;
41732     return validation;
41733   }
41734
41735   // modules/validations/crossing_ways.js
41736   var import_lodash3 = __toESM(require_lodash());
41737   function validationCrossingWays(context) {
41738     var type2 = "crossing_ways";
41739     function getFeatureWithFeatureTypeTagsForWay(way, graph) {
41740       if (getFeatureType(way, graph) === null) {
41741         var parentRels = graph.parentRelations(way);
41742         for (var i3 = 0; i3 < parentRels.length; i3++) {
41743           var rel = parentRels[i3];
41744           if (getFeatureType(rel, graph) !== null) {
41745             return rel;
41746           }
41747         }
41748       }
41749       return way;
41750     }
41751     function hasTag(tags, key) {
41752       return tags[key] !== void 0 && tags[key] !== "no";
41753     }
41754     function taggedAsIndoor(tags) {
41755       return hasTag(tags, "indoor") || hasTag(tags, "level") || tags.highway === "corridor";
41756     }
41757     function allowsBridge(featureType) {
41758       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
41759     }
41760     function allowsTunnel(featureType) {
41761       return featureType === "highway" || featureType === "railway" || featureType === "waterway";
41762     }
41763     var ignoredBuildings = {
41764       demolished: true,
41765       dismantled: true,
41766       proposed: true,
41767       razed: true
41768     };
41769     function getFeatureType(entity, graph) {
41770       var geometry = entity.geometry(graph);
41771       if (geometry !== "line" && geometry !== "area")
41772         return null;
41773       var tags = entity.tags;
41774       if (hasTag(tags, "building") && !ignoredBuildings[tags.building])
41775         return "building";
41776       if (hasTag(tags, "highway") && osmRoutableHighwayTagValues[tags.highway])
41777         return "highway";
41778       if (geometry !== "line")
41779         return null;
41780       if (hasTag(tags, "railway") && osmRailwayTrackTagValues[tags.railway])
41781         return "railway";
41782       if (hasTag(tags, "waterway") && osmFlowingWaterwayTagValues[tags.waterway])
41783         return "waterway";
41784       return null;
41785     }
41786     function isLegitCrossing(tags1, featureType1, tags2, featureType2) {
41787       var level1 = tags1.level || "0";
41788       var level2 = tags2.level || "0";
41789       if (taggedAsIndoor(tags1) && taggedAsIndoor(tags2) && level1 !== level2) {
41790         return true;
41791       }
41792       var layer1 = tags1.layer || "0";
41793       var layer2 = tags2.layer || "0";
41794       if (allowsBridge(featureType1) && allowsBridge(featureType2)) {
41795         if (hasTag(tags1, "bridge") && !hasTag(tags2, "bridge"))
41796           return true;
41797         if (!hasTag(tags1, "bridge") && hasTag(tags2, "bridge"))
41798           return true;
41799         if (hasTag(tags1, "bridge") && hasTag(tags2, "bridge") && layer1 !== layer2)
41800           return true;
41801       } else if (allowsBridge(featureType1) && hasTag(tags1, "bridge"))
41802         return true;
41803       else if (allowsBridge(featureType2) && hasTag(tags2, "bridge"))
41804         return true;
41805       if (allowsTunnel(featureType1) && allowsTunnel(featureType2)) {
41806         if (hasTag(tags1, "tunnel") && !hasTag(tags2, "tunnel"))
41807           return true;
41808         if (!hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel"))
41809           return true;
41810         if (hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel") && layer1 !== layer2)
41811           return true;
41812       } else if (allowsTunnel(featureType1) && hasTag(tags1, "tunnel"))
41813         return true;
41814       else if (allowsTunnel(featureType2) && hasTag(tags2, "tunnel"))
41815         return true;
41816       if (featureType1 === "waterway" && featureType2 === "highway" && tags2.man_made === "pier")
41817         return true;
41818       if (featureType2 === "waterway" && featureType1 === "highway" && tags1.man_made === "pier")
41819         return true;
41820       if (featureType1 === "building" || featureType2 === "building" || taggedAsIndoor(tags1) || taggedAsIndoor(tags2)) {
41821         if (layer1 !== layer2)
41822           return true;
41823       }
41824       return false;
41825     }
41826     var highwaysDisallowingFords = {
41827       motorway: true,
41828       motorway_link: true,
41829       trunk: true,
41830       trunk_link: true,
41831       primary: true,
41832       primary_link: true,
41833       secondary: true,
41834       secondary_link: true
41835     };
41836     function tagsForConnectionNodeIfAllowed(entity1, entity2, graph, lessLikelyTags) {
41837       var featureType1 = getFeatureType(entity1, graph);
41838       var featureType2 = getFeatureType(entity2, graph);
41839       var geometry1 = entity1.geometry(graph);
41840       var geometry2 = entity2.geometry(graph);
41841       var bothLines = geometry1 === "line" && geometry2 === "line";
41842       if (featureType1 === featureType2) {
41843         if (featureType1 === "highway") {
41844           var entity1IsPath = osmPathHighwayTagValues[entity1.tags.highway];
41845           var entity2IsPath = osmPathHighwayTagValues[entity2.tags.highway];
41846           if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) {
41847             var roadFeature = entity1IsPath ? entity2 : entity1;
41848             var pathFeature = entity1IsPath ? entity1 : entity2;
41849             if (roadFeature.tags.highway === "track") {
41850               return {};
41851             }
41852             if (!lessLikelyTags && roadFeature.tags.highway === "service" && pathFeature.tags.highway === "footway" && pathFeature.tags.footway === "sidewalk") {
41853               return {};
41854             }
41855             if (["marked", "unmarked", "traffic_signals", "uncontrolled"].indexOf(pathFeature.tags.crossing) !== -1) {
41856               return bothLines ? { highway: "crossing", crossing: pathFeature.tags.crossing } : {};
41857             }
41858             return bothLines ? { highway: "crossing" } : {};
41859           }
41860           return {};
41861         }
41862         if (featureType1 === "waterway")
41863           return {};
41864         if (featureType1 === "railway")
41865           return {};
41866       } else {
41867         var featureTypes = [featureType1, featureType2];
41868         if (featureTypes.indexOf("highway") !== -1) {
41869           if (featureTypes.indexOf("railway") !== -1) {
41870             if (!bothLines)
41871               return {};
41872             var isTram = entity1.tags.railway === "tram" || entity2.tags.railway === "tram";
41873             if (osmPathHighwayTagValues[entity1.tags.highway] || osmPathHighwayTagValues[entity2.tags.highway]) {
41874               if (isTram)
41875                 return { railway: "tram_crossing" };
41876               return { railway: "crossing" };
41877             } else {
41878               if (isTram)
41879                 return { railway: "tram_level_crossing" };
41880               return { railway: "level_crossing" };
41881             }
41882           }
41883           if (featureTypes.indexOf("waterway") !== -1) {
41884             if (hasTag(entity1.tags, "tunnel") && hasTag(entity2.tags, "tunnel"))
41885               return null;
41886             if (hasTag(entity1.tags, "bridge") && hasTag(entity2.tags, "bridge"))
41887               return null;
41888             if (highwaysDisallowingFords[entity1.tags.highway] || highwaysDisallowingFords[entity2.tags.highway]) {
41889               return null;
41890             }
41891             return bothLines ? { ford: "yes" } : {};
41892           }
41893         }
41894       }
41895       return null;
41896     }
41897     function findCrossingsByWay(way1, graph, tree) {
41898       var edgeCrossInfos = [];
41899       if (way1.type !== "way")
41900         return edgeCrossInfos;
41901       var taggedFeature1 = getFeatureWithFeatureTypeTagsForWay(way1, graph);
41902       var way1FeatureType = getFeatureType(taggedFeature1, graph);
41903       if (way1FeatureType === null)
41904         return edgeCrossInfos;
41905       var checkedSingleCrossingWays = {};
41906       var i3, j3;
41907       var extent;
41908       var n1, n22, nA, nB, nAId, nBId;
41909       var segment1, segment2;
41910       var oneOnly;
41911       var segmentInfos, segment2Info, way2, taggedFeature2, way2FeatureType;
41912       var way1Nodes = graph.childNodes(way1);
41913       var comparedWays = {};
41914       for (i3 = 0; i3 < way1Nodes.length - 1; i3++) {
41915         n1 = way1Nodes[i3];
41916         n22 = way1Nodes[i3 + 1];
41917         extent = geoExtent([
41918           [
41919             Math.min(n1.loc[0], n22.loc[0]),
41920             Math.min(n1.loc[1], n22.loc[1])
41921           ],
41922           [
41923             Math.max(n1.loc[0], n22.loc[0]),
41924             Math.max(n1.loc[1], n22.loc[1])
41925           ]
41926         ]);
41927         segmentInfos = tree.waySegments(extent, graph);
41928         for (j3 = 0; j3 < segmentInfos.length; j3++) {
41929           segment2Info = segmentInfos[j3];
41930           if (segment2Info.wayId === way1.id)
41931             continue;
41932           if (checkedSingleCrossingWays[segment2Info.wayId])
41933             continue;
41934           comparedWays[segment2Info.wayId] = true;
41935           way2 = graph.hasEntity(segment2Info.wayId);
41936           if (!way2)
41937             continue;
41938           taggedFeature2 = getFeatureWithFeatureTypeTagsForWay(way2, graph);
41939           way2FeatureType = getFeatureType(taggedFeature2, graph);
41940           if (way2FeatureType === null || isLegitCrossing(taggedFeature1.tags, way1FeatureType, taggedFeature2.tags, way2FeatureType)) {
41941             continue;
41942           }
41943           oneOnly = way1FeatureType === "building" || way2FeatureType === "building";
41944           nAId = segment2Info.nodes[0];
41945           nBId = segment2Info.nodes[1];
41946           if (nAId === n1.id || nAId === n22.id || nBId === n1.id || nBId === n22.id) {
41947             continue;
41948           }
41949           nA = graph.hasEntity(nAId);
41950           if (!nA)
41951             continue;
41952           nB = graph.hasEntity(nBId);
41953           if (!nB)
41954             continue;
41955           segment1 = [n1.loc, n22.loc];
41956           segment2 = [nA.loc, nB.loc];
41957           var point2 = geoLineIntersection(segment1, segment2);
41958           if (point2) {
41959             edgeCrossInfos.push({
41960               wayInfos: [
41961                 {
41962                   way: way1,
41963                   featureType: way1FeatureType,
41964                   edge: [n1.id, n22.id]
41965                 },
41966                 {
41967                   way: way2,
41968                   featureType: way2FeatureType,
41969                   edge: [nA.id, nB.id]
41970                 }
41971               ],
41972               crossPoint: point2
41973             });
41974             if (oneOnly) {
41975               checkedSingleCrossingWays[way2.id] = true;
41976               break;
41977             }
41978           }
41979         }
41980       }
41981       return edgeCrossInfos;
41982     }
41983     function waysToCheck(entity, graph) {
41984       var featureType = getFeatureType(entity, graph);
41985       if (!featureType)
41986         return [];
41987       if (entity.type === "way") {
41988         return [entity];
41989       } else if (entity.type === "relation") {
41990         return entity.members.reduce(function(array2, member) {
41991           if (member.type === "way" && // only look at geometry ways
41992           (!member.role || member.role === "outer" || member.role === "inner")) {
41993             var entity2 = graph.hasEntity(member.id);
41994             if (entity2 && array2.indexOf(entity2) === -1) {
41995               array2.push(entity2);
41996             }
41997           }
41998           return array2;
41999         }, []);
42000       }
42001       return [];
42002     }
42003     var validation = function checkCrossingWays(entity, graph) {
42004       var tree = context.history().tree();
42005       var ways = waysToCheck(entity, graph);
42006       var issues = [];
42007       var wayIndex, crossingIndex, crossings;
42008       for (wayIndex in ways) {
42009         crossings = findCrossingsByWay(ways[wayIndex], graph, tree);
42010         for (crossingIndex in crossings) {
42011           issues.push(createIssue(crossings[crossingIndex], graph));
42012         }
42013       }
42014       return issues;
42015     };
42016     function createIssue(crossing, graph) {
42017       crossing.wayInfos.sort(function(way1Info, way2Info) {
42018         var type1 = way1Info.featureType;
42019         var type22 = way2Info.featureType;
42020         if (type1 === type22) {
42021           return utilDisplayLabel(way1Info.way, graph) > utilDisplayLabel(way2Info.way, graph);
42022         } else if (type1 === "waterway") {
42023           return true;
42024         } else if (type22 === "waterway") {
42025           return false;
42026         }
42027         return type1 < type22;
42028       });
42029       var entities = crossing.wayInfos.map(function(wayInfo) {
42030         return getFeatureWithFeatureTypeTagsForWay(wayInfo.way, graph);
42031       });
42032       var edges = [crossing.wayInfos[0].edge, crossing.wayInfos[1].edge];
42033       var featureTypes = [crossing.wayInfos[0].featureType, crossing.wayInfos[1].featureType];
42034       var connectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph);
42035       var featureType1 = crossing.wayInfos[0].featureType;
42036       var featureType2 = crossing.wayInfos[1].featureType;
42037       var isCrossingIndoors = taggedAsIndoor(entities[0].tags) && taggedAsIndoor(entities[1].tags);
42038       var isCrossingTunnels = allowsTunnel(featureType1) && hasTag(entities[0].tags, "tunnel") && allowsTunnel(featureType2) && hasTag(entities[1].tags, "tunnel");
42039       var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, "bridge") && allowsBridge(featureType2) && hasTag(entities[1].tags, "bridge");
42040       var subtype = [featureType1, featureType2].sort().join("-");
42041       var crossingTypeID = subtype;
42042       if (isCrossingIndoors) {
42043         crossingTypeID = "indoor-indoor";
42044       } else if (isCrossingTunnels) {
42045         crossingTypeID = "tunnel-tunnel";
42046       } else if (isCrossingBridges) {
42047         crossingTypeID = "bridge-bridge";
42048       }
42049       if (connectionTags && (isCrossingIndoors || isCrossingTunnels || isCrossingBridges)) {
42050         crossingTypeID += "_connectable";
42051       }
42052       var uniqueID = crossing.crossPoint[0].toFixed(4) + "," + crossing.crossPoint[1].toFixed(4);
42053       return new validationIssue({
42054         type: type2,
42055         subtype,
42056         severity: "warning",
42057         message: function(context2) {
42058           var graph2 = context2.graph();
42059           var entity1 = graph2.hasEntity(this.entityIds[0]), entity2 = graph2.hasEntity(this.entityIds[1]);
42060           return entity1 && entity2 ? _t.append("issues.crossing_ways.message", {
42061             feature: utilDisplayLabel(entity1, graph2),
42062             feature2: utilDisplayLabel(entity2, graph2)
42063           }) : "";
42064         },
42065         reference: showReference,
42066         entityIds: entities.map(function(entity) {
42067           return entity.id;
42068         }),
42069         data: {
42070           edges,
42071           featureTypes,
42072           connectionTags
42073         },
42074         hash: uniqueID,
42075         loc: crossing.crossPoint,
42076         dynamicFixes: function(context2) {
42077           var mode = context2.mode();
42078           if (!mode || mode.id !== "select" || mode.selectedIDs().length !== 1)
42079             return [];
42080           var selectedIndex = this.entityIds[0] === mode.selectedIDs()[0] ? 0 : 1;
42081           var selectedFeatureType = this.data.featureTypes[selectedIndex];
42082           var otherFeatureType = this.data.featureTypes[selectedIndex === 0 ? 1 : 0];
42083           var fixes = [];
42084           if (connectionTags) {
42085             fixes.push(makeConnectWaysFix(this.data.connectionTags));
42086             let lessLikelyConnectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph, true);
42087             if (lessLikelyConnectionTags && !(0, import_lodash3.isEqual)(connectionTags, lessLikelyConnectionTags)) {
42088               fixes.push(makeConnectWaysFix(lessLikelyConnectionTags));
42089             }
42090           }
42091           if (isCrossingIndoors) {
42092             fixes.push(new validationIssueFix({
42093               icon: "iD-icon-layers",
42094               title: _t.append("issues.fix.use_different_levels.title")
42095             }));
42096           } else if (isCrossingTunnels || isCrossingBridges || featureType1 === "building" || featureType2 === "building") {
42097             fixes.push(makeChangeLayerFix("higher"));
42098             fixes.push(makeChangeLayerFix("lower"));
42099           } else if (context2.graph().geometry(this.entityIds[0]) === "line" && context2.graph().geometry(this.entityIds[1]) === "line") {
42100             if (allowsBridge(selectedFeatureType) && selectedFeatureType !== "waterway") {
42101               fixes.push(makeAddBridgeOrTunnelFix("add_a_bridge", "temaki-bridge", "bridge"));
42102             }
42103             var skipTunnelFix = otherFeatureType === "waterway" && selectedFeatureType !== "waterway";
42104             if (allowsTunnel(selectedFeatureType) && !skipTunnelFix) {
42105               fixes.push(makeAddBridgeOrTunnelFix("add_a_tunnel", "temaki-tunnel", "tunnel"));
42106             }
42107           }
42108           fixes.push(new validationIssueFix({
42109             icon: "iD-operation-move",
42110             title: _t.append("issues.fix.reposition_features.title")
42111           }));
42112           return fixes;
42113         }
42114       });
42115       function showReference(selection2) {
42116         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.crossing_ways." + crossingTypeID + ".reference"));
42117       }
42118     }
42119     function makeAddBridgeOrTunnelFix(fixTitleID, iconName, bridgeOrTunnel) {
42120       return new validationIssueFix({
42121         icon: iconName,
42122         title: _t.append("issues.fix." + fixTitleID + ".title"),
42123         onClick: function(context2) {
42124           var mode = context2.mode();
42125           if (!mode || mode.id !== "select")
42126             return;
42127           var selectedIDs = mode.selectedIDs();
42128           if (selectedIDs.length !== 1)
42129             return;
42130           var selectedWayID = selectedIDs[0];
42131           if (!context2.hasEntity(selectedWayID))
42132             return;
42133           var resultWayIDs = [selectedWayID];
42134           var edge, crossedEdge, crossedWayID;
42135           if (this.issue.entityIds[0] === selectedWayID) {
42136             edge = this.issue.data.edges[0];
42137             crossedEdge = this.issue.data.edges[1];
42138             crossedWayID = this.issue.entityIds[1];
42139           } else {
42140             edge = this.issue.data.edges[1];
42141             crossedEdge = this.issue.data.edges[0];
42142             crossedWayID = this.issue.entityIds[0];
42143           }
42144           var crossingLoc = this.issue.loc;
42145           var projection2 = context2.projection;
42146           var action = function actionAddStructure(graph) {
42147             var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
42148             var crossedWay = graph.hasEntity(crossedWayID);
42149             var structLengthMeters = crossedWay && isFinite(crossedWay.tags.width) && Number(crossedWay.tags.width);
42150             if (!structLengthMeters) {
42151               structLengthMeters = crossedWay && crossedWay.impliedLineWidthMeters();
42152             }
42153             if (structLengthMeters) {
42154               if (getFeatureType(crossedWay, graph) === "railway") {
42155                 structLengthMeters *= 2;
42156               }
42157             } else {
42158               structLengthMeters = 8;
42159             }
42160             var a1 = geoAngle(edgeNodes[0], edgeNodes[1], projection2) + Math.PI;
42161             var a2 = geoAngle(graph.entity(crossedEdge[0]), graph.entity(crossedEdge[1]), projection2) + Math.PI;
42162             var crossingAngle = Math.max(a1, a2) - Math.min(a1, a2);
42163             if (crossingAngle > Math.PI)
42164               crossingAngle -= Math.PI;
42165             structLengthMeters = structLengthMeters / 2 / Math.sin(crossingAngle) * 2;
42166             structLengthMeters += 4;
42167             structLengthMeters = Math.min(Math.max(structLengthMeters, 4), 50);
42168             function geomToProj(geoPoint) {
42169               return [
42170                 geoLonToMeters(geoPoint[0], geoPoint[1]),
42171                 geoLatToMeters(geoPoint[1])
42172               ];
42173             }
42174             function projToGeom(projPoint) {
42175               var lat = geoMetersToLat(projPoint[1]);
42176               return [
42177                 geoMetersToLon(projPoint[0], lat),
42178                 lat
42179               ];
42180             }
42181             var projEdgeNode1 = geomToProj(edgeNodes[0].loc);
42182             var projEdgeNode2 = geomToProj(edgeNodes[1].loc);
42183             var projectedAngle = geoVecAngle(projEdgeNode1, projEdgeNode2);
42184             var projectedCrossingLoc = geomToProj(crossingLoc);
42185             var linearToSphericalMetersRatio = geoVecLength(projEdgeNode1, projEdgeNode2) / geoSphericalDistance(edgeNodes[0].loc, edgeNodes[1].loc);
42186             function locSphericalDistanceFromCrossingLoc(angle2, distanceMeters) {
42187               var lengthSphericalMeters = distanceMeters * linearToSphericalMetersRatio;
42188               return projToGeom([
42189                 projectedCrossingLoc[0] + Math.cos(angle2) * lengthSphericalMeters,
42190                 projectedCrossingLoc[1] + Math.sin(angle2) * lengthSphericalMeters
42191               ]);
42192             }
42193             var endpointLocGetter1 = function(lengthMeters) {
42194               return locSphericalDistanceFromCrossingLoc(projectedAngle, lengthMeters);
42195             };
42196             var endpointLocGetter2 = function(lengthMeters) {
42197               return locSphericalDistanceFromCrossingLoc(projectedAngle + Math.PI, lengthMeters);
42198             };
42199             var minEdgeLengthMeters = 0.55;
42200             function determineEndpoint(edge2, endNode, locGetter) {
42201               var newNode;
42202               var idealLengthMeters = structLengthMeters / 2;
42203               var crossingToEdgeEndDistance = geoSphericalDistance(crossingLoc, endNode.loc);
42204               if (crossingToEdgeEndDistance - idealLengthMeters > minEdgeLengthMeters) {
42205                 var idealNodeLoc = locGetter(idealLengthMeters);
42206                 newNode = osmNode();
42207                 graph = actionAddMidpoint({ loc: idealNodeLoc, edge: edge2 }, newNode)(graph);
42208               } else {
42209                 var edgeCount = 0;
42210                 endNode.parentIntersectionWays(graph).forEach(function(way) {
42211                   way.nodes.forEach(function(nodeID) {
42212                     if (nodeID === endNode.id) {
42213                       if (endNode.id === way.first() && endNode.id !== way.last() || endNode.id === way.last() && endNode.id !== way.first()) {
42214                         edgeCount += 1;
42215                       } else {
42216                         edgeCount += 2;
42217                       }
42218                     }
42219                   });
42220                 });
42221                 if (edgeCount >= 3) {
42222                   var insetLength = crossingToEdgeEndDistance - minEdgeLengthMeters;
42223                   if (insetLength > minEdgeLengthMeters) {
42224                     var insetNodeLoc = locGetter(insetLength);
42225                     newNode = osmNode();
42226                     graph = actionAddMidpoint({ loc: insetNodeLoc, edge: edge2 }, newNode)(graph);
42227                   }
42228                 }
42229               }
42230               if (!newNode)
42231                 newNode = endNode;
42232               var splitAction = actionSplit([newNode.id]).limitWays(resultWayIDs);
42233               graph = splitAction(graph);
42234               if (splitAction.getCreatedWayIDs().length) {
42235                 resultWayIDs.push(splitAction.getCreatedWayIDs()[0]);
42236               }
42237               return newNode;
42238             }
42239             var structEndNode1 = determineEndpoint(edge, edgeNodes[1], endpointLocGetter1);
42240             var structEndNode2 = determineEndpoint([edgeNodes[0].id, structEndNode1.id], edgeNodes[0], endpointLocGetter2);
42241             var structureWay = resultWayIDs.map(function(id2) {
42242               return graph.entity(id2);
42243             }).find(function(way) {
42244               return way.nodes.indexOf(structEndNode1.id) !== -1 && way.nodes.indexOf(structEndNode2.id) !== -1;
42245             });
42246             var tags = Object.assign({}, structureWay.tags);
42247             if (bridgeOrTunnel === "bridge") {
42248               tags.bridge = "yes";
42249               tags.layer = "1";
42250             } else {
42251               var tunnelValue = "yes";
42252               if (getFeatureType(structureWay, graph) === "waterway") {
42253                 tunnelValue = "culvert";
42254               }
42255               tags.tunnel = tunnelValue;
42256               tags.layer = "-1";
42257             }
42258             graph = actionChangeTags(structureWay.id, tags)(graph);
42259             return graph;
42260           };
42261           context2.perform(action, _t("issues.fix." + fixTitleID + ".annotation"));
42262           context2.enter(modeSelect(context2, resultWayIDs));
42263         }
42264       });
42265     }
42266     function makeConnectWaysFix(connectionTags) {
42267       var fixTitleID = "connect_features";
42268       var fixIcon = "iD-icon-crossing";
42269       if (connectionTags.highway === "crossing") {
42270         fixTitleID = "connect_using_crossing";
42271         fixIcon = "temaki-pedestrian";
42272       }
42273       if (connectionTags.ford) {
42274         fixTitleID = "connect_using_ford";
42275         fixIcon = "roentgen-ford";
42276       }
42277       const fix = new validationIssueFix({
42278         icon: fixIcon,
42279         title: _t.append("issues.fix." + fixTitleID + ".title"),
42280         onClick: function(context2) {
42281           var loc = this.issue.loc;
42282           var edges = this.issue.data.edges;
42283           context2.perform(
42284             function actionConnectCrossingWays(graph) {
42285               var node = osmNode({ loc, tags: connectionTags });
42286               graph = graph.replace(node);
42287               var nodesToMerge = [node.id];
42288               var mergeThresholdInMeters = 0.75;
42289               edges.forEach(function(edge) {
42290                 var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
42291                 var nearby = geoSphericalClosestNode(edgeNodes, loc);
42292                 if ((!nearby.node.hasInterestingTags() || nearby.node.isCrossing()) && nearby.distance < mergeThresholdInMeters) {
42293                   nodesToMerge.push(nearby.node.id);
42294                 } else {
42295                   graph = actionAddMidpoint({ loc, edge }, node)(graph);
42296                 }
42297               });
42298               if (nodesToMerge.length > 1) {
42299                 graph = actionMergeNodes(nodesToMerge, loc)(graph);
42300               }
42301               return graph;
42302             },
42303             _t("issues.fix.connect_crossing_features.annotation")
42304           );
42305         }
42306       });
42307       fix._connectionTags = connectionTags;
42308       return fix;
42309     }
42310     function makeChangeLayerFix(higherOrLower) {
42311       return new validationIssueFix({
42312         icon: "iD-icon-" + (higherOrLower === "higher" ? "up" : "down"),
42313         title: _t.append("issues.fix.tag_this_as_" + higherOrLower + ".title"),
42314         onClick: function(context2) {
42315           var mode = context2.mode();
42316           if (!mode || mode.id !== "select")
42317             return;
42318           var selectedIDs = mode.selectedIDs();
42319           if (selectedIDs.length !== 1)
42320             return;
42321           var selectedID = selectedIDs[0];
42322           if (!this.issue.entityIds.some(function(entityId) {
42323             return entityId === selectedID;
42324           }))
42325             return;
42326           var entity = context2.hasEntity(selectedID);
42327           if (!entity)
42328             return;
42329           var tags = Object.assign({}, entity.tags);
42330           var layer = tags.layer && Number(tags.layer);
42331           if (layer && !isNaN(layer)) {
42332             if (higherOrLower === "higher") {
42333               layer += 1;
42334             } else {
42335               layer -= 1;
42336             }
42337           } else {
42338             if (higherOrLower === "higher") {
42339               layer = 1;
42340             } else {
42341               layer = -1;
42342             }
42343           }
42344           tags.layer = layer.toString();
42345           context2.perform(
42346             actionChangeTags(entity.id, tags),
42347             _t("operations.change_tags.annotation")
42348           );
42349         }
42350       });
42351     }
42352     validation.type = type2;
42353     return validation;
42354   }
42355
42356   // modules/behavior/draw_way.js
42357   function behaviorDrawWay(context, wayID, mode, startGraph) {
42358     const keybinding = utilKeybinding("drawWay");
42359     var dispatch14 = dispatch_default("rejectedSelfIntersection");
42360     var behavior = behaviorDraw(context);
42361     var _nodeIndex;
42362     var _origWay;
42363     var _wayGeometry;
42364     var _headNodeID;
42365     var _annotation;
42366     var _pointerHasMoved = false;
42367     var _drawNode;
42368     var _didResolveTempEdit = false;
42369     function createDrawNode(loc) {
42370       _drawNode = osmNode({ loc });
42371       context.pauseChangeDispatch();
42372       context.replace(function actionAddDrawNode(graph) {
42373         var way = graph.entity(wayID);
42374         return graph.replace(_drawNode).replace(way.addNode(_drawNode.id, _nodeIndex));
42375       }, _annotation);
42376       context.resumeChangeDispatch();
42377       setActiveElements();
42378     }
42379     function removeDrawNode() {
42380       context.pauseChangeDispatch();
42381       context.replace(
42382         function actionDeleteDrawNode(graph) {
42383           var way = graph.entity(wayID);
42384           return graph.replace(way.removeNode(_drawNode.id)).remove(_drawNode);
42385         },
42386         _annotation
42387       );
42388       _drawNode = void 0;
42389       context.resumeChangeDispatch();
42390     }
42391     function keydown(d3_event) {
42392       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
42393         if (context.surface().classed("nope")) {
42394           context.surface().classed("nope-suppressed", true);
42395         }
42396         context.surface().classed("nope", false).classed("nope-disabled", true);
42397       }
42398     }
42399     function keyup(d3_event) {
42400       if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
42401         if (context.surface().classed("nope-suppressed")) {
42402           context.surface().classed("nope", true);
42403         }
42404         context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
42405       }
42406     }
42407     function allowsVertex(d2) {
42408       return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
42409     }
42410     function move(d3_event, datum2) {
42411       var loc = context.map().mouseCoordinates();
42412       if (!_drawNode)
42413         createDrawNode(loc);
42414       context.surface().classed("nope-disabled", d3_event.altKey);
42415       var targetLoc = datum2 && datum2.properties && datum2.properties.entity && allowsVertex(datum2.properties.entity) && datum2.properties.entity.loc;
42416       var targetNodes = datum2 && datum2.properties && datum2.properties.nodes;
42417       if (targetLoc) {
42418         loc = targetLoc;
42419       } else if (targetNodes) {
42420         var choice = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, _drawNode.id);
42421         if (choice) {
42422           loc = choice.loc;
42423         }
42424       }
42425       context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
42426       _drawNode = context.entity(_drawNode.id);
42427       checkGeometry(
42428         true
42429         /* includeDrawNode */
42430       );
42431     }
42432     function checkGeometry(includeDrawNode) {
42433       var nopeDisabled = context.surface().classed("nope-disabled");
42434       var isInvalid = isInvalidGeometry(includeDrawNode);
42435       if (nopeDisabled) {
42436         context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
42437       } else {
42438         context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
42439       }
42440     }
42441     function isInvalidGeometry(includeDrawNode) {
42442       var testNode = _drawNode;
42443       var parentWay = context.graph().entity(wayID);
42444       var nodes = context.graph().childNodes(parentWay).slice();
42445       if (includeDrawNode) {
42446         if (parentWay.isClosed()) {
42447           nodes.pop();
42448         }
42449       } else {
42450         if (parentWay.isClosed()) {
42451           if (nodes.length < 3)
42452             return false;
42453           if (_drawNode)
42454             nodes.splice(-2, 1);
42455           testNode = nodes[nodes.length - 2];
42456         } else {
42457           return false;
42458         }
42459       }
42460       return testNode && geoHasSelfIntersections(nodes, testNode.id);
42461     }
42462     function undone() {
42463       _didResolveTempEdit = true;
42464       context.pauseChangeDispatch();
42465       var nextMode;
42466       if (context.graph() === startGraph) {
42467         nextMode = modeSelect(context, [wayID]);
42468       } else {
42469         context.pop(1);
42470         nextMode = mode;
42471       }
42472       context.perform(actionNoop());
42473       context.pop(1);
42474       context.resumeChangeDispatch();
42475       context.enter(nextMode);
42476     }
42477     function setActiveElements() {
42478       if (!_drawNode)
42479         return;
42480       context.surface().selectAll("." + _drawNode.id).classed("active", true);
42481     }
42482     function resetToStartGraph() {
42483       while (context.graph() !== startGraph) {
42484         context.pop();
42485       }
42486     }
42487     var drawWay = function(surface) {
42488       _drawNode = void 0;
42489       _didResolveTempEdit = false;
42490       _origWay = context.entity(wayID);
42491       if (typeof _nodeIndex === "number") {
42492         _headNodeID = _origWay.nodes[_nodeIndex];
42493       } else if (_origWay.isClosed()) {
42494         _headNodeID = _origWay.nodes[_origWay.nodes.length - 2];
42495       } else {
42496         _headNodeID = _origWay.nodes[_origWay.nodes.length - 1];
42497       }
42498       _wayGeometry = _origWay.geometry(context.graph());
42499       _annotation = _t(
42500         (_origWay.nodes.length === (_origWay.isClosed() ? 2 : 1) ? "operations.start.annotation." : "operations.continue.annotation.") + _wayGeometry
42501       );
42502       _pointerHasMoved = false;
42503       context.pauseChangeDispatch();
42504       context.perform(actionNoop(), _annotation);
42505       context.resumeChangeDispatch();
42506       behavior.hover().initialNodeID(_headNodeID);
42507       behavior.on("move", function() {
42508         _pointerHasMoved = true;
42509         move.apply(this, arguments);
42510       }).on("down", function() {
42511         move.apply(this, arguments);
42512       }).on("downcancel", function() {
42513         if (_drawNode)
42514           removeDrawNode();
42515       }).on("click", drawWay.add).on("clickWay", drawWay.addWay).on("clickNode", drawWay.addNode).on("undo", context.undo).on("cancel", drawWay.cancel).on("finish", drawWay.finish);
42516       select_default2(window).on("keydown.drawWay", keydown).on("keyup.drawWay", keyup);
42517       context.map().dblclickZoomEnable(false).on("drawn.draw", setActiveElements);
42518       setActiveElements();
42519       surface.call(behavior);
42520       context.history().on("undone.draw", undone);
42521     };
42522     drawWay.off = function(surface) {
42523       if (!_didResolveTempEdit) {
42524         context.pauseChangeDispatch();
42525         resetToStartGraph();
42526         context.resumeChangeDispatch();
42527       }
42528       _drawNode = void 0;
42529       _nodeIndex = void 0;
42530       context.map().on("drawn.draw", null);
42531       surface.call(behavior.off).selectAll(".active").classed("active", false);
42532       surface.classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false);
42533       select_default2(window).on("keydown.drawWay", null).on("keyup.drawWay", null);
42534       context.history().on("undone.draw", null);
42535     };
42536     function attemptAdd(d2, loc, doAdd) {
42537       if (_drawNode) {
42538         context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
42539         _drawNode = context.entity(_drawNode.id);
42540       } else {
42541         createDrawNode(loc);
42542       }
42543       checkGeometry(
42544         true
42545         /* includeDrawNode */
42546       );
42547       if (d2 && d2.properties && d2.properties.nope || context.surface().classed("nope")) {
42548         if (!_pointerHasMoved) {
42549           removeDrawNode();
42550         }
42551         dispatch14.call("rejectedSelfIntersection", this);
42552         return;
42553       }
42554       context.pauseChangeDispatch();
42555       doAdd();
42556       _didResolveTempEdit = true;
42557       context.resumeChangeDispatch();
42558       context.enter(mode);
42559     }
42560     drawWay.add = function(loc, d2) {
42561       attemptAdd(d2, loc, function() {
42562       });
42563     };
42564     drawWay.addWay = function(loc, edge, d2) {
42565       attemptAdd(d2, loc, function() {
42566         context.replace(
42567           actionAddMidpoint({ loc, edge }, _drawNode),
42568           _annotation
42569         );
42570       });
42571     };
42572     drawWay.addNode = function(node, d2) {
42573       if (node.id === _headNodeID || // or the first node when drawing an area
42574       _origWay.isClosed() && node.id === _origWay.first()) {
42575         drawWay.finish();
42576         return;
42577       }
42578       attemptAdd(d2, node.loc, function() {
42579         context.replace(
42580           function actionReplaceDrawNode(graph) {
42581             graph = graph.replace(graph.entity(wayID).removeNode(_drawNode.id)).remove(_drawNode);
42582             return graph.replace(graph.entity(wayID).addNode(node.id, _nodeIndex));
42583           },
42584           _annotation
42585         );
42586       });
42587     };
42588     function getFeatureType(ways) {
42589       if (ways.every((way) => way.isClosed()))
42590         return "area";
42591       if (ways.every((way) => !way.isClosed()))
42592         return "line";
42593       return "generic";
42594     }
42595     function followMode() {
42596       if (_didResolveTempEdit)
42597         return;
42598       try {
42599         const isDrawingArea = _origWay.nodes[0] === _origWay.nodes.slice(-1)[0];
42600         const [secondLastNodeId, lastNodeId] = _origWay.nodes.slice(isDrawingArea ? -3 : -2);
42601         const historyGraph = context.history().graph();
42602         if (!lastNodeId || !secondLastNodeId || !historyGraph.hasEntity(lastNodeId) || !historyGraph.hasEntity(secondLastNodeId)) {
42603           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.needs_more_initial_nodes"))();
42604           return;
42605         }
42606         const lastNodesParents = historyGraph.parentWays(historyGraph.entity(lastNodeId)).filter((w2) => w2.id !== wayID);
42607         const secondLastNodesParents = historyGraph.parentWays(historyGraph.entity(secondLastNodeId)).filter((w2) => w2.id !== wayID);
42608         const featureType = getFeatureType(lastNodesParents);
42609         if (lastNodesParents.length !== 1 || secondLastNodesParents.length === 0) {
42610           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.intersection_of_multiple_ways.".concat(featureType)))();
42611           return;
42612         }
42613         if (!secondLastNodesParents.some((n3) => n3.id === lastNodesParents[0].id)) {
42614           context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.intersection_of_different_ways.".concat(featureType)))();
42615           return;
42616         }
42617         const way = lastNodesParents[0];
42618         const indexOfLast = way.nodes.indexOf(lastNodeId);
42619         const indexOfSecondLast = way.nodes.indexOf(secondLastNodeId);
42620         const isDescendingPastZero = indexOfLast === way.nodes.length - 2 && indexOfSecondLast === 0;
42621         let nextNodeIndex = indexOfLast + (indexOfLast > indexOfSecondLast && !isDescendingPastZero ? 1 : -1);
42622         if (nextNodeIndex === -1)
42623           nextNodeIndex = indexOfSecondLast === 1 ? way.nodes.length - 2 : 1;
42624         const nextNode = historyGraph.entity(way.nodes[nextNodeIndex]);
42625         drawWay.addNode(nextNode, {
42626           geometry: { type: "Point", coordinates: nextNode.loc },
42627           id: nextNode.id,
42628           properties: { target: true, entity: nextNode }
42629         });
42630       } catch (ex) {
42631         context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.unknown"))();
42632       }
42633     }
42634     keybinding.on(_t("operations.follow.key"), followMode);
42635     select_default2(document).call(keybinding);
42636     drawWay.finish = function() {
42637       checkGeometry(
42638         false
42639         /* includeDrawNode */
42640       );
42641       if (context.surface().classed("nope")) {
42642         dispatch14.call("rejectedSelfIntersection", this);
42643         return;
42644       }
42645       context.pauseChangeDispatch();
42646       context.pop(1);
42647       _didResolveTempEdit = true;
42648       context.resumeChangeDispatch();
42649       var way = context.hasEntity(wayID);
42650       if (!way || way.isDegenerate()) {
42651         drawWay.cancel();
42652         return;
42653       }
42654       window.setTimeout(function() {
42655         context.map().dblclickZoomEnable(true);
42656       }, 1e3);
42657       var isNewFeature = !mode.isContinuing;
42658       context.enter(modeSelect(context, [wayID]).newFeature(isNewFeature));
42659     };
42660     drawWay.cancel = function() {
42661       context.pauseChangeDispatch();
42662       resetToStartGraph();
42663       context.resumeChangeDispatch();
42664       window.setTimeout(function() {
42665         context.map().dblclickZoomEnable(true);
42666       }, 1e3);
42667       context.surface().classed("nope", false).classed("nope-disabled", false).classed("nope-suppressed", false);
42668       context.enter(modeBrowse(context));
42669     };
42670     drawWay.nodeIndex = function(val) {
42671       if (!arguments.length)
42672         return _nodeIndex;
42673       _nodeIndex = val;
42674       return drawWay;
42675     };
42676     drawWay.activeID = function() {
42677       if (!arguments.length)
42678         return _drawNode && _drawNode.id;
42679       return drawWay;
42680     };
42681     return utilRebind(drawWay, dispatch14, "on");
42682   }
42683
42684   // modules/modes/draw_line.js
42685   function modeDrawLine(context, wayID, startGraph, button, affix, continuing) {
42686     var mode = {
42687       button,
42688       id: "draw-line"
42689     };
42690     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawLine", function() {
42691       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.lines"))();
42692     });
42693     mode.wayID = wayID;
42694     mode.isContinuing = continuing;
42695     mode.enter = function() {
42696       behavior.nodeIndex(affix === "prefix" ? 0 : void 0);
42697       context.install(behavior);
42698     };
42699     mode.exit = function() {
42700       context.uninstall(behavior);
42701     };
42702     mode.selectedIDs = function() {
42703       return [wayID];
42704     };
42705     mode.activeID = function() {
42706       return behavior && behavior.activeID() || [];
42707     };
42708     return mode;
42709   }
42710
42711   // modules/validations/disconnected_way.js
42712   function validationDisconnectedWay() {
42713     var type2 = "disconnected_way";
42714     function isTaggedAsHighway(entity) {
42715       return osmRoutableHighwayTagValues[entity.tags.highway];
42716     }
42717     var validation = function checkDisconnectedWay(entity, graph) {
42718       var routingIslandWays = routingIslandForEntity(entity);
42719       if (!routingIslandWays)
42720         return [];
42721       return [new validationIssue({
42722         type: type2,
42723         subtype: "highway",
42724         severity: "warning",
42725         message: function(context) {
42726           var entity2 = this.entityIds.length && context.hasEntity(this.entityIds[0]);
42727           var label = entity2 && utilDisplayLabel(entity2, context.graph());
42728           return _t.append("issues.disconnected_way.routable.message", { count: this.entityIds.length, highway: label });
42729         },
42730         reference: showReference,
42731         entityIds: Array.from(routingIslandWays).map(function(way) {
42732           return way.id;
42733         }),
42734         dynamicFixes: makeFixes
42735       })];
42736       function makeFixes(context) {
42737         var fixes = [];
42738         var singleEntity = this.entityIds.length === 1 && context.hasEntity(this.entityIds[0]);
42739         if (singleEntity) {
42740           if (singleEntity.type === "way" && !singleEntity.isClosed()) {
42741             var textDirection = _mainLocalizer.textDirection();
42742             var startFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.first(), "start");
42743             if (startFix)
42744               fixes.push(startFix);
42745             var endFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.last(), "end");
42746             if (endFix)
42747               fixes.push(endFix);
42748           }
42749           if (!fixes.length) {
42750             fixes.push(new validationIssueFix({
42751               title: _t.append("issues.fix.connect_feature.title")
42752             }));
42753           }
42754           fixes.push(new validationIssueFix({
42755             icon: "iD-operation-delete",
42756             title: _t.append("issues.fix.delete_feature.title"),
42757             entityIds: [singleEntity.id],
42758             onClick: function(context2) {
42759               var id2 = this.issue.entityIds[0];
42760               var operation = operationDelete(context2, [id2]);
42761               if (!operation.disabled()) {
42762                 operation();
42763               }
42764             }
42765           }));
42766         } else {
42767           fixes.push(new validationIssueFix({
42768             title: _t.append("issues.fix.connect_features.title")
42769           }));
42770         }
42771         return fixes;
42772       }
42773       function showReference(selection2) {
42774         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.disconnected_way.routable.reference"));
42775       }
42776       function routingIslandForEntity(entity2) {
42777         var routingIsland = /* @__PURE__ */ new Set();
42778         var waysToCheck = [];
42779         function queueParentWays(node) {
42780           graph.parentWays(node).forEach(function(parentWay) {
42781             if (!routingIsland.has(parentWay) && // only check each feature once
42782             isRoutableWay(parentWay, false)) {
42783               routingIsland.add(parentWay);
42784               waysToCheck.push(parentWay);
42785             }
42786           });
42787         }
42788         if (entity2.type === "way" && isRoutableWay(entity2, true)) {
42789           routingIsland.add(entity2);
42790           waysToCheck.push(entity2);
42791         } else if (entity2.type === "node" && isRoutableNode(entity2)) {
42792           routingIsland.add(entity2);
42793           queueParentWays(entity2);
42794         } else {
42795           return null;
42796         }
42797         while (waysToCheck.length) {
42798           var wayToCheck = waysToCheck.pop();
42799           var childNodes = graph.childNodes(wayToCheck);
42800           for (var i3 in childNodes) {
42801             var vertex = childNodes[i3];
42802             if (isConnectedVertex(vertex)) {
42803               return null;
42804             }
42805             if (isRoutableNode(vertex)) {
42806               routingIsland.add(vertex);
42807             }
42808             queueParentWays(vertex);
42809           }
42810         }
42811         return routingIsland;
42812       }
42813       function isConnectedVertex(vertex) {
42814         var osm = services.osm;
42815         if (osm && !osm.isDataLoaded(vertex.loc))
42816           return true;
42817         if (vertex.tags.entrance && vertex.tags.entrance !== "no")
42818           return true;
42819         if (vertex.tags.amenity === "parking_entrance")
42820           return true;
42821         return false;
42822       }
42823       function isRoutableNode(node) {
42824         if (node.tags.highway === "elevator")
42825           return true;
42826         return false;
42827       }
42828       function isRoutableWay(way, ignoreInnerWays) {
42829         if (isTaggedAsHighway(way) || way.tags.route === "ferry")
42830           return true;
42831         return graph.parentRelations(way).some(function(parentRelation) {
42832           if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
42833             return true;
42834           if (parentRelation.isMultipolygon() && isTaggedAsHighway(parentRelation) && (!ignoreInnerWays || parentRelation.memberById(way.id).role !== "inner"))
42835             return true;
42836           return false;
42837         });
42838       }
42839       function makeContinueDrawingFixIfAllowed(textDirection, vertexID, whichEnd) {
42840         var vertex = graph.hasEntity(vertexID);
42841         if (!vertex || vertex.tags.noexit === "yes")
42842           return null;
42843         var useLeftContinue = whichEnd === "start" && textDirection === "ltr" || whichEnd === "end" && textDirection === "rtl";
42844         return new validationIssueFix({
42845           icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
42846           title: _t.append("issues.fix.continue_from_" + whichEnd + ".title"),
42847           entityIds: [vertexID],
42848           onClick: function(context) {
42849             var wayId = this.issue.entityIds[0];
42850             var way = context.hasEntity(wayId);
42851             var vertexId = this.entityIds[0];
42852             var vertex2 = context.hasEntity(vertexId);
42853             if (!way || !vertex2)
42854               return;
42855             var map2 = context.map();
42856             if (!context.editable() || !map2.trimmedExtent().contains(vertex2.loc)) {
42857               map2.zoomToEase(vertex2);
42858             }
42859             context.enter(
42860               modeDrawLine(context, wayId, context.graph(), "line", way.affix(vertexId), true)
42861             );
42862           }
42863         });
42864       }
42865     };
42866     validation.type = type2;
42867     return validation;
42868   }
42869
42870   // modules/validations/invalid_format.js
42871   function validationFormatting() {
42872     var type2 = "invalid_format";
42873     var validation = function(entity) {
42874       var issues = [];
42875       function isValidEmail(email) {
42876         var valid_email = /^[^\(\)\\,":;<>@\[\]]+@[^\(\)\\,":;<>@\[\]\.]+(?:\.[a-z0-9-]+)*$/i;
42877         return !email || valid_email.test(email);
42878       }
42879       function showReferenceEmail(selection2) {
42880         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.invalid_format.email.reference"));
42881       }
42882       if (entity.tags.email) {
42883         var emails = entity.tags.email.split(";").map(function(s2) {
42884           return s2.trim();
42885         }).filter(function(x2) {
42886           return !isValidEmail(x2);
42887         });
42888         if (emails.length) {
42889           issues.push(new validationIssue({
42890             type: type2,
42891             subtype: "email",
42892             severity: "warning",
42893             message: function(context) {
42894               var entity2 = context.hasEntity(this.entityIds[0]);
42895               return entity2 ? _t.append(
42896                 "issues.invalid_format.email.message" + this.data,
42897                 { feature: utilDisplayLabel(entity2, context.graph()), email: emails.join(", ") }
42898               ) : "";
42899             },
42900             reference: showReferenceEmail,
42901             entityIds: [entity.id],
42902             hash: emails.join(),
42903             data: emails.length > 1 ? "_multi" : ""
42904           }));
42905         }
42906       }
42907       return issues;
42908     };
42909     validation.type = type2;
42910     return validation;
42911   }
42912
42913   // modules/validations/help_request.js
42914   function validationHelpRequest(context) {
42915     var type2 = "help_request";
42916     var validation = function checkFixmeTag(entity) {
42917       if (!entity.tags.fixme)
42918         return [];
42919       if (entity.version === void 0)
42920         return [];
42921       if (entity.v !== void 0) {
42922         var baseEntity = context.history().base().hasEntity(entity.id);
42923         if (!baseEntity || !baseEntity.tags.fixme)
42924           return [];
42925       }
42926       return [new validationIssue({
42927         type: type2,
42928         subtype: "fixme_tag",
42929         severity: "warning",
42930         message: function(context2) {
42931           var entity2 = context2.hasEntity(this.entityIds[0]);
42932           return entity2 ? _t.append("issues.fixme_tag.message", {
42933             feature: utilDisplayLabel(
42934               entity2,
42935               context2.graph(),
42936               true
42937               /* verbose */
42938             )
42939           }) : "";
42940         },
42941         dynamicFixes: function() {
42942           return [
42943             new validationIssueFix({
42944               title: _t.append("issues.fix.address_the_concern.title")
42945             })
42946           ];
42947         },
42948         reference: showReference,
42949         entityIds: [entity.id]
42950       })];
42951       function showReference(selection2) {
42952         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.fixme_tag.reference"));
42953       }
42954     };
42955     validation.type = type2;
42956     return validation;
42957   }
42958
42959   // modules/validations/impossible_oneway.js
42960   function validationImpossibleOneway() {
42961     var type2 = "impossible_oneway";
42962     var validation = function checkImpossibleOneway(entity, graph) {
42963       if (entity.type !== "way" || entity.geometry(graph) !== "line")
42964         return [];
42965       if (entity.isClosed())
42966         return [];
42967       if (!typeForWay(entity))
42968         return [];
42969       if (!isOneway(entity))
42970         return [];
42971       var firstIssues = issuesForNode(entity, entity.first());
42972       var lastIssues = issuesForNode(entity, entity.last());
42973       return firstIssues.concat(lastIssues);
42974       function typeForWay(way) {
42975         if (way.geometry(graph) !== "line")
42976           return null;
42977         if (osmRoutableHighwayTagValues[way.tags.highway])
42978           return "highway";
42979         if (osmFlowingWaterwayTagValues[way.tags.waterway])
42980           return "waterway";
42981         return null;
42982       }
42983       function isOneway(way) {
42984         if (way.tags.oneway === "yes")
42985           return true;
42986         if (way.tags.oneway)
42987           return false;
42988         for (var key in way.tags) {
42989           if (osmOneWayTags[key] && osmOneWayTags[key][way.tags[key]]) {
42990             return true;
42991           }
42992         }
42993         return false;
42994       }
42995       function nodeOccursMoreThanOnce(way, nodeID) {
42996         var occurrences = 0;
42997         for (var index in way.nodes) {
42998           if (way.nodes[index] === nodeID) {
42999             occurrences += 1;
43000             if (occurrences > 1)
43001               return true;
43002           }
43003         }
43004         return false;
43005       }
43006       function isConnectedViaOtherTypes(way, node) {
43007         var wayType = typeForWay(way);
43008         if (wayType === "highway") {
43009           if (node.tags.entrance && node.tags.entrance !== "no")
43010             return true;
43011           if (node.tags.amenity === "parking_entrance")
43012             return true;
43013         } else if (wayType === "waterway") {
43014           if (node.id === way.first()) {
43015             if (node.tags.natural === "spring")
43016               return true;
43017           } else {
43018             if (node.tags.manhole === "drain")
43019               return true;
43020           }
43021         }
43022         return graph.parentWays(node).some(function(parentWay) {
43023           if (parentWay.id === way.id)
43024             return false;
43025           if (wayType === "highway") {
43026             if (parentWay.geometry(graph) === "area" && osmRoutableHighwayTagValues[parentWay.tags.highway])
43027               return true;
43028             if (parentWay.tags.route === "ferry")
43029               return true;
43030             return graph.parentRelations(parentWay).some(function(parentRelation) {
43031               if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
43032                 return true;
43033               return parentRelation.isMultipolygon() && osmRoutableHighwayTagValues[parentRelation.tags.highway];
43034             });
43035           } else if (wayType === "waterway") {
43036             if (parentWay.tags.natural === "water" || parentWay.tags.natural === "coastline")
43037               return true;
43038           }
43039           return false;
43040         });
43041       }
43042       function issuesForNode(way, nodeID) {
43043         var isFirst = nodeID === way.first();
43044         var wayType = typeForWay(way);
43045         if (nodeOccursMoreThanOnce(way, nodeID))
43046           return [];
43047         var osm = services.osm;
43048         if (!osm)
43049           return [];
43050         var node = graph.hasEntity(nodeID);
43051         if (!node || !osm.isDataLoaded(node.loc))
43052           return [];
43053         if (isConnectedViaOtherTypes(way, node))
43054           return [];
43055         var attachedWaysOfSameType = graph.parentWays(node).filter(function(parentWay) {
43056           if (parentWay.id === way.id)
43057             return false;
43058           return typeForWay(parentWay) === wayType;
43059         });
43060         if (wayType === "waterway" && attachedWaysOfSameType.length === 0)
43061           return [];
43062         var attachedOneways = attachedWaysOfSameType.filter(function(attachedWay) {
43063           return isOneway(attachedWay);
43064         });
43065         if (attachedOneways.length < attachedWaysOfSameType.length)
43066           return [];
43067         if (attachedOneways.length) {
43068           var connectedEndpointsOkay = attachedOneways.some(function(attachedOneway) {
43069             if ((isFirst ? attachedOneway.first() : attachedOneway.last()) !== nodeID)
43070               return true;
43071             if (nodeOccursMoreThanOnce(attachedOneway, nodeID))
43072               return true;
43073             return false;
43074           });
43075           if (connectedEndpointsOkay)
43076             return [];
43077         }
43078         var placement = isFirst ? "start" : "end", messageID = wayType + ".", referenceID = wayType + ".";
43079         if (wayType === "waterway") {
43080           messageID += "connected." + placement;
43081           referenceID += "connected";
43082         } else {
43083           messageID += placement;
43084           referenceID += placement;
43085         }
43086         return [new validationIssue({
43087           type: type2,
43088           subtype: wayType,
43089           severity: "warning",
43090           message: function(context) {
43091             var entity2 = context.hasEntity(this.entityIds[0]);
43092             return entity2 ? _t.append("issues.impossible_oneway." + messageID + ".message", {
43093               feature: utilDisplayLabel(entity2, context.graph())
43094             }) : "";
43095           },
43096           reference: getReference(referenceID),
43097           entityIds: [way.id, node.id],
43098           dynamicFixes: function() {
43099             var fixes = [];
43100             if (attachedOneways.length) {
43101               fixes.push(new validationIssueFix({
43102                 icon: "iD-operation-reverse",
43103                 title: _t.append("issues.fix.reverse_feature.title"),
43104                 entityIds: [way.id],
43105                 onClick: function(context) {
43106                   var id2 = this.issue.entityIds[0];
43107                   context.perform(actionReverse(id2), _t("operations.reverse.annotation.line", { n: 1 }));
43108                 }
43109               }));
43110             }
43111             if (node.tags.noexit !== "yes") {
43112               var textDirection = _mainLocalizer.textDirection();
43113               var useLeftContinue = isFirst && textDirection === "ltr" || !isFirst && textDirection === "rtl";
43114               fixes.push(new validationIssueFix({
43115                 icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
43116                 title: _t.append("issues.fix.continue_from_" + (isFirst ? "start" : "end") + ".title"),
43117                 onClick: function(context) {
43118                   var entityID = this.issue.entityIds[0];
43119                   var vertexID = this.issue.entityIds[1];
43120                   var way2 = context.entity(entityID);
43121                   var vertex = context.entity(vertexID);
43122                   continueDrawing(way2, vertex, context);
43123                 }
43124               }));
43125             }
43126             return fixes;
43127           },
43128           loc: node.loc
43129         })];
43130         function getReference(referenceID2) {
43131           return function showReference(selection2) {
43132             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.impossible_oneway." + referenceID2 + ".reference"));
43133           };
43134         }
43135       }
43136     };
43137     function continueDrawing(way, vertex, context) {
43138       var map2 = context.map();
43139       if (!context.editable() || !map2.trimmedExtent().contains(vertex.loc)) {
43140         map2.zoomToEase(vertex);
43141       }
43142       context.enter(
43143         modeDrawLine(context, way.id, context.graph(), "line", way.affix(vertex.id), true)
43144       );
43145     }
43146     validation.type = type2;
43147     return validation;
43148   }
43149
43150   // modules/validations/incompatible_source.js
43151   function validationIncompatibleSource() {
43152     const type2 = "incompatible_source";
43153     const incompatibleRules = [
43154       {
43155         id: "amap",
43156         regex: /(^amap$|^amap\.com|autonavi|mapabc|高德)/i
43157       },
43158       {
43159         id: "baidu",
43160         regex: /(baidu|mapbar|百度)/i
43161       },
43162       {
43163         id: "google",
43164         regex: /google/i,
43165         exceptRegex: /((books|drive)\.google|google\s?(books|drive|plus))|(esri\/Google_Africa_Buildings)/i
43166       }
43167     ];
43168     const validation = function checkIncompatibleSource(entity) {
43169       const entitySources = entity.tags && entity.tags.source && entity.tags.source.split(";");
43170       if (!entitySources)
43171         return [];
43172       const entityID = entity.id;
43173       return entitySources.map((source) => {
43174         const matchRule = incompatibleRules.find((rule) => {
43175           if (!rule.regex.test(source))
43176             return false;
43177           if (rule.exceptRegex && rule.exceptRegex.test(source))
43178             return false;
43179           return true;
43180         });
43181         if (!matchRule)
43182           return null;
43183         return new validationIssue({
43184           type: type2,
43185           severity: "warning",
43186           message: (context) => {
43187             const entity2 = context.hasEntity(entityID);
43188             return entity2 ? _t.append("issues.incompatible_source.feature.message", {
43189               feature: utilDisplayLabel(
43190                 entity2,
43191                 context.graph(),
43192                 true
43193                 /* verbose */
43194               ),
43195               value: source
43196             }) : "";
43197           },
43198           reference: getReference(matchRule.id),
43199           entityIds: [entityID],
43200           hash: source,
43201           dynamicFixes: () => {
43202             return [
43203               new validationIssueFix({ title: _t.append("issues.fix.remove_proprietary_data.title") })
43204             ];
43205           }
43206         });
43207       }).filter(Boolean);
43208       function getReference(id2) {
43209         return function showReference(selection2) {
43210           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.incompatible_source.reference.".concat(id2)));
43211         };
43212       }
43213     };
43214     validation.type = type2;
43215     return validation;
43216   }
43217
43218   // modules/validations/maprules.js
43219   function validationMaprules() {
43220     var type2 = "maprules";
43221     var validation = function checkMaprules(entity, graph) {
43222       if (!services.maprules)
43223         return [];
43224       var rules = services.maprules.validationRules();
43225       var issues = [];
43226       for (var i3 = 0; i3 < rules.length; i3++) {
43227         var rule = rules[i3];
43228         rule.findIssues(entity, graph, issues);
43229       }
43230       return issues;
43231     };
43232     validation.type = type2;
43233     return validation;
43234   }
43235
43236   // modules/validations/mismatched_geometry.js
43237   var import_fast_deep_equal4 = __toESM(require_fast_deep_equal());
43238   function validationMismatchedGeometry() {
43239     var type2 = "mismatched_geometry";
43240     function tagSuggestingLineIsArea(entity) {
43241       if (entity.type !== "way" || entity.isClosed())
43242         return null;
43243       var tagSuggestingArea = entity.tagSuggestingArea();
43244       if (!tagSuggestingArea) {
43245         return null;
43246       }
43247       var asLine = _mainPresetIndex.matchTags(tagSuggestingArea, "line");
43248       var asArea = _mainPresetIndex.matchTags(tagSuggestingArea, "area");
43249       if (asLine && asArea && (0, import_fast_deep_equal4.default)(asLine.tags, asArea.tags)) {
43250         return null;
43251       }
43252       return tagSuggestingArea;
43253     }
43254     function makeConnectEndpointsFixOnClick(way, graph) {
43255       if (way.nodes.length < 3)
43256         return null;
43257       var nodes = graph.childNodes(way), testNodes;
43258       var firstToLastDistanceMeters = geoSphericalDistance(nodes[0].loc, nodes[nodes.length - 1].loc);
43259       if (firstToLastDistanceMeters < 0.75) {
43260         testNodes = nodes.slice();
43261         testNodes.pop();
43262         testNodes.push(testNodes[0]);
43263         if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
43264           return function(context) {
43265             var way2 = context.entity(this.issue.entityIds[0]);
43266             context.perform(
43267               actionMergeNodes([way2.nodes[0], way2.nodes[way2.nodes.length - 1]], nodes[0].loc),
43268               _t("issues.fix.connect_endpoints.annotation")
43269             );
43270           };
43271         }
43272       }
43273       testNodes = nodes.slice();
43274       testNodes.push(testNodes[0]);
43275       if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
43276         return function(context) {
43277           var wayId = this.issue.entityIds[0];
43278           var way2 = context.entity(wayId);
43279           var nodeId = way2.nodes[0];
43280           var index = way2.nodes.length;
43281           context.perform(
43282             actionAddVertex(wayId, nodeId, index),
43283             _t("issues.fix.connect_endpoints.annotation")
43284           );
43285         };
43286       }
43287     }
43288     function lineTaggedAsAreaIssue(entity) {
43289       var tagSuggestingArea = tagSuggestingLineIsArea(entity);
43290       if (!tagSuggestingArea)
43291         return null;
43292       var validAsLine = false;
43293       var presetAsLine = _mainPresetIndex.matchTags(entity.tags, "line");
43294       if (presetAsLine) {
43295         validAsLine = true;
43296         var key = Object.keys(tagSuggestingArea)[0];
43297         if (presetAsLine.tags[key] && presetAsLine.tags[key] === "*") {
43298           validAsLine = false;
43299         }
43300         if (Object.keys(presetAsLine.tags).length === 0) {
43301           validAsLine = false;
43302         }
43303       }
43304       return new validationIssue({
43305         type: type2,
43306         subtype: "area_as_line",
43307         severity: "warning",
43308         message: function(context) {
43309           var entity2 = context.hasEntity(this.entityIds[0]);
43310           return entity2 ? _t.append("issues.tag_suggests_area.message", {
43311             feature: utilDisplayLabel(
43312               entity2,
43313               "area",
43314               true
43315               /* verbose */
43316             ),
43317             tag: utilTagText({ tags: tagSuggestingArea })
43318           }) : "";
43319         },
43320         reference: showReference,
43321         entityIds: [entity.id],
43322         hash: JSON.stringify(tagSuggestingArea),
43323         dynamicFixes: function(context) {
43324           var fixes = [];
43325           var entity2 = context.entity(this.entityIds[0]);
43326           var connectEndsOnClick = makeConnectEndpointsFixOnClick(entity2, context.graph());
43327           if (!validAsLine) {
43328             fixes.push(new validationIssueFix({
43329               title: _t.append("issues.fix.connect_endpoints.title"),
43330               onClick: connectEndsOnClick
43331             }));
43332           }
43333           fixes.push(new validationIssueFix({
43334             icon: "iD-operation-delete",
43335             title: _t.append("issues.fix.remove_tag.title"),
43336             onClick: function(context2) {
43337               var entityId = this.issue.entityIds[0];
43338               var entity3 = context2.entity(entityId);
43339               var tags = Object.assign({}, entity3.tags);
43340               for (var key2 in tagSuggestingArea) {
43341                 delete tags[key2];
43342               }
43343               context2.perform(
43344                 actionChangeTags(entityId, tags),
43345                 _t("issues.fix.remove_tag.annotation")
43346               );
43347             }
43348           }));
43349           return fixes;
43350         }
43351       });
43352       function showReference(selection2) {
43353         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.tag_suggests_area.reference"));
43354       }
43355     }
43356     function vertexPointIssue(entity, graph) {
43357       if (entity.type !== "node")
43358         return null;
43359       if (Object.keys(entity.tags).length === 0)
43360         return null;
43361       if (entity.isOnAddressLine(graph))
43362         return null;
43363       var geometry = entity.geometry(graph);
43364       var allowedGeometries = osmNodeGeometriesForTags(entity.tags);
43365       if (geometry === "point" && !allowedGeometries.point && allowedGeometries.vertex) {
43366         return new validationIssue({
43367           type: type2,
43368           subtype: "vertex_as_point",
43369           severity: "warning",
43370           message: function(context) {
43371             var entity2 = context.hasEntity(this.entityIds[0]);
43372             return entity2 ? _t.append("issues.vertex_as_point.message", {
43373               feature: utilDisplayLabel(
43374                 entity2,
43375                 "vertex",
43376                 true
43377                 /* verbose */
43378               )
43379             }) : "";
43380           },
43381           reference: function showReference(selection2) {
43382             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.vertex_as_point.reference"));
43383           },
43384           entityIds: [entity.id]
43385         });
43386       } else if (geometry === "vertex" && !allowedGeometries.vertex && allowedGeometries.point) {
43387         return new validationIssue({
43388           type: type2,
43389           subtype: "point_as_vertex",
43390           severity: "warning",
43391           message: function(context) {
43392             var entity2 = context.hasEntity(this.entityIds[0]);
43393             return entity2 ? _t.append("issues.point_as_vertex.message", {
43394               feature: utilDisplayLabel(
43395                 entity2,
43396                 "point",
43397                 true
43398                 /* verbose */
43399               )
43400             }) : "";
43401           },
43402           reference: function showReference(selection2) {
43403             selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.point_as_vertex.reference"));
43404           },
43405           entityIds: [entity.id],
43406           dynamicFixes: extractPointDynamicFixes
43407         });
43408       }
43409       return null;
43410     }
43411     function otherMismatchIssue(entity, graph) {
43412       if (!entity.hasInterestingTags())
43413         return null;
43414       if (entity.type !== "node" && entity.type !== "way")
43415         return null;
43416       if (entity.type === "node" && entity.isOnAddressLine(graph))
43417         return null;
43418       var sourceGeom = entity.geometry(graph);
43419       var targetGeoms = entity.type === "way" ? ["point", "vertex"] : ["line", "area"];
43420       if (sourceGeom === "area")
43421         targetGeoms.unshift("line");
43422       var asSource = _mainPresetIndex.match(entity, graph);
43423       var targetGeom = targetGeoms.find((nodeGeom) => {
43424         var asTarget = _mainPresetIndex.matchTags(entity.tags, nodeGeom);
43425         if (!asSource || !asTarget || asSource === asTarget || // sometimes there are two presets with the same tags for different geometries
43426         (0, import_fast_deep_equal4.default)(asSource.tags, asTarget.tags))
43427           return false;
43428         if (asTarget.isFallback())
43429           return false;
43430         var primaryKey = Object.keys(asTarget.tags)[0];
43431         if (primaryKey === "building")
43432           return false;
43433         if (asTarget.tags[primaryKey] === "*")
43434           return false;
43435         return asSource.isFallback() || asSource.tags[primaryKey] === "*";
43436       });
43437       if (!targetGeom)
43438         return null;
43439       var subtype = targetGeom + "_as_" + sourceGeom;
43440       if (targetGeom === "vertex")
43441         targetGeom = "point";
43442       if (sourceGeom === "vertex")
43443         sourceGeom = "point";
43444       var referenceId = targetGeom + "_as_" + sourceGeom;
43445       var dynamicFixes;
43446       if (targetGeom === "point") {
43447         dynamicFixes = extractPointDynamicFixes;
43448       } else if (sourceGeom === "area" && targetGeom === "line") {
43449         dynamicFixes = lineToAreaDynamicFixes;
43450       }
43451       return new validationIssue({
43452         type: type2,
43453         subtype,
43454         severity: "warning",
43455         message: function(context) {
43456           var entity2 = context.hasEntity(this.entityIds[0]);
43457           return entity2 ? _t.append("issues." + referenceId + ".message", {
43458             feature: utilDisplayLabel(
43459               entity2,
43460               targetGeom,
43461               true
43462               /* verbose */
43463             )
43464           }) : "";
43465         },
43466         reference: function showReference(selection2) {
43467           selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.mismatched_geometry.reference"));
43468         },
43469         entityIds: [entity.id],
43470         dynamicFixes
43471       });
43472     }
43473     function lineToAreaDynamicFixes(context) {
43474       var convertOnClick;
43475       var entityId = this.entityIds[0];
43476       var entity = context.entity(entityId);
43477       var tags = Object.assign({}, entity.tags);
43478       delete tags.area;
43479       if (!osmTagSuggestingArea(tags)) {
43480         convertOnClick = function(context2) {
43481           var entityId2 = this.issue.entityIds[0];
43482           var entity2 = context2.entity(entityId2);
43483           var tags2 = Object.assign({}, entity2.tags);
43484           if (tags2.area) {
43485             delete tags2.area;
43486           }
43487           context2.perform(
43488             actionChangeTags(entityId2, tags2),
43489             _t("issues.fix.convert_to_line.annotation")
43490           );
43491         };
43492       }
43493       return [
43494         new validationIssueFix({
43495           icon: "iD-icon-line",
43496           title: _t.append("issues.fix.convert_to_line.title"),
43497           onClick: convertOnClick
43498         })
43499       ];
43500     }
43501     function extractPointDynamicFixes(context) {
43502       var entityId = this.entityIds[0];
43503       var extractOnClick = null;
43504       if (!context.hasHiddenConnections(entityId)) {
43505         extractOnClick = function(context2) {
43506           var entityId2 = this.issue.entityIds[0];
43507           var action = actionExtract(entityId2, context2.projection);
43508           context2.perform(
43509             action,
43510             _t("operations.extract.annotation", { n: 1 })
43511           );
43512           context2.enter(modeSelect(context2, [action.getExtractedNodeID()]));
43513         };
43514       }
43515       return [
43516         new validationIssueFix({
43517           icon: "iD-operation-extract",
43518           title: _t.append("issues.fix.extract_point.title"),
43519           onClick: extractOnClick
43520         })
43521       ];
43522     }
43523     function unclosedMultipolygonPartIssues(entity, graph) {
43524       if (entity.type !== "relation" || !entity.isMultipolygon() || entity.isDegenerate() || // cannot determine issues for incompletely-downloaded relations
43525       !entity.isComplete(graph))
43526         return [];
43527       var sequences = osmJoinWays(entity.members, graph);
43528       var issues = [];
43529       for (var i3 in sequences) {
43530         var sequence = sequences[i3];
43531         if (!sequence.nodes)
43532           continue;
43533         var firstNode = sequence.nodes[0];
43534         var lastNode = sequence.nodes[sequence.nodes.length - 1];
43535         if (firstNode === lastNode)
43536           continue;
43537         var issue = new validationIssue({
43538           type: type2,
43539           subtype: "unclosed_multipolygon_part",
43540           severity: "warning",
43541           message: function(context) {
43542             var entity2 = context.hasEntity(this.entityIds[0]);
43543             return entity2 ? _t.append("issues.unclosed_multipolygon_part.message", {
43544               feature: utilDisplayLabel(
43545                 entity2,
43546                 context.graph(),
43547                 true
43548                 /* verbose */
43549               )
43550             }) : "";
43551           },
43552           reference: showReference,
43553           loc: sequence.nodes[0].loc,
43554           entityIds: [entity.id],
43555           hash: sequence.map(function(way) {
43556             return way.id;
43557           }).join()
43558         });
43559         issues.push(issue);
43560       }
43561       return issues;
43562       function showReference(selection2) {
43563         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unclosed_multipolygon_part.reference"));
43564       }
43565     }
43566     var validation = function checkMismatchedGeometry(entity, graph) {
43567       var vertexPoint = vertexPointIssue(entity, graph);
43568       if (vertexPoint)
43569         return [vertexPoint];
43570       var lineAsArea = lineTaggedAsAreaIssue(entity);
43571       if (lineAsArea)
43572         return [lineAsArea];
43573       var mismatch = otherMismatchIssue(entity, graph);
43574       if (mismatch)
43575         return [mismatch];
43576       return unclosedMultipolygonPartIssues(entity, graph);
43577     };
43578     validation.type = type2;
43579     return validation;
43580   }
43581
43582   // modules/validations/missing_role.js
43583   function validationMissingRole() {
43584     var type2 = "missing_role";
43585     var validation = function checkMissingRole(entity, graph) {
43586       var issues = [];
43587       if (entity.type === "way") {
43588         graph.parentRelations(entity).forEach(function(relation) {
43589           if (!relation.isMultipolygon())
43590             return;
43591           var member = relation.memberById(entity.id);
43592           if (member && isMissingRole(member)) {
43593             issues.push(makeIssue(entity, relation, member));
43594           }
43595         });
43596       } else if (entity.type === "relation" && entity.isMultipolygon()) {
43597         entity.indexedMembers().forEach(function(member) {
43598           var way = graph.hasEntity(member.id);
43599           if (way && isMissingRole(member)) {
43600             issues.push(makeIssue(way, entity, member));
43601           }
43602         });
43603       }
43604       return issues;
43605     };
43606     function isMissingRole(member) {
43607       return !member.role || !member.role.trim().length;
43608     }
43609     function makeIssue(way, relation, member) {
43610       return new validationIssue({
43611         type: type2,
43612         severity: "warning",
43613         message: function(context) {
43614           var member2 = context.hasEntity(this.entityIds[1]), relation2 = context.hasEntity(this.entityIds[0]);
43615           return member2 && relation2 ? _t.append("issues.missing_role.message", {
43616             member: utilDisplayLabel(member2, context.graph()),
43617             relation: utilDisplayLabel(relation2, context.graph())
43618           }) : "";
43619         },
43620         reference: showReference,
43621         entityIds: [relation.id, way.id],
43622         data: {
43623           member
43624         },
43625         hash: member.index.toString(),
43626         dynamicFixes: function() {
43627           return [
43628             makeAddRoleFix("inner"),
43629             makeAddRoleFix("outer"),
43630             new validationIssueFix({
43631               icon: "iD-operation-delete",
43632               title: _t.append("issues.fix.remove_from_relation.title"),
43633               onClick: function(context) {
43634                 context.perform(
43635                   actionDeleteMember(this.issue.entityIds[0], this.issue.data.member.index),
43636                   _t("operations.delete_member.annotation", {
43637                     n: 1
43638                   })
43639                 );
43640               }
43641             })
43642           ];
43643         }
43644       });
43645       function showReference(selection2) {
43646         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.missing_role.multipolygon.reference"));
43647       }
43648     }
43649     function makeAddRoleFix(role) {
43650       return new validationIssueFix({
43651         title: _t.append("issues.fix.set_as_" + role + ".title"),
43652         onClick: function(context) {
43653           var oldMember = this.issue.data.member;
43654           var member = { id: this.issue.entityIds[1], type: oldMember.type, role };
43655           context.perform(
43656             actionChangeMember(this.issue.entityIds[0], member, oldMember.index),
43657             _t("operations.change_role.annotation", {
43658               n: 1
43659             })
43660           );
43661         }
43662       });
43663     }
43664     validation.type = type2;
43665     return validation;
43666   }
43667
43668   // modules/validations/missing_tag.js
43669   function validationMissingTag(context) {
43670     var type2 = "missing_tag";
43671     function hasDescriptiveTags(entity, graph) {
43672       var onlyAttributeKeys = ["description", "name", "note", "start_date"];
43673       var entityDescriptiveKeys = Object.keys(entity.tags).filter(function(k2) {
43674         if (k2 === "area" || !osmIsInterestingTag(k2))
43675           return false;
43676         return !onlyAttributeKeys.some(function(attributeKey) {
43677           return k2 === attributeKey || k2.indexOf(attributeKey + ":") === 0;
43678         });
43679       });
43680       if (entity.type === "relation" && entityDescriptiveKeys.length === 1 && entity.tags.type === "multipolygon") {
43681         return osmOldMultipolygonOuterMemberOfRelation(entity, graph);
43682       }
43683       return entityDescriptiveKeys.length > 0;
43684     }
43685     function isUnknownRoad(entity) {
43686       return entity.type === "way" && entity.tags.highway === "road";
43687     }
43688     function isUntypedRelation(entity) {
43689       return entity.type === "relation" && !entity.tags.type;
43690     }
43691     var validation = function checkMissingTag(entity, graph) {
43692       var subtype;
43693       var osm = context.connection();
43694       var isUnloadedNode = entity.type === "node" && osm && !osm.isDataLoaded(entity.loc);
43695       if (!isUnloadedNode && // allow untagged nodes that are part of ways
43696       entity.geometry(graph) !== "vertex" && // allow untagged entities that are part of relations
43697       !entity.hasParentRelations(graph)) {
43698         if (Object.keys(entity.tags).length === 0) {
43699           subtype = "any";
43700         } else if (!hasDescriptiveTags(entity, graph)) {
43701           subtype = "descriptive";
43702         } else if (isUntypedRelation(entity)) {
43703           subtype = "relation_type";
43704         }
43705       }
43706       if (!subtype && isUnknownRoad(entity)) {
43707         subtype = "highway_classification";
43708       }
43709       if (!subtype)
43710         return [];
43711       var messageID = subtype === "highway_classification" ? "unknown_road" : "missing_tag." + subtype;
43712       var referenceID = subtype === "highway_classification" ? "unknown_road" : "missing_tag";
43713       var canDelete = entity.version === void 0 || entity.v !== void 0;
43714       var severity = canDelete && subtype !== "highway_classification" ? "error" : "warning";
43715       return [new validationIssue({
43716         type: type2,
43717         subtype,
43718         severity,
43719         message: function(context2) {
43720           var entity2 = context2.hasEntity(this.entityIds[0]);
43721           return entity2 ? _t.append("issues." + messageID + ".message", {
43722             feature: utilDisplayLabel(entity2, context2.graph())
43723           }) : "";
43724         },
43725         reference: showReference,
43726         entityIds: [entity.id],
43727         dynamicFixes: function(context2) {
43728           var fixes = [];
43729           var selectFixType = subtype === "highway_classification" ? "select_road_type" : "select_preset";
43730           fixes.push(new validationIssueFix({
43731             icon: "iD-icon-search",
43732             title: _t.append("issues.fix." + selectFixType + ".title"),
43733             onClick: function(context3) {
43734               context3.ui().sidebar.showPresetList();
43735             }
43736           }));
43737           var deleteOnClick;
43738           var id2 = this.entityIds[0];
43739           var operation = operationDelete(context2, [id2]);
43740           var disabledReasonID = operation.disabled();
43741           if (!disabledReasonID) {
43742             deleteOnClick = function(context3) {
43743               var id3 = this.issue.entityIds[0];
43744               var operation2 = operationDelete(context3, [id3]);
43745               if (!operation2.disabled()) {
43746                 operation2();
43747               }
43748             };
43749           }
43750           fixes.push(
43751             new validationIssueFix({
43752               icon: "iD-operation-delete",
43753               title: _t.append("issues.fix.delete_feature.title"),
43754               disabledReason: disabledReasonID ? _t("operations.delete." + disabledReasonID + ".single") : void 0,
43755               onClick: deleteOnClick
43756             })
43757           );
43758           return fixes;
43759         }
43760       })];
43761       function showReference(selection2) {
43762         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues." + referenceID + ".reference"));
43763       }
43764     };
43765     validation.type = type2;
43766     return validation;
43767   }
43768
43769   // modules/validations/outdated_tags.js
43770   function validationOutdatedTags() {
43771     const type2 = "outdated_tags";
43772     let _waitingForDeprecated = true;
43773     let _dataDeprecated;
43774     _mainFileFetcher.get("deprecated").then((d2) => _dataDeprecated = d2).catch(() => {
43775     }).finally(() => _waitingForDeprecated = false);
43776     function oldTagIssues(entity, graph) {
43777       if (!entity.hasInterestingTags())
43778         return [];
43779       let preset = _mainPresetIndex.match(entity, graph);
43780       if (!preset)
43781         return [];
43782       const oldTags = Object.assign({}, entity.tags);
43783       let subtype = "deprecated_tags";
43784       if (preset.replacement) {
43785         const newPreset = _mainPresetIndex.item(preset.replacement);
43786         graph = actionChangePreset(
43787           entity.id,
43788           preset,
43789           newPreset,
43790           true
43791           /* skip field defaults */
43792         )(graph);
43793         entity = graph.entity(entity.id);
43794         preset = newPreset;
43795       }
43796       if (_dataDeprecated) {
43797         const deprecatedTags = entity.deprecatedTags(_dataDeprecated);
43798         if (deprecatedTags.length) {
43799           deprecatedTags.forEach((tag) => {
43800             graph = actionUpgradeTags(entity.id, tag.old, tag.replace)(graph);
43801           });
43802           entity = graph.entity(entity.id);
43803         }
43804       }
43805       let newTags = Object.assign({}, entity.tags);
43806       if (preset.tags !== preset.addTags) {
43807         Object.keys(preset.addTags).forEach((k2) => {
43808           if (!newTags[k2]) {
43809             if (preset.addTags[k2] === "*") {
43810               newTags[k2] = "yes";
43811             } else {
43812               newTags[k2] = preset.addTags[k2];
43813             }
43814           }
43815         });
43816       }
43817       const nsi = services.nsi;
43818       let waitingForNsi = false;
43819       let nsiResult;
43820       if (nsi) {
43821         waitingForNsi = nsi.status() === "loading";
43822         if (!waitingForNsi) {
43823           const loc = entity.extent(graph).center();
43824           nsiResult = nsi.upgradeTags(newTags, loc);
43825           if (nsiResult) {
43826             newTags = nsiResult.newTags;
43827             subtype = "noncanonical_brand";
43828           }
43829         }
43830       }
43831       let issues = [];
43832       issues.provisional = _waitingForDeprecated || waitingForNsi;
43833       const tagDiff = utilTagDiff(oldTags, newTags);
43834       if (!tagDiff.length)
43835         return issues;
43836       const isOnlyAddingTags = tagDiff.every((d2) => d2.type === "+");
43837       let prefix = "";
43838       if (nsiResult) {
43839         prefix = "noncanonical_brand.";
43840       } else if (subtype === "deprecated_tags" && isOnlyAddingTags) {
43841         subtype = "incomplete_tags";
43842         prefix = "incomplete.";
43843       }
43844       let autoArgs = subtype !== "noncanonical_brand" ? [doUpgrade, _t("issues.fix.upgrade_tags.annotation")] : null;
43845       issues.push(new validationIssue({
43846         type: type2,
43847         subtype,
43848         severity: "warning",
43849         message: showMessage,
43850         reference: showReference,
43851         entityIds: [entity.id],
43852         hash: utilHashcode(JSON.stringify(tagDiff)),
43853         dynamicFixes: () => {
43854           let fixes = [
43855             new validationIssueFix({
43856               autoArgs,
43857               title: _t.append("issues.fix.upgrade_tags.title"),
43858               onClick: (context) => {
43859                 context.perform(doUpgrade, _t("issues.fix.upgrade_tags.annotation"));
43860               }
43861             })
43862           ];
43863           const item = nsiResult && nsiResult.matched;
43864           if (item) {
43865             fixes.push(
43866               new validationIssueFix({
43867                 title: _t.append("issues.fix.tag_as_not.title", { name: item.displayName }),
43868                 onClick: (context) => {
43869                   context.perform(addNotTag, _t("issues.fix.tag_as_not.annotation"));
43870                 }
43871               })
43872             );
43873           }
43874           return fixes;
43875         }
43876       }));
43877       return issues;
43878       function doUpgrade(graph2) {
43879         const currEntity = graph2.hasEntity(entity.id);
43880         if (!currEntity)
43881           return graph2;
43882         let newTags2 = Object.assign({}, currEntity.tags);
43883         tagDiff.forEach((diff) => {
43884           if (diff.type === "-") {
43885             delete newTags2[diff.key];
43886           } else if (diff.type === "+") {
43887             newTags2[diff.key] = diff.newVal;
43888           }
43889         });
43890         return actionChangeTags(currEntity.id, newTags2)(graph2);
43891       }
43892       function addNotTag(graph2) {
43893         const currEntity = graph2.hasEntity(entity.id);
43894         if (!currEntity)
43895           return graph2;
43896         const item = nsiResult && nsiResult.matched;
43897         if (!item)
43898           return graph2;
43899         let newTags2 = Object.assign({}, currEntity.tags);
43900         const wd = item.mainTag;
43901         const notwd = "not:".concat(wd);
43902         const qid = item.tags[wd];
43903         newTags2[notwd] = qid;
43904         if (newTags2[wd] === qid) {
43905           const wp = item.mainTag.replace("wikidata", "wikipedia");
43906           delete newTags2[wd];
43907           delete newTags2[wp];
43908         }
43909         return actionChangeTags(currEntity.id, newTags2)(graph2);
43910       }
43911       function showMessage(context) {
43912         const currEntity = context.hasEntity(entity.id);
43913         if (!currEntity)
43914           return "";
43915         let messageID = "issues.outdated_tags.".concat(prefix, "message");
43916         if (subtype === "noncanonical_brand" && isOnlyAddingTags) {
43917           messageID += "_incomplete";
43918         }
43919         return _t.append(messageID, {
43920           feature: utilDisplayLabel(
43921             currEntity,
43922             context.graph(),
43923             true
43924             /* verbose */
43925           )
43926         });
43927       }
43928       function showReference(selection2) {
43929         let enter = selection2.selectAll(".issue-reference").data([0]).enter();
43930         enter.append("div").attr("class", "issue-reference").call(_t.append("issues.outdated_tags.".concat(prefix, "reference")));
43931         enter.append("strong").call(_t.append("issues.suggested"));
43932         enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", (d2) => {
43933           let klass = d2.type === "+" ? "add" : "remove";
43934           return "tagDiff-cell tagDiff-cell-".concat(klass);
43935         }).html((d2) => d2.display);
43936       }
43937     }
43938     function oldMultipolygonIssues(entity, graph) {
43939       let multipolygon, outerWay;
43940       if (entity.type === "relation") {
43941         outerWay = osmOldMultipolygonOuterMemberOfRelation(entity, graph);
43942         multipolygon = entity;
43943       } else if (entity.type === "way") {
43944         multipolygon = osmIsOldMultipolygonOuterMember(entity, graph);
43945         outerWay = entity;
43946       } else {
43947         return [];
43948       }
43949       if (!multipolygon || !outerWay)
43950         return [];
43951       return [new validationIssue({
43952         type: type2,
43953         subtype: "old_multipolygon",
43954         severity: "warning",
43955         message: showMessage,
43956         reference: showReference,
43957         entityIds: [outerWay.id, multipolygon.id],
43958         dynamicFixes: () => {
43959           return [
43960             new validationIssueFix({
43961               autoArgs: [doUpgrade, _t("issues.fix.move_tags.annotation")],
43962               title: _t.append("issues.fix.move_tags.title"),
43963               onClick: (context) => {
43964                 context.perform(doUpgrade, _t("issues.fix.move_tags.annotation"));
43965               }
43966             })
43967           ];
43968         }
43969       })];
43970       function doUpgrade(graph2) {
43971         let currMultipolygon = graph2.hasEntity(multipolygon.id);
43972         let currOuterWay = graph2.hasEntity(outerWay.id);
43973         if (!currMultipolygon || !currOuterWay)
43974           return graph2;
43975         currMultipolygon = currMultipolygon.mergeTags(currOuterWay.tags);
43976         graph2 = graph2.replace(currMultipolygon);
43977         return actionChangeTags(currOuterWay.id, {})(graph2);
43978       }
43979       function showMessage(context) {
43980         let currMultipolygon = context.hasEntity(multipolygon.id);
43981         if (!currMultipolygon)
43982           return "";
43983         return _t.append(
43984           "issues.old_multipolygon.message",
43985           { multipolygon: utilDisplayLabel(
43986             currMultipolygon,
43987             context.graph(),
43988             true
43989             /* verbose */
43990           ) }
43991         );
43992       }
43993       function showReference(selection2) {
43994         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.old_multipolygon.reference"));
43995       }
43996     }
43997     let validation = function checkOutdatedTags(entity, graph) {
43998       let issues = oldMultipolygonIssues(entity, graph);
43999       if (!issues.length)
44000         issues = oldTagIssues(entity, graph);
44001       return issues;
44002     };
44003     validation.type = type2;
44004     return validation;
44005   }
44006
44007   // modules/validations/private_data.js
44008   function validationPrivateData() {
44009     var type2 = "private_data";
44010     var privateBuildingValues = {
44011       detached: true,
44012       farm: true,
44013       house: true,
44014       houseboat: true,
44015       residential: true,
44016       semidetached_house: true,
44017       static_caravan: true
44018     };
44019     var publicKeys = {
44020       amenity: true,
44021       craft: true,
44022       historic: true,
44023       leisure: true,
44024       office: true,
44025       shop: true,
44026       tourism: true
44027     };
44028     var personalTags = {
44029       "contact:email": true,
44030       "contact:fax": true,
44031       "contact:phone": true,
44032       email: true,
44033       fax: true,
44034       phone: true
44035     };
44036     var validation = function checkPrivateData(entity) {
44037       var tags = entity.tags;
44038       if (!tags.building || !privateBuildingValues[tags.building])
44039         return [];
44040       var keepTags = {};
44041       for (var k2 in tags) {
44042         if (publicKeys[k2])
44043           return [];
44044         if (!personalTags[k2]) {
44045           keepTags[k2] = tags[k2];
44046         }
44047       }
44048       var tagDiff = utilTagDiff(tags, keepTags);
44049       if (!tagDiff.length)
44050         return [];
44051       var fixID = tagDiff.length === 1 ? "remove_tag" : "remove_tags";
44052       return [new validationIssue({
44053         type: type2,
44054         severity: "warning",
44055         message: showMessage,
44056         reference: showReference,
44057         entityIds: [entity.id],
44058         dynamicFixes: function() {
44059           return [
44060             new validationIssueFix({
44061               icon: "iD-operation-delete",
44062               title: _t.append("issues.fix." + fixID + ".title"),
44063               onClick: function(context) {
44064                 context.perform(doUpgrade, _t("issues.fix.remove_tag.annotation"));
44065               }
44066             })
44067           ];
44068         }
44069       })];
44070       function doUpgrade(graph) {
44071         var currEntity = graph.hasEntity(entity.id);
44072         if (!currEntity)
44073           return graph;
44074         var newTags = Object.assign({}, currEntity.tags);
44075         tagDiff.forEach(function(diff) {
44076           if (diff.type === "-") {
44077             delete newTags[diff.key];
44078           } else if (diff.type === "+") {
44079             newTags[diff.key] = diff.newVal;
44080           }
44081         });
44082         return actionChangeTags(currEntity.id, newTags)(graph);
44083       }
44084       function showMessage(context) {
44085         var currEntity = context.hasEntity(this.entityIds[0]);
44086         if (!currEntity)
44087           return "";
44088         return _t.append(
44089           "issues.private_data.contact.message",
44090           { feature: utilDisplayLabel(currEntity, context.graph()) }
44091         );
44092       }
44093       function showReference(selection2) {
44094         var enter = selection2.selectAll(".issue-reference").data([0]).enter();
44095         enter.append("div").attr("class", "issue-reference").call(_t.append("issues.private_data.reference"));
44096         enter.append("strong").call(_t.append("issues.suggested"));
44097         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) {
44098           var klass = d2.type === "+" ? "add" : "remove";
44099           return "tagDiff-cell tagDiff-cell-" + klass;
44100         }).html(function(d2) {
44101           return d2.display;
44102         });
44103       }
44104     };
44105     validation.type = type2;
44106     return validation;
44107   }
44108
44109   // modules/validations/suspicious_name.js
44110   function validationSuspiciousName() {
44111     const type2 = "suspicious_name";
44112     const keysToTestForGenericValues = [
44113       "aerialway",
44114       "aeroway",
44115       "amenity",
44116       "building",
44117       "craft",
44118       "highway",
44119       "leisure",
44120       "railway",
44121       "man_made",
44122       "office",
44123       "shop",
44124       "tourism",
44125       "waterway"
44126     ];
44127     let _waitingForNsi = false;
44128     function isGenericMatchInNsi(tags) {
44129       const nsi = services.nsi;
44130       if (nsi) {
44131         _waitingForNsi = nsi.status() === "loading";
44132         if (!_waitingForNsi) {
44133           return nsi.isGenericName(tags);
44134         }
44135       }
44136       return false;
44137     }
44138     function nameMatchesRawTag(lowercaseName, tags) {
44139       for (let i3 = 0; i3 < keysToTestForGenericValues.length; i3++) {
44140         let key = keysToTestForGenericValues[i3];
44141         let val = tags[key];
44142         if (val) {
44143           val = val.toLowerCase();
44144           if (key === lowercaseName || val === lowercaseName || key.replace(/\_/g, " ") === lowercaseName || val.replace(/\_/g, " ") === lowercaseName) {
44145             return true;
44146           }
44147         }
44148       }
44149       return false;
44150     }
44151     function isGenericName(name, tags) {
44152       name = name.toLowerCase();
44153       return nameMatchesRawTag(name, tags) || isGenericMatchInNsi(tags);
44154     }
44155     function makeGenericNameIssue(entityId, nameKey, genericName, langCode) {
44156       return new validationIssue({
44157         type: type2,
44158         subtype: "generic_name",
44159         severity: "warning",
44160         message: function(context) {
44161           let entity = context.hasEntity(this.entityIds[0]);
44162           if (!entity)
44163             return "";
44164           let preset = _mainPresetIndex.match(entity, context.graph());
44165           let langName = langCode && _mainLocalizer.languageName(langCode);
44166           return _t.append(
44167             "issues.generic_name.message" + (langName ? "_language" : ""),
44168             { feature: preset.name(), name: genericName, language: langName }
44169           );
44170         },
44171         reference: showReference,
44172         entityIds: [entityId],
44173         hash: "".concat(nameKey, "=").concat(genericName),
44174         dynamicFixes: function() {
44175           return [
44176             new validationIssueFix({
44177               icon: "iD-operation-delete",
44178               title: _t.append("issues.fix.remove_the_name.title"),
44179               onClick: function(context) {
44180                 let entityId2 = this.issue.entityIds[0];
44181                 let entity = context.entity(entityId2);
44182                 let tags = Object.assign({}, entity.tags);
44183                 delete tags[nameKey];
44184                 context.perform(
44185                   actionChangeTags(entityId2, tags),
44186                   _t("issues.fix.remove_generic_name.annotation")
44187                 );
44188               }
44189             })
44190           ];
44191         }
44192       });
44193       function showReference(selection2) {
44194         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
44195       }
44196     }
44197     function makeIncorrectNameIssue(entityId, nameKey, incorrectName, langCode) {
44198       return new validationIssue({
44199         type: type2,
44200         subtype: "not_name",
44201         severity: "warning",
44202         message: function(context) {
44203           const entity = context.hasEntity(this.entityIds[0]);
44204           if (!entity)
44205             return "";
44206           const preset = _mainPresetIndex.match(entity, context.graph());
44207           const langName = langCode && _mainLocalizer.languageName(langCode);
44208           return _t.append(
44209             "issues.incorrect_name.message" + (langName ? "_language" : ""),
44210             { feature: preset.name(), name: incorrectName, language: langName }
44211           );
44212         },
44213         reference: showReference,
44214         entityIds: [entityId],
44215         hash: "".concat(nameKey, "=").concat(incorrectName),
44216         dynamicFixes: function() {
44217           return [
44218             new validationIssueFix({
44219               icon: "iD-operation-delete",
44220               title: _t.append("issues.fix.remove_the_name.title"),
44221               onClick: function(context) {
44222                 const entityId2 = this.issue.entityIds[0];
44223                 const entity = context.entity(entityId2);
44224                 let tags = Object.assign({}, entity.tags);
44225                 delete tags[nameKey];
44226                 context.perform(
44227                   actionChangeTags(entityId2, tags),
44228                   _t("issues.fix.remove_mistaken_name.annotation")
44229                 );
44230               }
44231             })
44232           ];
44233         }
44234       });
44235       function showReference(selection2) {
44236         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
44237       }
44238     }
44239     let validation = function checkGenericName(entity) {
44240       const tags = entity.tags;
44241       const hasWikidata = !!tags.wikidata || !!tags["brand:wikidata"] || !!tags["operator:wikidata"];
44242       if (hasWikidata)
44243         return [];
44244       let issues = [];
44245       const notNames2 = (tags["not:name"] || "").split(";");
44246       for (let key in tags) {
44247         const m2 = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/);
44248         if (!m2)
44249           continue;
44250         const langCode = m2.length >= 2 ? m2[1] : null;
44251         const value = tags[key];
44252         if (notNames2.length) {
44253           for (let i3 in notNames2) {
44254             const notName = notNames2[i3];
44255             if (notName && value === notName) {
44256               issues.push(makeIncorrectNameIssue(entity.id, key, value, langCode));
44257               continue;
44258             }
44259           }
44260         }
44261         if (isGenericName(value, tags)) {
44262           issues.provisional = _waitingForNsi;
44263           issues.push(makeGenericNameIssue(entity.id, key, value, langCode));
44264         }
44265       }
44266       return issues;
44267     };
44268     validation.type = type2;
44269     return validation;
44270   }
44271
44272   // modules/validations/unsquare_way.js
44273   function validationUnsquareWay(context) {
44274     var type2 = "unsquare_way";
44275     var DEFAULT_DEG_THRESHOLD = 5;
44276     var epsilon3 = 0.05;
44277     var nodeThreshold = 10;
44278     function isBuilding(entity, graph) {
44279       if (entity.type !== "way" || entity.geometry(graph) !== "area")
44280         return false;
44281       return entity.tags.building && entity.tags.building !== "no";
44282     }
44283     var validation = function checkUnsquareWay(entity, graph) {
44284       if (!isBuilding(entity, graph))
44285         return [];
44286       if (entity.tags.nonsquare === "yes")
44287         return [];
44288       var isClosed = entity.isClosed();
44289       if (!isClosed)
44290         return [];
44291       var nodes = graph.childNodes(entity).slice();
44292       if (nodes.length > nodeThreshold + 1)
44293         return [];
44294       var osm = services.osm;
44295       if (!osm || nodes.some(function(node) {
44296         return !osm.isDataLoaded(node.loc);
44297       }))
44298         return [];
44299       var hasConnectedSquarableWays = nodes.some(function(node) {
44300         return graph.parentWays(node).some(function(way) {
44301           if (way.id === entity.id)
44302             return false;
44303           if (isBuilding(way, graph))
44304             return true;
44305           return graph.parentRelations(way).some(function(parentRelation) {
44306             return parentRelation.isMultipolygon() && parentRelation.tags.building && parentRelation.tags.building !== "no";
44307           });
44308         });
44309       });
44310       if (hasConnectedSquarableWays)
44311         return [];
44312       var storedDegreeThreshold = corePreferences("validate-square-degrees");
44313       var degreeThreshold = isFinite(storedDegreeThreshold) ? Number(storedDegreeThreshold) : DEFAULT_DEG_THRESHOLD;
44314       var points = nodes.map(function(node) {
44315         return context.projection(node.loc);
44316       });
44317       if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon3, degreeThreshold, true))
44318         return [];
44319       var autoArgs;
44320       if (!entity.tags.wikidata) {
44321         var autoAction = actionOrthogonalize(entity.id, context.projection, void 0, degreeThreshold);
44322         autoAction.transitionable = false;
44323         autoArgs = [autoAction, _t("operations.orthogonalize.annotation.feature", { n: 1 })];
44324       }
44325       return [new validationIssue({
44326         type: type2,
44327         subtype: "building",
44328         severity: "warning",
44329         message: function(context2) {
44330           var entity2 = context2.hasEntity(this.entityIds[0]);
44331           return entity2 ? _t.append("issues.unsquare_way.message", {
44332             feature: utilDisplayLabel(entity2, context2.graph())
44333           }) : "";
44334         },
44335         reference: showReference,
44336         entityIds: [entity.id],
44337         hash: degreeThreshold,
44338         dynamicFixes: function() {
44339           return [
44340             new validationIssueFix({
44341               icon: "iD-operation-orthogonalize",
44342               title: _t.append("issues.fix.square_feature.title"),
44343               autoArgs,
44344               onClick: function(context2, completionHandler) {
44345                 var entityId = this.issue.entityIds[0];
44346                 context2.perform(
44347                   actionOrthogonalize(entityId, context2.projection, void 0, degreeThreshold),
44348                   _t("operations.orthogonalize.annotation.feature", { n: 1 })
44349                 );
44350                 window.setTimeout(function() {
44351                   completionHandler();
44352                 }, 175);
44353               }
44354             })
44355             /*
44356             new validationIssueFix({
44357                 title: t.append('issues.fix.tag_as_unsquare.title'),
44358                 onClick: function(context) {
44359                     var entityId = this.issue.entityIds[0];
44360                     var entity = context.entity(entityId);
44361                     var tags = Object.assign({}, entity.tags);  // shallow copy
44362                     tags.nonsquare = 'yes';
44363                     context.perform(
44364                         actionChangeTags(entityId, tags),
44365                         t('issues.fix.tag_as_unsquare.annotation')
44366                     );
44367                 }
44368             })
44369             */
44370           ];
44371         }
44372       })];
44373       function showReference(selection2) {
44374         selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unsquare_way.buildings.reference"));
44375       }
44376     };
44377     validation.type = type2;
44378     return validation;
44379   }
44380
44381   // modules/core/validator.js
44382   function coreValidator(context) {
44383     let dispatch14 = dispatch_default("validated", "focusedIssue");
44384     let validator = utilRebind({}, dispatch14, "on");
44385     let _rules = {};
44386     let _disabledRules = {};
44387     let _ignoredIssueIDs = /* @__PURE__ */ new Set();
44388     let _resolvedIssueIDs = /* @__PURE__ */ new Set();
44389     let _baseCache = validationCache("base");
44390     let _headCache = validationCache("head");
44391     let _completeDiff = {};
44392     let _headIsCurrent = false;
44393     let _deferredRIC = {};
44394     let _deferredST = /* @__PURE__ */ new Set();
44395     let _headPromise;
44396     const RETRY = 5e3;
44397     const _errorOverrides = parseHashParam(context.initialHashParams.validationError);
44398     const _warningOverrides = parseHashParam(context.initialHashParams.validationWarning);
44399     const _disableOverrides = parseHashParam(context.initialHashParams.validationDisable);
44400     function parseHashParam(param) {
44401       let result = [];
44402       let rules = (param || "").split(",");
44403       rules.forEach((rule) => {
44404         rule = rule.trim();
44405         const parts = rule.split("/", 2);
44406         const type2 = parts[0];
44407         const subtype = parts[1] || "*";
44408         if (!type2 || !subtype)
44409           return;
44410         result.push({ type: makeRegExp(type2), subtype: makeRegExp(subtype) });
44411       });
44412       return result;
44413       function makeRegExp(str2) {
44414         const escaped = str2.replace(/[-\/\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
44415         return new RegExp("^" + escaped + "$");
44416       }
44417     }
44418     validator.init = () => {
44419       Object.values(validations_exports).forEach((validation) => {
44420         if (typeof validation !== "function")
44421           return;
44422         const fn = validation(context);
44423         const key = fn.type;
44424         _rules[key] = fn;
44425       });
44426       let disabledRules = corePreferences("validate-disabledRules");
44427       if (disabledRules) {
44428         disabledRules.split(",").forEach((k2) => _disabledRules[k2] = true);
44429       }
44430     };
44431     function reset(resetIgnored) {
44432       _baseCache.queue = [];
44433       _headCache.queue = [];
44434       Object.keys(_deferredRIC).forEach((key) => {
44435         window.cancelIdleCallback(key);
44436         _deferredRIC[key]();
44437       });
44438       _deferredRIC = {};
44439       _deferredST.forEach(window.clearTimeout);
44440       _deferredST.clear();
44441       if (resetIgnored)
44442         _ignoredIssueIDs.clear();
44443       _resolvedIssueIDs.clear();
44444       _baseCache = validationCache("base");
44445       _headCache = validationCache("head");
44446       _completeDiff = {};
44447       _headIsCurrent = false;
44448     }
44449     validator.reset = () => {
44450       reset(true);
44451     };
44452     validator.resetIgnoredIssues = () => {
44453       _ignoredIssueIDs.clear();
44454       dispatch14.call("validated");
44455     };
44456     validator.revalidateUnsquare = () => {
44457       revalidateUnsquare(_headCache);
44458       revalidateUnsquare(_baseCache);
44459       dispatch14.call("validated");
44460     };
44461     function revalidateUnsquare(cache) {
44462       const checkUnsquareWay = _rules.unsquare_way;
44463       if (!cache.graph || typeof checkUnsquareWay !== "function")
44464         return;
44465       cache.uncacheIssuesOfType("unsquare_way");
44466       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");
44467       buildings.forEach((entity) => {
44468         const detected = checkUnsquareWay(entity, cache.graph);
44469         if (!detected.length)
44470           return;
44471         cache.cacheIssues(detected);
44472       });
44473     }
44474     validator.getIssues = (options2) => {
44475       const opts = Object.assign({ what: "all", where: "all", includeIgnored: false, includeDisabledRules: false }, options2);
44476       const view = context.map().extent();
44477       let seen = /* @__PURE__ */ new Set();
44478       let results = [];
44479       if (_headCache.graph && _headCache.graph !== _baseCache.graph) {
44480         Object.values(_headCache.issuesByIssueID).forEach((issue) => {
44481           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
44482           if (opts.what === "edited" && !userModified)
44483             return;
44484           if (!filter2(issue))
44485             return;
44486           seen.add(issue.id);
44487           results.push(issue);
44488         });
44489       }
44490       if (opts.what === "all") {
44491         Object.values(_baseCache.issuesByIssueID).forEach((issue) => {
44492           if (!filter2(issue))
44493             return;
44494           seen.add(issue.id);
44495           results.push(issue);
44496         });
44497       }
44498       return results;
44499       function filter2(issue) {
44500         if (!issue)
44501           return false;
44502         if (seen.has(issue.id))
44503           return false;
44504         if (_resolvedIssueIDs.has(issue.id))
44505           return false;
44506         if (opts.includeDisabledRules === "only" && !_disabledRules[issue.type])
44507           return false;
44508         if (!opts.includeDisabledRules && _disabledRules[issue.type])
44509           return false;
44510         if (opts.includeIgnored === "only" && !_ignoredIssueIDs.has(issue.id))
44511           return false;
44512         if (!opts.includeIgnored && _ignoredIssueIDs.has(issue.id))
44513           return false;
44514         if ((issue.entityIds || []).some((id2) => !context.hasEntity(id2)))
44515           return false;
44516         if (opts.where === "visible") {
44517           const extent = issue.extent(context.graph());
44518           if (!view.intersects(extent))
44519             return false;
44520         }
44521         return true;
44522       }
44523     };
44524     validator.getResolvedIssues = () => {
44525       return Array.from(_resolvedIssueIDs).map((issueID) => _baseCache.issuesByIssueID[issueID]).filter(Boolean);
44526     };
44527     validator.focusIssue = (issue) => {
44528       const graph = context.graph();
44529       let selectID;
44530       let focusCenter;
44531       const issueExtent = issue.extent(graph);
44532       if (issueExtent) {
44533         focusCenter = issueExtent.center();
44534       }
44535       if (issue.entityIds && issue.entityIds.length) {
44536         selectID = issue.entityIds[0];
44537         if (selectID && selectID.charAt(0) === "r") {
44538           const ids = utilEntityAndDeepMemberIDs([selectID], graph);
44539           let nodeID = ids.find((id2) => id2.charAt(0) === "n" && graph.hasEntity(id2));
44540           if (!nodeID) {
44541             const wayID = ids.find((id2) => id2.charAt(0) === "w" && graph.hasEntity(id2));
44542             if (wayID) {
44543               nodeID = graph.entity(wayID).first();
44544             }
44545           }
44546           if (nodeID) {
44547             focusCenter = graph.entity(nodeID).loc;
44548           }
44549         }
44550       }
44551       if (focusCenter) {
44552         const setZoom = Math.max(context.map().zoom(), 19);
44553         context.map().unobscuredCenterZoomEase(focusCenter, setZoom);
44554       }
44555       if (selectID) {
44556         window.setTimeout(() => {
44557           context.enter(modeSelect(context, [selectID]));
44558           dispatch14.call("focusedIssue", this, issue);
44559         }, 250);
44560       }
44561     };
44562     validator.getIssuesBySeverity = (options2) => {
44563       let groups = utilArrayGroupBy(validator.getIssues(options2), "severity");
44564       groups.error = groups.error || [];
44565       groups.warning = groups.warning || [];
44566       return groups;
44567     };
44568     validator.getSharedEntityIssues = (entityIDs, options2) => {
44569       const orderedIssueTypes = [
44570         // Show some issue types in a particular order:
44571         "missing_tag",
44572         "missing_role",
44573         // - missing data first
44574         "outdated_tags",
44575         "mismatched_geometry",
44576         // - identity issues
44577         "crossing_ways",
44578         "almost_junction",
44579         // - geometry issues where fixing them might solve connectivity issues
44580         "disconnected_way",
44581         "impossible_oneway"
44582         // - finally connectivity issues
44583       ];
44584       const allIssues = validator.getIssues(options2);
44585       const forEntityIDs = new Set(entityIDs);
44586       return allIssues.filter((issue) => (issue.entityIds || []).some((entityID) => forEntityIDs.has(entityID))).sort((issue1, issue2) => {
44587         if (issue1.type === issue2.type) {
44588           return issue1.id < issue2.id ? -1 : 1;
44589         }
44590         const index1 = orderedIssueTypes.indexOf(issue1.type);
44591         const index2 = orderedIssueTypes.indexOf(issue2.type);
44592         if (index1 !== -1 && index2 !== -1) {
44593           return index1 - index2;
44594         } else if (index1 === -1 && index2 === -1) {
44595           return issue1.type < issue2.type ? -1 : 1;
44596         } else {
44597           return index1 !== -1 ? -1 : 1;
44598         }
44599       });
44600     };
44601     validator.getEntityIssues = (entityID, options2) => {
44602       return validator.getSharedEntityIssues([entityID], options2);
44603     };
44604     validator.getRuleKeys = () => {
44605       return Object.keys(_rules);
44606     };
44607     validator.isRuleEnabled = (key) => {
44608       return !_disabledRules[key];
44609     };
44610     validator.toggleRule = (key) => {
44611       if (_disabledRules[key]) {
44612         delete _disabledRules[key];
44613       } else {
44614         _disabledRules[key] = true;
44615       }
44616       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
44617       validator.validate();
44618     };
44619     validator.disableRules = (keys2) => {
44620       _disabledRules = {};
44621       keys2.forEach((k2) => _disabledRules[k2] = true);
44622       corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
44623       validator.validate();
44624     };
44625     validator.ignoreIssue = (issueID) => {
44626       _ignoredIssueIDs.add(issueID);
44627     };
44628     validator.validate = () => {
44629       const baseGraph = context.history().base();
44630       if (!_headCache.graph)
44631         _headCache.graph = baseGraph;
44632       if (!_baseCache.graph)
44633         _baseCache.graph = baseGraph;
44634       const prevGraph = _headCache.graph;
44635       const currGraph = context.graph();
44636       if (currGraph === prevGraph) {
44637         _headIsCurrent = true;
44638         dispatch14.call("validated");
44639         return Promise.resolve();
44640       }
44641       if (_headPromise) {
44642         _headIsCurrent = false;
44643         return _headPromise;
44644       }
44645       _headCache.graph = currGraph;
44646       _completeDiff = context.history().difference().complete();
44647       const incrementalDiff = coreDifference(prevGraph, currGraph);
44648       let entityIDs = Object.keys(incrementalDiff.complete());
44649       entityIDs = _headCache.withAllRelatedEntities(entityIDs);
44650       if (!entityIDs.size) {
44651         dispatch14.call("validated");
44652         return Promise.resolve();
44653       }
44654       _headPromise = validateEntitiesAsync(entityIDs, _headCache).then(() => updateResolvedIssues(entityIDs)).then(() => dispatch14.call("validated")).catch(() => {
44655       }).then(() => {
44656         _headPromise = null;
44657         if (!_headIsCurrent) {
44658           validator.validate();
44659         }
44660       });
44661       return _headPromise;
44662     };
44663     context.history().on("restore.validator", validator.validate).on("undone.validator", validator.validate).on("redone.validator", validator.validate).on("reset.validator", () => {
44664       reset(false);
44665       validator.validate();
44666     });
44667     context.on("exit.validator", validator.validate);
44668     context.history().on("merge.validator", (entities) => {
44669       if (!entities)
44670         return;
44671       const baseGraph = context.history().base();
44672       if (!_headCache.graph)
44673         _headCache.graph = baseGraph;
44674       if (!_baseCache.graph)
44675         _baseCache.graph = baseGraph;
44676       let entityIDs = entities.map((entity) => entity.id);
44677       entityIDs = _baseCache.withAllRelatedEntities(entityIDs);
44678       validateEntitiesAsync(entityIDs, _baseCache);
44679     });
44680     function validateEntity(entity, graph) {
44681       let result = { issues: [], provisional: false };
44682       Object.keys(_rules).forEach(runValidation);
44683       return result;
44684       function runValidation(key) {
44685         const fn = _rules[key];
44686         if (typeof fn !== "function") {
44687           console.error("no such validation rule = " + key);
44688           return;
44689         }
44690         let detected = fn(entity, graph);
44691         if (detected.provisional) {
44692           result.provisional = true;
44693         }
44694         detected = detected.filter(applySeverityOverrides);
44695         result.issues = result.issues.concat(detected);
44696         function applySeverityOverrides(issue) {
44697           const type2 = issue.type;
44698           const subtype = issue.subtype || "";
44699           let i3;
44700           for (i3 = 0; i3 < _errorOverrides.length; i3++) {
44701             if (_errorOverrides[i3].type.test(type2) && _errorOverrides[i3].subtype.test(subtype)) {
44702               issue.severity = "error";
44703               return true;
44704             }
44705           }
44706           for (i3 = 0; i3 < _warningOverrides.length; i3++) {
44707             if (_warningOverrides[i3].type.test(type2) && _warningOverrides[i3].subtype.test(subtype)) {
44708               issue.severity = "warning";
44709               return true;
44710             }
44711           }
44712           for (i3 = 0; i3 < _disableOverrides.length; i3++) {
44713             if (_disableOverrides[i3].type.test(type2) && _disableOverrides[i3].subtype.test(subtype)) {
44714               return false;
44715             }
44716           }
44717           return true;
44718         }
44719       }
44720     }
44721     function updateResolvedIssues(entityIDs) {
44722       entityIDs.forEach((entityID) => {
44723         const baseIssues = _baseCache.issuesByEntityID[entityID];
44724         if (!baseIssues)
44725           return;
44726         baseIssues.forEach((issueID) => {
44727           const issue = _baseCache.issuesByIssueID[issueID];
44728           const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
44729           if (userModified && !_headCache.issuesByIssueID[issueID]) {
44730             _resolvedIssueIDs.add(issueID);
44731           } else {
44732             _resolvedIssueIDs.delete(issueID);
44733           }
44734         });
44735       });
44736     }
44737     function validateEntitiesAsync(entityIDs, cache) {
44738       const jobs = Array.from(entityIDs).map((entityID) => {
44739         if (cache.queuedEntityIDs.has(entityID))
44740           return null;
44741         cache.queuedEntityIDs.add(entityID);
44742         cache.uncacheEntityID(entityID);
44743         return () => {
44744           cache.queuedEntityIDs.delete(entityID);
44745           const graph = cache.graph;
44746           if (!graph)
44747             return;
44748           const entity = graph.hasEntity(entityID);
44749           if (!entity)
44750             return;
44751           const result = validateEntity(entity, graph);
44752           if (result.provisional) {
44753             cache.provisionalEntityIDs.add(entityID);
44754           }
44755           cache.cacheIssues(result.issues);
44756         };
44757       }).filter(Boolean);
44758       cache.queue = cache.queue.concat(utilArrayChunk(jobs, 100));
44759       if (cache.queuePromise)
44760         return cache.queuePromise;
44761       cache.queuePromise = processQueue(cache).then(() => revalidateProvisionalEntities(cache)).catch(() => {
44762       }).finally(() => cache.queuePromise = null);
44763       return cache.queuePromise;
44764     }
44765     function revalidateProvisionalEntities(cache) {
44766       if (!cache.provisionalEntityIDs.size)
44767         return;
44768       const handle = window.setTimeout(() => {
44769         _deferredST.delete(handle);
44770         if (!cache.provisionalEntityIDs.size)
44771           return;
44772         validateEntitiesAsync(Array.from(cache.provisionalEntityIDs), cache);
44773       }, RETRY);
44774       _deferredST.add(handle);
44775     }
44776     function processQueue(cache) {
44777       if (!cache.queue.length)
44778         return Promise.resolve();
44779       const chunk = cache.queue.pop();
44780       return new Promise((resolvePromise, rejectPromise) => {
44781         const handle = window.requestIdleCallback(() => {
44782           delete _deferredRIC[handle];
44783           chunk.forEach((job) => job());
44784           resolvePromise();
44785         });
44786         _deferredRIC[handle] = rejectPromise;
44787       }).then(() => {
44788         if (cache.queue.length % 25 === 0)
44789           dispatch14.call("validated");
44790       }).then(() => processQueue(cache));
44791     }
44792     return validator;
44793   }
44794   function validationCache(which) {
44795     let cache = {
44796       which,
44797       graph: null,
44798       queue: [],
44799       queuePromise: null,
44800       queuedEntityIDs: /* @__PURE__ */ new Set(),
44801       provisionalEntityIDs: /* @__PURE__ */ new Set(),
44802       issuesByIssueID: {},
44803       // issue.id -> issue
44804       issuesByEntityID: {}
44805       // entity.id -> Set(issue.id)
44806     };
44807     cache.cacheIssue = (issue) => {
44808       (issue.entityIds || []).forEach((entityID) => {
44809         if (!cache.issuesByEntityID[entityID]) {
44810           cache.issuesByEntityID[entityID] = /* @__PURE__ */ new Set();
44811         }
44812         cache.issuesByEntityID[entityID].add(issue.id);
44813       });
44814       cache.issuesByIssueID[issue.id] = issue;
44815     };
44816     cache.uncacheIssue = (issue) => {
44817       (issue.entityIds || []).forEach((entityID) => {
44818         if (cache.issuesByEntityID[entityID]) {
44819           cache.issuesByEntityID[entityID].delete(issue.id);
44820         }
44821       });
44822       delete cache.issuesByIssueID[issue.id];
44823     };
44824     cache.cacheIssues = (issues) => {
44825       issues.forEach(cache.cacheIssue);
44826     };
44827     cache.uncacheIssues = (issues) => {
44828       issues.forEach(cache.uncacheIssue);
44829     };
44830     cache.uncacheIssuesOfType = (type2) => {
44831       const issuesOfType = Object.values(cache.issuesByIssueID).filter((issue) => issue.type === type2);
44832       cache.uncacheIssues(issuesOfType);
44833     };
44834     cache.uncacheEntityID = (entityID) => {
44835       const entityIssueIDs = cache.issuesByEntityID[entityID];
44836       if (entityIssueIDs) {
44837         entityIssueIDs.forEach((issueID) => {
44838           const issue = cache.issuesByIssueID[issueID];
44839           if (issue) {
44840             cache.uncacheIssue(issue);
44841           } else {
44842             delete cache.issuesByIssueID[issueID];
44843           }
44844         });
44845       }
44846       delete cache.issuesByEntityID[entityID];
44847       cache.provisionalEntityIDs.delete(entityID);
44848     };
44849     cache.withAllRelatedEntities = (entityIDs) => {
44850       let result = /* @__PURE__ */ new Set();
44851       (entityIDs || []).forEach((entityID) => {
44852         result.add(entityID);
44853         const entityIssueIDs = cache.issuesByEntityID[entityID];
44854         if (entityIssueIDs) {
44855           entityIssueIDs.forEach((issueID) => {
44856             const issue = cache.issuesByIssueID[issueID];
44857             if (issue) {
44858               (issue.entityIds || []).forEach((relatedID) => result.add(relatedID));
44859             } else {
44860               delete cache.issuesByIssueID[issueID];
44861             }
44862           });
44863         }
44864       });
44865       return result;
44866     };
44867     return cache;
44868   }
44869
44870   // modules/core/uploader.js
44871   function coreUploader(context) {
44872     var dispatch14 = dispatch_default(
44873       // Start and end events are dispatched exactly once each per legitimate outside call to `save`
44874       "saveStarted",
44875       // dispatched as soon as a call to `save` has been deemed legitimate
44876       "saveEnded",
44877       // dispatched after the result event has been dispatched
44878       "willAttemptUpload",
44879       // dispatched before the actual upload call occurs, if it will
44880       "progressChanged",
44881       // Each save results in one of these outcomes:
44882       "resultNoChanges",
44883       // upload wasn't attempted since there were no edits
44884       "resultErrors",
44885       // upload failed due to errors
44886       "resultConflicts",
44887       // upload failed due to data conflicts
44888       "resultSuccess"
44889       // upload completed without errors
44890     );
44891     var _isSaving = false;
44892     var _conflicts = [];
44893     var _errors = [];
44894     var _origChanges;
44895     var _discardTags = {};
44896     _mainFileFetcher.get("discarded").then(function(d2) {
44897       _discardTags = d2;
44898     }).catch(function() {
44899     });
44900     var uploader = utilRebind({}, dispatch14, "on");
44901     uploader.isSaving = function() {
44902       return _isSaving;
44903     };
44904     uploader.save = function(changeset, tryAgain, checkConflicts) {
44905       if (_isSaving && !tryAgain) {
44906         return;
44907       }
44908       var osm = context.connection();
44909       if (!osm)
44910         return;
44911       if (!osm.authenticated()) {
44912         osm.authenticate(function(err) {
44913           if (!err) {
44914             uploader.save(changeset, tryAgain, checkConflicts);
44915           }
44916         });
44917         return;
44918       }
44919       if (!_isSaving) {
44920         _isSaving = true;
44921         dispatch14.call("saveStarted", this);
44922       }
44923       var history = context.history();
44924       _conflicts = [];
44925       _errors = [];
44926       _origChanges = history.changes(actionDiscardTags(history.difference(), _discardTags));
44927       if (!tryAgain) {
44928         history.perform(actionNoop());
44929       }
44930       if (!checkConflicts) {
44931         upload(changeset);
44932       } else {
44933         performFullConflictCheck(changeset);
44934       }
44935     };
44936     function performFullConflictCheck(changeset) {
44937       var osm = context.connection();
44938       if (!osm)
44939         return;
44940       var history = context.history();
44941       var localGraph = context.graph();
44942       var remoteGraph = coreGraph(history.base(), true);
44943       var summary = history.difference().summary();
44944       var _toCheck = [];
44945       for (var i3 = 0; i3 < summary.length; i3++) {
44946         var item = summary[i3];
44947         if (item.changeType === "modified") {
44948           _toCheck.push(item.entity.id);
44949         }
44950       }
44951       var _toLoad = withChildNodes(_toCheck, localGraph);
44952       var _loaded = {};
44953       var _toLoadCount = 0;
44954       var _toLoadTotal = _toLoad.length;
44955       if (_toCheck.length) {
44956         dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
44957         _toLoad.forEach(function(id2) {
44958           _loaded[id2] = false;
44959         });
44960         osm.loadMultiple(_toLoad, loaded);
44961       } else {
44962         upload(changeset);
44963       }
44964       return;
44965       function withChildNodes(ids, graph) {
44966         var s2 = new Set(ids);
44967         ids.forEach(function(id2) {
44968           var entity = graph.entity(id2);
44969           if (entity.type !== "way")
44970             return;
44971           graph.childNodes(entity).forEach(function(child) {
44972             if (child.version !== void 0) {
44973               s2.add(child.id);
44974             }
44975           });
44976         });
44977         return Array.from(s2);
44978       }
44979       function loaded(err, result) {
44980         if (_errors.length)
44981           return;
44982         if (err) {
44983           _errors.push({
44984             msg: err.message || err.responseText,
44985             details: [_t("save.status_code", { code: err.status })]
44986           });
44987           didResultInErrors();
44988         } else {
44989           var loadMore = [];
44990           result.data.forEach(function(entity) {
44991             remoteGraph.replace(entity);
44992             _loaded[entity.id] = true;
44993             _toLoad = _toLoad.filter(function(val) {
44994               return val !== entity.id;
44995             });
44996             if (!entity.visible)
44997               return;
44998             var i4, id2;
44999             if (entity.type === "way") {
45000               for (i4 = 0; i4 < entity.nodes.length; i4++) {
45001                 id2 = entity.nodes[i4];
45002                 if (_loaded[id2] === void 0) {
45003                   _loaded[id2] = false;
45004                   loadMore.push(id2);
45005                 }
45006               }
45007             } else if (entity.type === "relation" && entity.isMultipolygon()) {
45008               for (i4 = 0; i4 < entity.members.length; i4++) {
45009                 id2 = entity.members[i4].id;
45010                 if (_loaded[id2] === void 0) {
45011                   _loaded[id2] = false;
45012                   loadMore.push(id2);
45013                 }
45014               }
45015             }
45016           });
45017           _toLoadCount += result.data.length;
45018           _toLoadTotal += loadMore.length;
45019           dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
45020           if (loadMore.length) {
45021             _toLoad.push.apply(_toLoad, loadMore);
45022             osm.loadMultiple(loadMore, loaded);
45023           }
45024           if (!_toLoad.length) {
45025             detectConflicts();
45026             upload(changeset);
45027           }
45028         }
45029       }
45030       function detectConflicts() {
45031         function choice(id2, text2, action) {
45032           return {
45033             id: id2,
45034             text: text2,
45035             action: function() {
45036               history.replace(action);
45037             }
45038           };
45039         }
45040         function formatUser(d2) {
45041           return '<a href="' + osm.userURL(d2) + '" target="_blank">' + escape_default(d2) + "</a>";
45042         }
45043         function entityName(entity) {
45044           return utilDisplayName(entity) || utilDisplayType(entity.id) + " " + entity.id;
45045         }
45046         function sameVersions(local, remote) {
45047           if (local.version !== remote.version)
45048             return false;
45049           if (local.type === "way") {
45050             var children2 = utilArrayUnion(local.nodes, remote.nodes);
45051             for (var i4 = 0; i4 < children2.length; i4++) {
45052               var a2 = localGraph.hasEntity(children2[i4]);
45053               var b2 = remoteGraph.hasEntity(children2[i4]);
45054               if (a2 && b2 && a2.version !== b2.version)
45055                 return false;
45056             }
45057           }
45058           return true;
45059         }
45060         _toCheck.forEach(function(id2) {
45061           var local = localGraph.entity(id2);
45062           var remote = remoteGraph.entity(id2);
45063           if (sameVersions(local, remote))
45064             return;
45065           var merge2 = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags, formatUser);
45066           history.replace(merge2);
45067           var mergeConflicts = merge2.conflicts();
45068           if (!mergeConflicts.length)
45069             return;
45070           var forceLocal = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_local");
45071           var forceRemote = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_remote");
45072           var keepMine = _t("save.conflict." + (remote.visible ? "keep_local" : "restore"));
45073           var keepTheirs = _t("save.conflict." + (remote.visible ? "keep_remote" : "delete"));
45074           _conflicts.push({
45075             id: id2,
45076             name: entityName(local),
45077             details: mergeConflicts,
45078             chosen: 1,
45079             choices: [
45080               choice(id2, keepMine, forceLocal),
45081               choice(id2, keepTheirs, forceRemote)
45082             ]
45083           });
45084         });
45085       }
45086     }
45087     function upload(changeset) {
45088       var osm = context.connection();
45089       if (!osm) {
45090         _errors.push({ msg: "No OSM Service" });
45091       }
45092       if (_conflicts.length) {
45093         didResultInConflicts(changeset);
45094       } else if (_errors.length) {
45095         didResultInErrors();
45096       } else {
45097         var history = context.history();
45098         var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
45099         if (changes.modified.length || changes.created.length || changes.deleted.length) {
45100           dispatch14.call("willAttemptUpload", this);
45101           osm.putChangeset(changeset, changes, uploadCallback);
45102         } else {
45103           didResultInNoChanges();
45104         }
45105       }
45106     }
45107     function uploadCallback(err, changeset) {
45108       if (err) {
45109         if (err.status === 409) {
45110           uploader.save(changeset, true, true);
45111         } else {
45112           _errors.push({
45113             msg: err.message || err.responseText,
45114             details: [_t("save.status_code", { code: err.status })]
45115           });
45116           didResultInErrors();
45117         }
45118       } else {
45119         didResultInSuccess(changeset);
45120       }
45121     }
45122     function didResultInNoChanges() {
45123       dispatch14.call("resultNoChanges", this);
45124       endSave();
45125       context.flush();
45126     }
45127     function didResultInErrors() {
45128       context.history().pop();
45129       dispatch14.call("resultErrors", this, _errors);
45130       endSave();
45131     }
45132     function didResultInConflicts(changeset) {
45133       _conflicts.sort(function(a2, b2) {
45134         return b2.id.localeCompare(a2.id);
45135       });
45136       dispatch14.call("resultConflicts", this, changeset, _conflicts, _origChanges);
45137       endSave();
45138     }
45139     function didResultInSuccess(changeset) {
45140       context.history().clearSaved();
45141       dispatch14.call("resultSuccess", this, changeset);
45142       window.setTimeout(function() {
45143         endSave();
45144         context.flush();
45145       }, 2500);
45146     }
45147     function endSave() {
45148       _isSaving = false;
45149       dispatch14.call("saveEnded", this);
45150     }
45151     uploader.cancelConflictResolution = function() {
45152       context.history().pop();
45153     };
45154     uploader.processResolvedConflicts = function(changeset) {
45155       var history = context.history();
45156       for (var i3 = 0; i3 < _conflicts.length; i3++) {
45157         if (_conflicts[i3].chosen === 1) {
45158           var entity = context.hasEntity(_conflicts[i3].id);
45159           if (entity && entity.type === "way") {
45160             var children2 = utilArrayUniq(entity.nodes);
45161             for (var j3 = 0; j3 < children2.length; j3++) {
45162               history.replace(actionRevert(children2[j3]));
45163             }
45164           }
45165           history.replace(actionRevert(_conflicts[i3].id));
45166         }
45167       }
45168       uploader.save(changeset, true, false);
45169     };
45170     uploader.reset = function() {
45171     };
45172     return uploader;
45173   }
45174
45175   // modules/renderer/background_source.js
45176   var import_lodash4 = __toESM(require_lodash());
45177
45178   // modules/util/IntervalTasksQueue.js
45179   var IntervalTasksQueue = class {
45180     /**
45181      * Interval in milliseconds inside which only 1 task can execute.
45182      * e.g. if interval is 200ms, and 5 async tasks are unqueued,
45183      * they will complete in ~1s if not cleared
45184      * @param {number} intervalInMs
45185      */
45186     constructor(intervalInMs) {
45187       this.intervalInMs = intervalInMs;
45188       this.pendingHandles = [];
45189       this.time = 0;
45190     }
45191     enqueue(task) {
45192       let taskTimeout = this.time;
45193       this.time += this.intervalInMs;
45194       this.pendingHandles.push(setTimeout(() => {
45195         this.time -= this.intervalInMs;
45196         task();
45197       }, taskTimeout));
45198     }
45199     clear() {
45200       this.pendingHandles.forEach((timeoutHandle) => {
45201         clearTimeout(timeoutHandle);
45202       });
45203       this.pendingHandles = [];
45204       this.time = 0;
45205     }
45206   };
45207
45208   // modules/renderer/background_source.js
45209   var isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
45210   window.matchMedia("\n        (-webkit-min-device-pixel-ratio: 2), /* Safari */\n        (min-resolution: 2dppx),             /* standard */\n        (min-resolution: 192dpi)             /* fallback */\n    ").addListener(function() {
45211     isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
45212   });
45213   function localeDateString(s2) {
45214     if (!s2)
45215       return null;
45216     var options2 = { day: "numeric", month: "short", year: "numeric" };
45217     var d2 = new Date(s2);
45218     if (isNaN(d2.getTime()))
45219       return null;
45220     return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
45221   }
45222   function vintageRange(vintage) {
45223     var s2;
45224     if (vintage.start || vintage.end) {
45225       s2 = vintage.start || "?";
45226       if (vintage.start !== vintage.end) {
45227         s2 += " - " + (vintage.end || "?");
45228       }
45229     }
45230     return s2;
45231   }
45232   function rendererBackgroundSource(data) {
45233     var source = Object.assign({}, data);
45234     var _offset = [0, 0];
45235     var _name = source.name;
45236     var _description = source.description;
45237     var _best = !!source.best;
45238     var _template = source.encrypted ? utilAesDecrypt(source.template) : source.template;
45239     source.tileSize = data.tileSize || 256;
45240     source.zoomExtent = data.zoomExtent || [0, 22];
45241     source.overzoom = data.overzoom !== false;
45242     source.offset = function(val) {
45243       if (!arguments.length)
45244         return _offset;
45245       _offset = val;
45246       return source;
45247     };
45248     source.nudge = function(val, zoomlevel) {
45249       _offset[0] += val[0] / Math.pow(2, zoomlevel);
45250       _offset[1] += val[1] / Math.pow(2, zoomlevel);
45251       return source;
45252     };
45253     source.name = function() {
45254       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
45255       return _t("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) });
45256     };
45257     source.label = function() {
45258       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
45259       return _t.append("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) });
45260     };
45261     source.hasDescription = function() {
45262       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
45263       var descriptionText = _mainLocalizer.tInfo("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) }).text;
45264       return descriptionText !== "";
45265     };
45266     source.description = function() {
45267       var id_safe = source.id.replace(/\./g, "<TX_DOT>");
45268       return _t.append("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) });
45269     };
45270     source.best = function() {
45271       return _best;
45272     };
45273     source.area = function() {
45274       if (!data.polygon)
45275         return Number.MAX_VALUE;
45276       var area = area_default({ type: "MultiPolygon", coordinates: [data.polygon] });
45277       return isNaN(area) ? 0 : area;
45278     };
45279     source.imageryUsed = function() {
45280       return _name || source.id;
45281     };
45282     source.template = function(val) {
45283       if (!arguments.length)
45284         return _template;
45285       if (source.id === "custom" || source.id === "Bing") {
45286         _template = val;
45287       }
45288       return source;
45289     };
45290     source.url = function(coord2) {
45291       var result = _template.replace(new RegExp("#[\\s\\S]*", "u"), "");
45292       if (result === "")
45293         return result;
45294       if (!source.type || source.id === "custom") {
45295         if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) {
45296           source.type = "wms";
45297           source.projection = "EPSG:3857";
45298         } else if (/\{(x|y)\}/.test(result)) {
45299           source.type = "tms";
45300         } else if (/\{u\}/.test(result)) {
45301           source.type = "bing";
45302         }
45303       }
45304       if (source.type === "wms") {
45305         var tileToProjectedCoords = function(x2, y2, z2) {
45306           var zoomSize = Math.pow(2, z2);
45307           var lon = x2 / zoomSize * Math.PI * 2 - Math.PI;
45308           var lat = Math.atan(Math.sinh(Math.PI * (1 - 2 * y2 / zoomSize)));
45309           switch (source.projection) {
45310             case "EPSG:4326":
45311               return {
45312                 x: lon * 180 / Math.PI,
45313                 y: lat * 180 / Math.PI
45314               };
45315             default:
45316               var mercCoords = mercatorRaw(lon, lat);
45317               return {
45318                 x: 2003750834e-2 / Math.PI * mercCoords[0],
45319                 y: 2003750834e-2 / Math.PI * mercCoords[1]
45320               };
45321           }
45322         };
45323         var tileSize = source.tileSize;
45324         var projection2 = source.projection;
45325         var minXmaxY = tileToProjectedCoords(coord2[0], coord2[1], coord2[2]);
45326         var maxXminY = tileToProjectedCoords(coord2[0] + 1, coord2[1] + 1, coord2[2]);
45327         result = result.replace(/\{(\w+)\}/g, function(token, key) {
45328           switch (key) {
45329             case "width":
45330             case "height":
45331               return tileSize;
45332             case "proj":
45333               return projection2;
45334             case "wkid":
45335               return projection2.replace(/^EPSG:/, "");
45336             case "bbox":
45337               if (projection2 === "EPSG:4326" && // The CRS parameter implies version 1.3 (prior versions use SRS)
45338               /VERSION=1.3|CRS={proj}/.test(source.template().toUpperCase())) {
45339                 return maxXminY.y + "," + minXmaxY.x + "," + minXmaxY.y + "," + maxXminY.x;
45340               } else {
45341                 return minXmaxY.x + "," + maxXminY.y + "," + maxXminY.x + "," + minXmaxY.y;
45342               }
45343             case "w":
45344               return minXmaxY.x;
45345             case "s":
45346               return maxXminY.y;
45347             case "n":
45348               return maxXminY.x;
45349             case "e":
45350               return minXmaxY.y;
45351             default:
45352               return token;
45353           }
45354         });
45355       } else if (source.type === "tms") {
45356         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" : "");
45357       } else if (source.type === "bing") {
45358         result = result.replace("{u}", function() {
45359           var u2 = "";
45360           for (var zoom = coord2[2]; zoom > 0; zoom--) {
45361             var b2 = 0;
45362             var mask = 1 << zoom - 1;
45363             if ((coord2[0] & mask) !== 0)
45364               b2++;
45365             if ((coord2[1] & mask) !== 0)
45366               b2 += 2;
45367             u2 += b2.toString();
45368           }
45369           return u2;
45370         });
45371       }
45372       result = result.replace(/\{switch:([^}]+)\}/, function(s2, r2) {
45373         var subdomains = r2.split(",");
45374         return subdomains[(coord2[0] + coord2[1]) % subdomains.length];
45375       });
45376       return result;
45377     };
45378     source.validZoom = function(z2) {
45379       return source.zoomExtent[0] <= z2 && (source.overzoom || source.zoomExtent[1] > z2);
45380     };
45381     source.isLocatorOverlay = function() {
45382       return source.id === "mapbox_locator_overlay";
45383     };
45384     source.isHidden = function() {
45385       return source.id === "DigitalGlobe-Premium-vintage" || source.id === "DigitalGlobe-Standard-vintage";
45386     };
45387     source.copyrightNotices = function() {
45388     };
45389     source.getMetadata = function(center, tileCoord, callback) {
45390       var vintage = {
45391         start: localeDateString(source.startDate),
45392         end: localeDateString(source.endDate)
45393       };
45394       vintage.range = vintageRange(vintage);
45395       var metadata = { vintage };
45396       callback(null, metadata);
45397     };
45398     return source;
45399   }
45400   rendererBackgroundSource.Bing = function(data, dispatch14) {
45401     data.template = "https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=1&pr=odbl&n=z";
45402     var bing = rendererBackgroundSource(data);
45403     var key = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
45404     const strictParam = "n";
45405     var url = "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialOSM?include=ImageryProviders&uriScheme=https&key=" + key;
45406     var cache = {};
45407     var inflight = {};
45408     var providers = [];
45409     var taskQueue = new IntervalTasksQueue(250);
45410     var metadataLastZoom = -1;
45411     json_default(url).then(function(json) {
45412       let imageryResource = json.resourceSets[0].resources[0];
45413       let template = imageryResource.imageUrl;
45414       let subDomains = imageryResource.imageUrlSubdomains;
45415       let subDomainNumbers = subDomains.map((subDomain) => {
45416         return subDomain.substring(1);
45417       }).join(",");
45418       template = template.replace("{subdomain}", "t{switch:".concat(subDomainNumbers, "}")).replace("{quadkey}", "{u}");
45419       if (!new URLSearchParams(template).has(strictParam)) {
45420         template += "&".concat(strictParam, "=z");
45421       }
45422       bing.template(template);
45423       providers = imageryResource.imageryProviders.map(function(provider) {
45424         return {
45425           attribution: provider.attribution,
45426           areas: provider.coverageAreas.map(function(area) {
45427             return {
45428               zoom: [area.zoomMin, area.zoomMax],
45429               extent: geoExtent([area.bbox[1], area.bbox[0]], [area.bbox[3], area.bbox[2]])
45430             };
45431           })
45432         };
45433       });
45434       dispatch14.call("change");
45435     }).catch(function() {
45436     });
45437     bing.copyrightNotices = function(zoom, extent) {
45438       zoom = Math.min(zoom, 21);
45439       return providers.filter(function(provider) {
45440         return provider.areas.some(function(area) {
45441           return extent.intersects(area.extent) && area.zoom[0] <= zoom && area.zoom[1] >= zoom;
45442         });
45443       }).map(function(provider) {
45444         return provider.attribution;
45445       }).join(", ");
45446     };
45447     bing.getMetadata = function(center, tileCoord, callback) {
45448       var tileID = tileCoord.slice(0, 3).join("/");
45449       var zoom = Math.min(tileCoord[2], 21);
45450       var centerPoint = center[1] + "," + center[0];
45451       var url2 = "https://dev.virtualearth.net/REST/v1/Imagery/BasicMetadata/AerialOSM/" + centerPoint + "?zl=" + zoom + "&key=" + key;
45452       if (inflight[tileID])
45453         return;
45454       if (!cache[tileID]) {
45455         cache[tileID] = {};
45456       }
45457       if (cache[tileID] && cache[tileID].metadata) {
45458         return callback(null, cache[tileID].metadata);
45459       }
45460       inflight[tileID] = true;
45461       if (metadataLastZoom !== tileCoord[2]) {
45462         metadataLastZoom = tileCoord[2];
45463         taskQueue.clear();
45464       }
45465       taskQueue.enqueue(() => {
45466         json_default(url2).then(function(result) {
45467           delete inflight[tileID];
45468           if (!result) {
45469             throw new Error("Unknown Error");
45470           }
45471           var vintage = {
45472             start: localeDateString(result.resourceSets[0].resources[0].vintageStart),
45473             end: localeDateString(result.resourceSets[0].resources[0].vintageEnd)
45474           };
45475           vintage.range = vintageRange(vintage);
45476           var metadata = { vintage };
45477           cache[tileID].metadata = metadata;
45478           if (callback)
45479             callback(null, metadata);
45480         }).catch(function(err) {
45481           delete inflight[tileID];
45482           if (callback)
45483             callback(err.message);
45484         });
45485       });
45486     };
45487     bing.terms_url = "https://blog.openstreetmap.org/2010/11/30/microsoft-imagery-details";
45488     return bing;
45489   };
45490   rendererBackgroundSource.Esri = function(data) {
45491     if (data.template.match(/blankTile/) === null) {
45492       data.template = data.template + "?blankTile=false";
45493     }
45494     var esri = rendererBackgroundSource(data);
45495     var cache = {};
45496     var inflight = {};
45497     var _prevCenter;
45498     esri.fetchTilemap = function(center) {
45499       if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5e3)
45500         return;
45501       _prevCenter = center;
45502       var z2 = 20;
45503       var dummyUrl = esri.url([1, 2, 3]);
45504       var x2 = Math.floor((center[0] + 180) / 360 * Math.pow(2, z2));
45505       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));
45506       var tilemapUrl = dummyUrl.replace(/tile\/[0-9]+\/[0-9]+\/[0-9]+\?blankTile=false/, "tilemap") + "/" + z2 + "/" + y2 + "/" + x2 + "/8/8";
45507       json_default(tilemapUrl).then(function(tilemap) {
45508         if (!tilemap) {
45509           throw new Error("Unknown Error");
45510         }
45511         var hasTiles = true;
45512         for (var i3 = 0; i3 < tilemap.data.length; i3++) {
45513           if (!tilemap.data[i3]) {
45514             hasTiles = false;
45515             break;
45516           }
45517         }
45518         esri.zoomExtent[1] = hasTiles ? 22 : 19;
45519       }).catch(function() {
45520       });
45521     };
45522     esri.getMetadata = function(center, tileCoord, callback) {
45523       if (esri.id !== "EsriWorldImagery") {
45524         return callback(null, {});
45525       }
45526       var tileID = tileCoord.slice(0, 3).join("/");
45527       var zoom = Math.min(tileCoord[2], esri.zoomExtent[1]);
45528       var centerPoint = center[0] + "," + center[1];
45529       var unknown = _t("info_panels.background.unknown");
45530       var vintage = {};
45531       var metadata = {};
45532       if (inflight[tileID])
45533         return;
45534       var url = "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/4/query";
45535       url += "?returnGeometry=false&geometry=" + centerPoint + "&inSR=4326&geometryType=esriGeometryPoint&outFields=*&f=json";
45536       if (!cache[tileID]) {
45537         cache[tileID] = {};
45538       }
45539       if (cache[tileID] && cache[tileID].metadata) {
45540         return callback(null, cache[tileID].metadata);
45541       }
45542       inflight[tileID] = true;
45543       json_default(url).then(function(result) {
45544         delete inflight[tileID];
45545         result = result.features.map((f3) => f3.attributes).filter((a2) => a2.MinMapLevel <= zoom && a2.MaxMapLevel >= zoom)[0];
45546         if (!result) {
45547           throw new Error("Unknown Error");
45548         } else if (result.features && result.features.length < 1) {
45549           throw new Error("No Results");
45550         } else if (result.error && result.error.message) {
45551           throw new Error(result.error.message);
45552         }
45553         var captureDate = localeDateString(result.SRC_DATE2);
45554         vintage = {
45555           start: captureDate,
45556           end: captureDate,
45557           range: captureDate
45558         };
45559         metadata = {
45560           vintage,
45561           source: clean2(result.NICE_NAME),
45562           description: clean2(result.NICE_DESC),
45563           resolution: clean2(+Number(result.SRC_RES).toFixed(4)),
45564           accuracy: clean2(+Number(result.SRC_ACC).toFixed(4))
45565         };
45566         if (isFinite(metadata.resolution)) {
45567           metadata.resolution += " m";
45568         }
45569         if (isFinite(metadata.accuracy)) {
45570           metadata.accuracy += " m";
45571         }
45572         cache[tileID].metadata = metadata;
45573         if (callback)
45574           callback(null, metadata);
45575       }).catch(function(err) {
45576         delete inflight[tileID];
45577         if (callback)
45578           callback(err.message);
45579       });
45580       function clean2(val) {
45581         return String(val).trim() || unknown;
45582       }
45583     };
45584     return esri;
45585   };
45586   rendererBackgroundSource.None = function() {
45587     var source = rendererBackgroundSource({ id: "none", template: "" });
45588     source.name = function() {
45589       return _t("background.none");
45590     };
45591     source.label = function() {
45592       return _t.append("background.none");
45593     };
45594     source.imageryUsed = function() {
45595       return null;
45596     };
45597     source.area = function() {
45598       return -1;
45599     };
45600     return source;
45601   };
45602   rendererBackgroundSource.Custom = function(template) {
45603     var source = rendererBackgroundSource({ id: "custom", template });
45604     source.name = function() {
45605       return _t("background.custom");
45606     };
45607     source.label = function() {
45608       return _t.append("background.custom");
45609     };
45610     source.imageryUsed = function() {
45611       var cleaned = source.template();
45612       if (cleaned.indexOf("?") !== -1) {
45613         var parts = cleaned.split("?", 2);
45614         var qs = utilStringQs(parts[1]);
45615         ["access_token", "connectId", "token"].forEach(function(param) {
45616           if (qs[param]) {
45617             qs[param] = "{apikey}";
45618           }
45619         });
45620         cleaned = parts[0] + "?" + utilQsString(qs, true);
45621       }
45622       cleaned = cleaned.replace(/token\/(\w+)/, "token/{apikey}").replace(/key=(\w+)/, "key={apikey}");
45623       return "Custom (" + cleaned + " )";
45624     };
45625     source.area = function() {
45626       return -2;
45627     };
45628     return source;
45629   };
45630
45631   // node_modules/@turf/helpers/dist/es/index.js
45632   var earthRadius = 63710088e-1;
45633   var factors = {
45634     centimeters: earthRadius * 100,
45635     centimetres: earthRadius * 100,
45636     degrees: earthRadius / 111325,
45637     feet: earthRadius * 3.28084,
45638     inches: earthRadius * 39.37,
45639     kilometers: earthRadius / 1e3,
45640     kilometres: earthRadius / 1e3,
45641     meters: earthRadius,
45642     metres: earthRadius,
45643     miles: earthRadius / 1609.344,
45644     millimeters: earthRadius * 1e3,
45645     millimetres: earthRadius * 1e3,
45646     nauticalmiles: earthRadius / 1852,
45647     radians: 1,
45648     yards: earthRadius * 1.0936
45649   };
45650   var unitsFactors = {
45651     centimeters: 100,
45652     centimetres: 100,
45653     degrees: 1 / 111325,
45654     feet: 3.28084,
45655     inches: 39.37,
45656     kilometers: 1 / 1e3,
45657     kilometres: 1 / 1e3,
45658     meters: 1,
45659     metres: 1,
45660     miles: 1 / 1609.344,
45661     millimeters: 1e3,
45662     millimetres: 1e3,
45663     nauticalmiles: 1 / 1852,
45664     radians: 1 / earthRadius,
45665     yards: 1.0936133
45666   };
45667   function feature2(geom, properties, options2) {
45668     if (options2 === void 0) {
45669       options2 = {};
45670     }
45671     var feat = { type: "Feature" };
45672     if (options2.id === 0 || options2.id) {
45673       feat.id = options2.id;
45674     }
45675     if (options2.bbox) {
45676       feat.bbox = options2.bbox;
45677     }
45678     feat.properties = properties || {};
45679     feat.geometry = geom;
45680     return feat;
45681   }
45682   function polygon(coordinates, properties, options2) {
45683     if (options2 === void 0) {
45684       options2 = {};
45685     }
45686     for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
45687       var ring = coordinates_1[_i];
45688       if (ring.length < 4) {
45689         throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
45690       }
45691       for (var j3 = 0; j3 < ring[ring.length - 1].length; j3++) {
45692         if (ring[ring.length - 1][j3] !== ring[0][j3]) {
45693           throw new Error("First and last Position are not equivalent.");
45694         }
45695       }
45696     }
45697     var geom = {
45698       type: "Polygon",
45699       coordinates
45700     };
45701     return feature2(geom, properties, options2);
45702   }
45703   function lineString(coordinates, properties, options2) {
45704     if (options2 === void 0) {
45705       options2 = {};
45706     }
45707     if (coordinates.length < 2) {
45708       throw new Error("coordinates must be an array of two or more positions");
45709     }
45710     var geom = {
45711       type: "LineString",
45712       coordinates
45713     };
45714     return feature2(geom, properties, options2);
45715   }
45716   function multiLineString(coordinates, properties, options2) {
45717     if (options2 === void 0) {
45718       options2 = {};
45719     }
45720     var geom = {
45721       type: "MultiLineString",
45722       coordinates
45723     };
45724     return feature2(geom, properties, options2);
45725   }
45726   function multiPolygon(coordinates, properties, options2) {
45727     if (options2 === void 0) {
45728       options2 = {};
45729     }
45730     var geom = {
45731       type: "MultiPolygon",
45732       coordinates
45733     };
45734     return feature2(geom, properties, options2);
45735   }
45736
45737   // node_modules/@turf/invariant/dist/es/index.js
45738   function getGeom(geojson) {
45739     if (geojson.type === "Feature") {
45740       return geojson.geometry;
45741     }
45742     return geojson;
45743   }
45744
45745   // node_modules/@turf/bbox-clip/dist/es/lib/lineclip.js
45746   function lineclip(points, bbox2, result) {
45747     var len = points.length, codeA = bitCode(points[0], bbox2), part = [], i3, codeB, lastCode;
45748     var a2;
45749     var b2;
45750     if (!result)
45751       result = [];
45752     for (i3 = 1; i3 < len; i3++) {
45753       a2 = points[i3 - 1];
45754       b2 = points[i3];
45755       codeB = lastCode = bitCode(b2, bbox2);
45756       while (true) {
45757         if (!(codeA | codeB)) {
45758           part.push(a2);
45759           if (codeB !== lastCode) {
45760             part.push(b2);
45761             if (i3 < len - 1) {
45762               result.push(part);
45763               part = [];
45764             }
45765           } else if (i3 === len - 1) {
45766             part.push(b2);
45767           }
45768           break;
45769         } else if (codeA & codeB) {
45770           break;
45771         } else if (codeA) {
45772           a2 = intersect(a2, b2, codeA, bbox2);
45773           codeA = bitCode(a2, bbox2);
45774         } else {
45775           b2 = intersect(a2, b2, codeB, bbox2);
45776           codeB = bitCode(b2, bbox2);
45777         }
45778       }
45779       codeA = lastCode;
45780     }
45781     if (part.length)
45782       result.push(part);
45783     return result;
45784   }
45785   function polygonclip(points, bbox2) {
45786     var result, edge, prev, prevInside, i3, p2, inside;
45787     for (edge = 1; edge <= 8; edge *= 2) {
45788       result = [];
45789       prev = points[points.length - 1];
45790       prevInside = !(bitCode(prev, bbox2) & edge);
45791       for (i3 = 0; i3 < points.length; i3++) {
45792         p2 = points[i3];
45793         inside = !(bitCode(p2, bbox2) & edge);
45794         if (inside !== prevInside)
45795           result.push(intersect(prev, p2, edge, bbox2));
45796         if (inside)
45797           result.push(p2);
45798         prev = p2;
45799         prevInside = inside;
45800       }
45801       points = result;
45802       if (!points.length)
45803         break;
45804     }
45805     return result;
45806   }
45807   function intersect(a2, b2, edge, bbox2) {
45808     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;
45809   }
45810   function bitCode(p2, bbox2) {
45811     var code = 0;
45812     if (p2[0] < bbox2[0])
45813       code |= 1;
45814     else if (p2[0] > bbox2[2])
45815       code |= 2;
45816     if (p2[1] < bbox2[1])
45817       code |= 4;
45818     else if (p2[1] > bbox2[3])
45819       code |= 8;
45820     return code;
45821   }
45822
45823   // node_modules/@turf/bbox-clip/dist/es/index.js
45824   function bboxClip(feature3, bbox2) {
45825     var geom = getGeom(feature3);
45826     var type2 = geom.type;
45827     var properties = feature3.type === "Feature" ? feature3.properties : {};
45828     var coords = geom.coordinates;
45829     switch (type2) {
45830       case "LineString":
45831       case "MultiLineString": {
45832         var lines_1 = [];
45833         if (type2 === "LineString") {
45834           coords = [coords];
45835         }
45836         coords.forEach(function(line) {
45837           lineclip(line, bbox2, lines_1);
45838         });
45839         if (lines_1.length === 1) {
45840           return lineString(lines_1[0], properties);
45841         }
45842         return multiLineString(lines_1, properties);
45843       }
45844       case "Polygon":
45845         return polygon(clipPolygon(coords, bbox2), properties);
45846       case "MultiPolygon":
45847         return multiPolygon(coords.map(function(poly) {
45848           return clipPolygon(poly, bbox2);
45849         }), properties);
45850       default:
45851         throw new Error("geometry " + type2 + " not supported");
45852     }
45853   }
45854   function clipPolygon(rings, bbox2) {
45855     var outRings = [];
45856     for (var _i = 0, rings_1 = rings; _i < rings_1.length; _i++) {
45857       var ring = rings_1[_i];
45858       var clipped = polygonclip(ring, bbox2);
45859       if (clipped.length > 0) {
45860         if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) {
45861           clipped.push(clipped[0]);
45862         }
45863         if (clipped.length >= 4) {
45864           outRings.push(clipped);
45865         }
45866       }
45867     }
45868     return outRings;
45869   }
45870
45871   // node_modules/@turf/meta/dist/es/index.js
45872   function coordEach(geojson, callback, excludeWrapCoord) {
45873     if (geojson === null)
45874       return;
45875     var j3, k2, l2, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type2 = geojson.type, isFeatureCollection = type2 === "FeatureCollection", isFeature = type2 === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
45876     for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
45877       geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
45878       isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
45879       stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
45880       for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
45881         var multiFeatureIndex = 0;
45882         var geometryIndex = 0;
45883         geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
45884         if (geometry === null)
45885           continue;
45886         coords = geometry.coordinates;
45887         var geomType = geometry.type;
45888         wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
45889         switch (geomType) {
45890           case null:
45891             break;
45892           case "Point":
45893             if (callback(
45894               coords,
45895               coordIndex,
45896               featureIndex,
45897               multiFeatureIndex,
45898               geometryIndex
45899             ) === false)
45900               return false;
45901             coordIndex++;
45902             multiFeatureIndex++;
45903             break;
45904           case "LineString":
45905           case "MultiPoint":
45906             for (j3 = 0; j3 < coords.length; j3++) {
45907               if (callback(
45908                 coords[j3],
45909                 coordIndex,
45910                 featureIndex,
45911                 multiFeatureIndex,
45912                 geometryIndex
45913               ) === false)
45914                 return false;
45915               coordIndex++;
45916               if (geomType === "MultiPoint")
45917                 multiFeatureIndex++;
45918             }
45919             if (geomType === "LineString")
45920               multiFeatureIndex++;
45921             break;
45922           case "Polygon":
45923           case "MultiLineString":
45924             for (j3 = 0; j3 < coords.length; j3++) {
45925               for (k2 = 0; k2 < coords[j3].length - wrapShrink; k2++) {
45926                 if (callback(
45927                   coords[j3][k2],
45928                   coordIndex,
45929                   featureIndex,
45930                   multiFeatureIndex,
45931                   geometryIndex
45932                 ) === false)
45933                   return false;
45934                 coordIndex++;
45935               }
45936               if (geomType === "MultiLineString")
45937                 multiFeatureIndex++;
45938               if (geomType === "Polygon")
45939                 geometryIndex++;
45940             }
45941             if (geomType === "Polygon")
45942               multiFeatureIndex++;
45943             break;
45944           case "MultiPolygon":
45945             for (j3 = 0; j3 < coords.length; j3++) {
45946               geometryIndex = 0;
45947               for (k2 = 0; k2 < coords[j3].length; k2++) {
45948                 for (l2 = 0; l2 < coords[j3][k2].length - wrapShrink; l2++) {
45949                   if (callback(
45950                     coords[j3][k2][l2],
45951                     coordIndex,
45952                     featureIndex,
45953                     multiFeatureIndex,
45954                     geometryIndex
45955                   ) === false)
45956                     return false;
45957                   coordIndex++;
45958                 }
45959                 geometryIndex++;
45960               }
45961               multiFeatureIndex++;
45962             }
45963             break;
45964           case "GeometryCollection":
45965             for (j3 = 0; j3 < geometry.geometries.length; j3++)
45966               if (coordEach(geometry.geometries[j3], callback, excludeWrapCoord) === false)
45967                 return false;
45968             break;
45969           default:
45970             throw new Error("Unknown Geometry Type");
45971         }
45972       }
45973     }
45974   }
45975
45976   // node_modules/@turf/bbox/dist/es/index.js
45977   function bbox(geojson) {
45978     var result = [Infinity, Infinity, -Infinity, -Infinity];
45979     coordEach(geojson, function(coord2) {
45980       if (result[0] > coord2[0]) {
45981         result[0] = coord2[0];
45982       }
45983       if (result[1] > coord2[1]) {
45984         result[1] = coord2[1];
45985       }
45986       if (result[2] < coord2[0]) {
45987         result[2] = coord2[0];
45988       }
45989       if (result[3] < coord2[1]) {
45990         result[3] = coord2[1];
45991       }
45992     });
45993     return result;
45994   }
45995   bbox["default"] = bbox;
45996   var es_default = bbox;
45997
45998   // modules/renderer/background.js
45999   var import_which_polygon3 = __toESM(require_which_polygon());
46000
46001   // modules/renderer/tile_layer.js
46002   function rendererTileLayer(context) {
46003     var transformProp = utilPrefixCSSProperty("Transform");
46004     var tiler9 = utilTiler();
46005     var _tileSize = 256;
46006     var _projection;
46007     var _cache5 = {};
46008     var _tileOrigin;
46009     var _zoom;
46010     var _source;
46011     function tileSizeAtZoom(d2, z2) {
46012       var EPSILON = 2e-3;
46013       return _tileSize * Math.pow(2, z2 - d2[2]) / _tileSize + EPSILON;
46014     }
46015     function atZoom(t2, distance) {
46016       var power = Math.pow(2, distance);
46017       return [
46018         Math.floor(t2[0] * power),
46019         Math.floor(t2[1] * power),
46020         t2[2] + distance
46021       ];
46022     }
46023     function lookUp(d2) {
46024       for (var up = -1; up > -d2[2]; up--) {
46025         var tile = atZoom(d2, up);
46026         if (_cache5[_source.url(tile)] !== false) {
46027           return tile;
46028         }
46029       }
46030     }
46031     function uniqueBy(a2, n3) {
46032       var o2 = [];
46033       var seen = {};
46034       for (var i3 = 0; i3 < a2.length; i3++) {
46035         if (seen[a2[i3][n3]] === void 0) {
46036           o2.push(a2[i3]);
46037           seen[a2[i3][n3]] = true;
46038         }
46039       }
46040       return o2;
46041     }
46042     function addSource(d2) {
46043       d2.push(_source.url(d2));
46044       return d2;
46045     }
46046     function background(selection2) {
46047       _zoom = geoScaleToZoom(_projection.scale(), _tileSize);
46048       var pixelOffset;
46049       if (_source) {
46050         pixelOffset = [
46051           _source.offset()[0] * Math.pow(2, _zoom),
46052           _source.offset()[1] * Math.pow(2, _zoom)
46053         ];
46054       } else {
46055         pixelOffset = [0, 0];
46056       }
46057       var translate = [
46058         _projection.translate()[0] + pixelOffset[0],
46059         _projection.translate()[1] + pixelOffset[1]
46060       ];
46061       tiler9.scale(_projection.scale() * 2 * Math.PI).translate(translate);
46062       _tileOrigin = [
46063         _projection.scale() * Math.PI - translate[0],
46064         _projection.scale() * Math.PI - translate[1]
46065       ];
46066       render(selection2);
46067     }
46068     function render(selection2) {
46069       if (!_source)
46070         return;
46071       var requests = [];
46072       var showDebug = context.getDebug("tile") && !_source.overlay;
46073       if (_source.validZoom(_zoom)) {
46074         tiler9.skipNullIsland(!!_source.overlay);
46075         tiler9().forEach(function(d2) {
46076           addSource(d2);
46077           if (d2[3] === "")
46078             return;
46079           if (typeof d2[3] !== "string")
46080             return;
46081           requests.push(d2);
46082           if (_cache5[d2[3]] === false && lookUp(d2)) {
46083             requests.push(addSource(lookUp(d2)));
46084           }
46085         });
46086         requests = uniqueBy(requests, 3).filter(function(r2) {
46087           return _cache5[r2[3]] !== false;
46088         });
46089       }
46090       function load(d3_event, d2) {
46091         _cache5[d2[3]] = true;
46092         select_default2(this).on("error", null).on("load", null).classed("tile-loaded", true);
46093         render(selection2);
46094       }
46095       function error(d3_event, d2) {
46096         _cache5[d2[3]] = false;
46097         select_default2(this).on("error", null).on("load", null).remove();
46098         render(selection2);
46099       }
46100       function imageTransform(d2) {
46101         var ts = _tileSize * Math.pow(2, _zoom - d2[2]);
46102         var scale = tileSizeAtZoom(d2, _zoom);
46103         return "translate(" + (d2[0] * ts - _tileOrigin[0]) + "px," + (d2[1] * ts - _tileOrigin[1]) + "px) scale(" + scale + "," + scale + ")";
46104       }
46105       function tileCenter(d2) {
46106         var ts = _tileSize * Math.pow(2, _zoom - d2[2]);
46107         return [
46108           d2[0] * ts - _tileOrigin[0] + ts / 2,
46109           d2[1] * ts - _tileOrigin[1] + ts / 2
46110         ];
46111       }
46112       function debugTransform(d2) {
46113         var coord2 = tileCenter(d2);
46114         return "translate(" + coord2[0] + "px," + coord2[1] + "px)";
46115       }
46116       var dims = tiler9.size();
46117       var mapCenter = [dims[0] / 2, dims[1] / 2];
46118       var minDist = Math.max(dims[0], dims[1]);
46119       var nearCenter;
46120       requests.forEach(function(d2) {
46121         var c2 = tileCenter(d2);
46122         var dist = geoVecLength(c2, mapCenter);
46123         if (dist < minDist) {
46124           minDist = dist;
46125           nearCenter = d2;
46126         }
46127       });
46128       var image = selection2.selectAll("img").data(requests, function(d2) {
46129         return d2[3];
46130       });
46131       image.exit().style(transformProp, imageTransform).classed("tile-removing", true).classed("tile-center", false).each(function() {
46132         var tile = select_default2(this);
46133         window.setTimeout(function() {
46134           if (tile.classed("tile-removing")) {
46135             tile.remove();
46136           }
46137         }, 300);
46138       });
46139       image.enter().append("img").attr("class", "tile").attr("alt", "").attr("draggable", "false").style("width", _tileSize + "px").style("height", _tileSize + "px").attr("src", function(d2) {
46140         return d2[3];
46141       }).on("error", error).on("load", load).merge(image).style(transformProp, imageTransform).classed("tile-debug", showDebug).classed("tile-removing", false).classed("tile-center", function(d2) {
46142         return d2 === nearCenter;
46143       });
46144       var debug2 = selection2.selectAll(".tile-label-debug").data(showDebug ? requests : [], function(d2) {
46145         return d2[3];
46146       });
46147       debug2.exit().remove();
46148       if (showDebug) {
46149         var debugEnter = debug2.enter().append("div").attr("class", "tile-label-debug");
46150         debugEnter.append("div").attr("class", "tile-label-debug-coord");
46151         debugEnter.append("div").attr("class", "tile-label-debug-vintage");
46152         debug2 = debug2.merge(debugEnter);
46153         debug2.style(transformProp, debugTransform);
46154         debug2.selectAll(".tile-label-debug-coord").text(function(d2) {
46155           return d2[2] + " / " + d2[0] + " / " + d2[1];
46156         });
46157         debug2.selectAll(".tile-label-debug-vintage").each(function(d2) {
46158           var span = select_default2(this);
46159           var center = context.projection.invert(tileCenter(d2));
46160           _source.getMetadata(center, d2, function(err, result) {
46161             if (result && result.vintage && result.vintage.range) {
46162               span.text(result.vintage.range);
46163             } else {
46164               span.text("");
46165               span.call(_t.append("info_panels.background.vintage"));
46166               span.append("span").text(": ");
46167               span.call(_t.append("info_panels.background.unknown"));
46168             }
46169           });
46170         });
46171       }
46172     }
46173     background.projection = function(val) {
46174       if (!arguments.length)
46175         return _projection;
46176       _projection = val;
46177       return background;
46178     };
46179     background.dimensions = function(val) {
46180       if (!arguments.length)
46181         return tiler9.size();
46182       tiler9.size(val);
46183       return background;
46184     };
46185     background.source = function(val) {
46186       if (!arguments.length)
46187         return _source;
46188       _source = val;
46189       _tileSize = _source.tileSize;
46190       _cache5 = {};
46191       tiler9.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent);
46192       return background;
46193     };
46194     return background;
46195   }
46196
46197   // modules/renderer/background.js
46198   var _imageryIndex = null;
46199   function rendererBackground(context) {
46200     const dispatch14 = dispatch_default("change");
46201     const baseLayer = rendererTileLayer(context).projection(context.projection);
46202     let _checkedBlocklists = [];
46203     let _isValid = true;
46204     let _overlayLayers = [];
46205     let _brightness = 1;
46206     let _contrast = 1;
46207     let _saturation = 1;
46208     let _sharpness = 1;
46209     function ensureImageryIndex() {
46210       return _mainFileFetcher.get("imagery").then((sources) => {
46211         if (_imageryIndex)
46212           return _imageryIndex;
46213         _imageryIndex = {
46214           imagery: sources,
46215           features: {}
46216         };
46217         const features = sources.map((source) => {
46218           if (!source.polygon)
46219             return null;
46220           const rings = source.polygon.map((ring) => [ring]);
46221           const feature3 = {
46222             type: "Feature",
46223             properties: { id: source.id },
46224             geometry: { type: "MultiPolygon", coordinates: rings }
46225           };
46226           _imageryIndex.features[source.id] = feature3;
46227           return feature3;
46228         }).filter(Boolean);
46229         _imageryIndex.query = (0, import_which_polygon3.default)({ type: "FeatureCollection", features });
46230         _imageryIndex.backgrounds = sources.map((source) => {
46231           if (source.type === "bing") {
46232             return rendererBackgroundSource.Bing(source, dispatch14);
46233           } else if (/^EsriWorldImagery/.test(source.id)) {
46234             return rendererBackgroundSource.Esri(source);
46235           } else {
46236             return rendererBackgroundSource(source);
46237           }
46238         });
46239         _imageryIndex.backgrounds.unshift(rendererBackgroundSource.None());
46240         let template = corePreferences("background-custom-template") || "";
46241         const custom = rendererBackgroundSource.Custom(template);
46242         _imageryIndex.backgrounds.unshift(custom);
46243         return _imageryIndex;
46244       });
46245     }
46246     function background(selection2) {
46247       const currSource = baseLayer.source();
46248       if (context.map().zoom() > 18) {
46249         if (currSource && /^EsriWorldImagery/.test(currSource.id)) {
46250           const center = context.map().center();
46251           currSource.fetchTilemap(center);
46252         }
46253       }
46254       const sources = background.sources(context.map().extent());
46255       const wasValid = _isValid;
46256       _isValid = !!sources.filter((d2) => d2 === currSource).length;
46257       if (wasValid !== _isValid) {
46258         background.updateImagery();
46259       }
46260       let baseFilter = "";
46261       if (_brightness !== 1) {
46262         baseFilter += " brightness(".concat(_brightness, ")");
46263       }
46264       if (_contrast !== 1) {
46265         baseFilter += " contrast(".concat(_contrast, ")");
46266       }
46267       if (_saturation !== 1) {
46268         baseFilter += " saturate(".concat(_saturation, ")");
46269       }
46270       if (_sharpness < 1) {
46271         const blur = number_default(0.5, 5)(1 - _sharpness);
46272         baseFilter += " blur(".concat(blur, "px)");
46273       }
46274       let base = selection2.selectAll(".layer-background").data([0]);
46275       base = base.enter().insert("div", ".layer-data").attr("class", "layer layer-background").merge(base);
46276       base.style("filter", baseFilter || null);
46277       let imagery = base.selectAll(".layer-imagery").data([0]);
46278       imagery.enter().append("div").attr("class", "layer layer-imagery").merge(imagery).call(baseLayer);
46279       let maskFilter = "";
46280       let mixBlendMode = "";
46281       if (_sharpness > 1) {
46282         mixBlendMode = "overlay";
46283         maskFilter = "saturate(0) blur(3px) invert(1)";
46284         let contrast = _sharpness - 1;
46285         maskFilter += " contrast(".concat(contrast, ")");
46286         let brightness = number_default(1, 0.85)(_sharpness - 1);
46287         maskFilter += " brightness(".concat(brightness, ")");
46288       }
46289       let mask = base.selectAll(".layer-unsharp-mask").data(_sharpness > 1 ? [0] : []);
46290       mask.exit().remove();
46291       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);
46292       let overlays = selection2.selectAll(".layer-overlay").data(_overlayLayers, (d2) => d2.source().name());
46293       overlays.exit().remove();
46294       overlays.enter().insert("div", ".layer-data").attr("class", "layer layer-overlay").merge(overlays).each((layer, i3, nodes) => select_default2(nodes[i3]).call(layer));
46295     }
46296     background.updateImagery = function() {
46297       let currSource = baseLayer.source();
46298       if (context.inIntro() || !currSource)
46299         return;
46300       let o2 = _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).map((d2) => d2.source().id).join(",");
46301       const meters = geoOffsetToMeters(currSource.offset());
46302       const EPSILON = 0.01;
46303       const x2 = +meters[0].toFixed(2);
46304       const y2 = +meters[1].toFixed(2);
46305       let hash = utilStringQs(window.location.hash);
46306       let id2 = currSource.id;
46307       if (id2 === "custom") {
46308         id2 = "custom:".concat(currSource.template());
46309       }
46310       if (id2) {
46311         hash.background = id2;
46312       } else {
46313         delete hash.background;
46314       }
46315       if (o2) {
46316         hash.overlays = o2;
46317       } else {
46318         delete hash.overlays;
46319       }
46320       if (Math.abs(x2) > EPSILON || Math.abs(y2) > EPSILON) {
46321         hash.offset = "".concat(x2, ",").concat(y2);
46322       } else {
46323         delete hash.offset;
46324       }
46325       if (!window.mocha) {
46326         window.location.replace("#" + utilQsString(hash, true));
46327       }
46328       let imageryUsed = [];
46329       let photoOverlaysUsed = [];
46330       const currUsed = currSource.imageryUsed();
46331       if (currUsed && _isValid) {
46332         imageryUsed.push(currUsed);
46333       }
46334       _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).forEach((d2) => imageryUsed.push(d2.source().imageryUsed()));
46335       const dataLayer = context.layers().layer("data");
46336       if (dataLayer && dataLayer.enabled() && dataLayer.hasData()) {
46337         imageryUsed.push(dataLayer.getSrc());
46338       }
46339       const photoOverlayLayers = {
46340         streetside: "Bing Streetside",
46341         mapillary: "Mapillary Images",
46342         "mapillary-map-features": "Mapillary Map Features",
46343         "mapillary-signs": "Mapillary Signs",
46344         kartaview: "KartaView Images",
46345         vegbilder: "Norwegian Road Administration Images",
46346         mapilio: "Mapilio Images"
46347       };
46348       for (let layerID in photoOverlayLayers) {
46349         const layer = context.layers().layer(layerID);
46350         if (layer && layer.enabled()) {
46351           photoOverlaysUsed.push(layerID);
46352           imageryUsed.push(photoOverlayLayers[layerID]);
46353         }
46354       }
46355       context.history().imageryUsed(imageryUsed);
46356       context.history().photoOverlaysUsed(photoOverlaysUsed);
46357     };
46358     background.sources = (extent, zoom, includeCurrent) => {
46359       if (!_imageryIndex)
46360         return [];
46361       let visible = {};
46362       (_imageryIndex.query.bbox(extent.rectangle(), true) || []).forEach((d2) => visible[d2.id] = true);
46363       const currSource = baseLayer.source();
46364       const osm = context.connection();
46365       const blocklists = osm && osm.imageryBlocklists() || [];
46366       const blocklistChanged = blocklists.length !== _checkedBlocklists.length || blocklists.some((regex, index) => String(regex) !== _checkedBlocklists[index]);
46367       if (blocklistChanged) {
46368         _imageryIndex.backgrounds.forEach((source) => {
46369           source.isBlocked = blocklists.some((regex) => regex.test(source.template()));
46370         });
46371         _checkedBlocklists = blocklists.map((regex) => String(regex));
46372       }
46373       return _imageryIndex.backgrounds.filter((source) => {
46374         if (includeCurrent && currSource === source)
46375           return true;
46376         if (source.isBlocked)
46377           return false;
46378         if (!source.polygon)
46379           return true;
46380         if (zoom && zoom < 6)
46381           return false;
46382         return visible[source.id];
46383       });
46384     };
46385     background.dimensions = (val) => {
46386       if (!val)
46387         return;
46388       baseLayer.dimensions(val);
46389       _overlayLayers.forEach((layer) => layer.dimensions(val));
46390     };
46391     background.baseLayerSource = function(d2) {
46392       if (!arguments.length)
46393         return baseLayer.source();
46394       const osm = context.connection();
46395       if (!osm)
46396         return background;
46397       const blocklists = osm.imageryBlocklists();
46398       const template = d2.template();
46399       let fail = false;
46400       let tested = 0;
46401       let regex;
46402       for (let i3 = 0; i3 < blocklists.length; i3++) {
46403         regex = blocklists[i3];
46404         fail = regex.test(template);
46405         tested++;
46406         if (fail)
46407           break;
46408       }
46409       if (!tested) {
46410         regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
46411         fail = regex.test(template);
46412       }
46413       baseLayer.source(!fail ? d2 : background.findSource("none"));
46414       dispatch14.call("change");
46415       background.updateImagery();
46416       return background;
46417     };
46418     background.findSource = (id2) => {
46419       if (!id2 || !_imageryIndex)
46420         return null;
46421       return _imageryIndex.backgrounds.find((d2) => d2.id && d2.id === id2);
46422     };
46423     background.bing = () => {
46424       background.baseLayerSource(background.findSource("Bing"));
46425     };
46426     background.showsLayer = (d2) => {
46427       const currSource = baseLayer.source();
46428       if (!d2 || !currSource)
46429         return false;
46430       return d2.id === currSource.id || _overlayLayers.some((layer) => d2.id === layer.source().id);
46431     };
46432     background.overlayLayerSources = () => {
46433       return _overlayLayers.map((layer) => layer.source());
46434     };
46435     background.toggleOverlayLayer = (d2) => {
46436       let layer;
46437       for (let i3 = 0; i3 < _overlayLayers.length; i3++) {
46438         layer = _overlayLayers[i3];
46439         if (layer.source() === d2) {
46440           _overlayLayers.splice(i3, 1);
46441           dispatch14.call("change");
46442           background.updateImagery();
46443           return;
46444         }
46445       }
46446       layer = rendererTileLayer(context).source(d2).projection(context.projection).dimensions(
46447         baseLayer.dimensions()
46448       );
46449       _overlayLayers.push(layer);
46450       dispatch14.call("change");
46451       background.updateImagery();
46452     };
46453     background.nudge = (d2, zoom) => {
46454       const currSource = baseLayer.source();
46455       if (currSource) {
46456         currSource.nudge(d2, zoom);
46457         dispatch14.call("change");
46458         background.updateImagery();
46459       }
46460       return background;
46461     };
46462     background.offset = function(d2) {
46463       const currSource = baseLayer.source();
46464       if (!arguments.length) {
46465         return currSource && currSource.offset() || [0, 0];
46466       }
46467       if (currSource) {
46468         currSource.offset(d2);
46469         dispatch14.call("change");
46470         background.updateImagery();
46471       }
46472       return background;
46473     };
46474     background.brightness = function(d2) {
46475       if (!arguments.length)
46476         return _brightness;
46477       _brightness = d2;
46478       if (context.mode())
46479         dispatch14.call("change");
46480       return background;
46481     };
46482     background.contrast = function(d2) {
46483       if (!arguments.length)
46484         return _contrast;
46485       _contrast = d2;
46486       if (context.mode())
46487         dispatch14.call("change");
46488       return background;
46489     };
46490     background.saturation = function(d2) {
46491       if (!arguments.length)
46492         return _saturation;
46493       _saturation = d2;
46494       if (context.mode())
46495         dispatch14.call("change");
46496       return background;
46497     };
46498     background.sharpness = function(d2) {
46499       if (!arguments.length)
46500         return _sharpness;
46501       _sharpness = d2;
46502       if (context.mode())
46503         dispatch14.call("change");
46504       return background;
46505     };
46506     let _loadPromise;
46507     background.ensureLoaded = () => {
46508       if (_loadPromise)
46509         return _loadPromise;
46510       return _loadPromise = ensureImageryIndex();
46511     };
46512     background.init = () => {
46513       const loadPromise = background.ensureLoaded();
46514       const hash = utilStringQs(window.location.hash);
46515       const requestedBackground = hash.background || hash.layer;
46516       const lastUsedBackground = corePreferences("background-last-used");
46517       return loadPromise.then((imageryIndex) => {
46518         const extent = context.map().extent();
46519         const validBackgrounds = background.sources(extent).filter((d2) => d2.id !== "none" && d2.id !== "custom");
46520         const first = validBackgrounds.length && validBackgrounds[0];
46521         const isLastUsedValid = !!validBackgrounds.find((d2) => d2.id && d2.id === lastUsedBackground);
46522         let best;
46523         if (!requestedBackground && extent) {
46524           const viewArea = extent.area();
46525           best = validBackgrounds.find((s2) => {
46526             if (!s2.best() || s2.overlay)
46527               return false;
46528             let bbox2 = es_default(bboxClip(
46529               { type: "MultiPolygon", coordinates: [s2.polygon || [extent.polygon()]] },
46530               extent.rectangle()
46531             ));
46532             let area = geoExtent(bbox2.slice(0, 2), bbox2.slice(2, 4)).area();
46533             return area / viewArea > 0.5;
46534           });
46535         }
46536         if (requestedBackground && requestedBackground.indexOf("custom:") === 0) {
46537           const template = requestedBackground.replace(/^custom:/, "");
46538           const custom = background.findSource("custom");
46539           background.baseLayerSource(custom.template(template));
46540           corePreferences("background-custom-template", template);
46541         } else {
46542           background.baseLayerSource(
46543             background.findSource(requestedBackground) || best || isLastUsedValid && background.findSource(lastUsedBackground) || background.findSource("Bing") || first || background.findSource("none")
46544           );
46545         }
46546         const locator = imageryIndex.backgrounds.find((d2) => d2.overlay && d2.default);
46547         if (locator) {
46548           background.toggleOverlayLayer(locator);
46549         }
46550         const overlays = (hash.overlays || "").split(",");
46551         overlays.forEach((overlay) => {
46552           overlay = background.findSource(overlay);
46553           if (overlay) {
46554             background.toggleOverlayLayer(overlay);
46555           }
46556         });
46557         if (hash.gpx) {
46558           const gpx2 = context.layers().layer("data");
46559           if (gpx2) {
46560             gpx2.url(hash.gpx, ".gpx");
46561           }
46562         }
46563         if (hash.offset) {
46564           const offset = hash.offset.replace(/;/g, ",").split(",").map((n3) => !isNaN(n3) && n3);
46565           if (offset.length === 2) {
46566             background.offset(geoMetersToOffset(offset));
46567           }
46568         }
46569       }).catch((err) => {
46570         console.error(err);
46571       });
46572     };
46573     return utilRebind(background, dispatch14, "on");
46574   }
46575
46576   // modules/renderer/features.js
46577   function rendererFeatures(context) {
46578     var dispatch14 = dispatch_default("change", "redraw");
46579     var features = utilRebind({}, dispatch14, "on");
46580     var _deferred2 = /* @__PURE__ */ new Set();
46581     var traffic_roads = {
46582       "motorway": true,
46583       "motorway_link": true,
46584       "trunk": true,
46585       "trunk_link": true,
46586       "primary": true,
46587       "primary_link": true,
46588       "secondary": true,
46589       "secondary_link": true,
46590       "tertiary": true,
46591       "tertiary_link": true,
46592       "residential": true,
46593       "unclassified": true,
46594       "living_street": true,
46595       "busway": true
46596     };
46597     var service_roads = {
46598       "service": true,
46599       "road": true,
46600       "track": true
46601     };
46602     var paths = {
46603       "path": true,
46604       "footway": true,
46605       "cycleway": true,
46606       "bridleway": true,
46607       "steps": true,
46608       "pedestrian": true
46609     };
46610     var _cullFactor = 1;
46611     var _cache5 = {};
46612     var _rules = {};
46613     var _stats = {};
46614     var _keys = [];
46615     var _hidden = [];
46616     var _forceVisible = {};
46617     function update() {
46618       if (!window.mocha) {
46619         var hash = utilStringQs(window.location.hash);
46620         var disabled = features.disabled();
46621         if (disabled.length) {
46622           hash.disable_features = disabled.join(",");
46623         } else {
46624           delete hash.disable_features;
46625         }
46626         window.location.replace("#" + utilQsString(hash, true));
46627         corePreferences("disabled-features", disabled.join(","));
46628       }
46629       _hidden = features.hidden();
46630       dispatch14.call("change");
46631       dispatch14.call("redraw");
46632     }
46633     function defineRule(k2, filter2, max3) {
46634       var isEnabled = true;
46635       _keys.push(k2);
46636       _rules[k2] = {
46637         filter: filter2,
46638         enabled: isEnabled,
46639         // whether the user wants it enabled..
46640         count: 0,
46641         currentMax: max3 || Infinity,
46642         defaultMax: max3 || Infinity,
46643         enable: function() {
46644           this.enabled = true;
46645           this.currentMax = this.defaultMax;
46646         },
46647         disable: function() {
46648           this.enabled = false;
46649           this.currentMax = 0;
46650         },
46651         hidden: function() {
46652           return this.count === 0 && !this.enabled || this.count > this.currentMax * _cullFactor;
46653         },
46654         autoHidden: function() {
46655           return this.hidden() && this.currentMax > 0;
46656         }
46657       };
46658     }
46659     defineRule("points", function isPoint(tags, geometry) {
46660       return geometry === "point";
46661     }, 200);
46662     defineRule("traffic_roads", function isTrafficRoad(tags) {
46663       return traffic_roads[tags.highway];
46664     });
46665     defineRule("service_roads", function isServiceRoad(tags) {
46666       return service_roads[tags.highway];
46667     });
46668     defineRule("paths", function isPath(tags) {
46669       return paths[tags.highway];
46670     });
46671     defineRule("buildings", function isBuilding(tags) {
46672       return !!tags.building && tags.building !== "no" || tags.parking === "multi-storey" || tags.parking === "sheds" || tags.parking === "carports" || tags.parking === "garage_boxes";
46673     }, 250);
46674     defineRule("building_parts", function isBuildingPart(tags) {
46675       return tags["building:part"];
46676     });
46677     defineRule("indoor", function isIndoor(tags) {
46678       return tags.indoor;
46679     });
46680     defineRule("landuse", function isLanduse(tags, geometry) {
46681       return geometry === "area" && !_rules.buildings.filter(tags) && !_rules.building_parts.filter(tags) && !_rules.indoor.filter(tags) && !_rules.water.filter(tags) && !_rules.pistes.filter(tags);
46682     });
46683     defineRule("boundaries", function isBoundary(tags, geometry) {
46684       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);
46685     });
46686     defineRule("water", function isWater(tags) {
46687       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";
46688     });
46689     defineRule("rail", function isRail(tags) {
46690       return (!!tags.railway || tags.landuse === "railway") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]);
46691     });
46692     defineRule("pistes", function isPiste(tags) {
46693       return tags["piste:type"];
46694     });
46695     defineRule("aerialways", function isPiste(tags) {
46696       return tags.aerialway && tags.aerialway !== "yes" && tags.aerialway !== "station";
46697     });
46698     defineRule("power", function isPower(tags) {
46699       return !!tags.power;
46700     });
46701     defineRule("past_future", function isPastFuture(tags) {
46702       if (traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]) {
46703         return false;
46704       }
46705       var strings = Object.keys(tags);
46706       for (var i3 = 0; i3 < strings.length; i3++) {
46707         var s2 = strings[i3];
46708         if (osmLifecyclePrefixes[s2] || osmLifecyclePrefixes[tags[s2]])
46709           return true;
46710       }
46711       return false;
46712     });
46713     defineRule("others", function isOther(tags, geometry) {
46714       return geometry === "line" || geometry === "area";
46715     });
46716     features.features = function() {
46717       return _rules;
46718     };
46719     features.keys = function() {
46720       return _keys;
46721     };
46722     features.enabled = function(k2) {
46723       if (!arguments.length) {
46724         return _keys.filter(function(k3) {
46725           return _rules[k3].enabled;
46726         });
46727       }
46728       return _rules[k2] && _rules[k2].enabled;
46729     };
46730     features.disabled = function(k2) {
46731       if (!arguments.length) {
46732         return _keys.filter(function(k3) {
46733           return !_rules[k3].enabled;
46734         });
46735       }
46736       return _rules[k2] && !_rules[k2].enabled;
46737     };
46738     features.hidden = function(k2) {
46739       if (!arguments.length) {
46740         return _keys.filter(function(k3) {
46741           return _rules[k3].hidden();
46742         });
46743       }
46744       return _rules[k2] && _rules[k2].hidden();
46745     };
46746     features.autoHidden = function(k2) {
46747       if (!arguments.length) {
46748         return _keys.filter(function(k3) {
46749           return _rules[k3].autoHidden();
46750         });
46751       }
46752       return _rules[k2] && _rules[k2].autoHidden();
46753     };
46754     features.enable = function(k2) {
46755       if (_rules[k2] && !_rules[k2].enabled) {
46756         _rules[k2].enable();
46757         update();
46758       }
46759     };
46760     features.enableAll = function() {
46761       var didEnable = false;
46762       for (var k2 in _rules) {
46763         if (!_rules[k2].enabled) {
46764           didEnable = true;
46765           _rules[k2].enable();
46766         }
46767       }
46768       if (didEnable)
46769         update();
46770     };
46771     features.disable = function(k2) {
46772       if (_rules[k2] && _rules[k2].enabled) {
46773         _rules[k2].disable();
46774         update();
46775       }
46776     };
46777     features.disableAll = function() {
46778       var didDisable = false;
46779       for (var k2 in _rules) {
46780         if (_rules[k2].enabled) {
46781           didDisable = true;
46782           _rules[k2].disable();
46783         }
46784       }
46785       if (didDisable)
46786         update();
46787     };
46788     features.toggle = function(k2) {
46789       if (_rules[k2]) {
46790         (function(f3) {
46791           return f3.enabled ? f3.disable() : f3.enable();
46792         })(_rules[k2]);
46793         update();
46794       }
46795     };
46796     features.resetStats = function() {
46797       for (var i3 = 0; i3 < _keys.length; i3++) {
46798         _rules[_keys[i3]].count = 0;
46799       }
46800       dispatch14.call("change");
46801     };
46802     features.gatherStats = function(d2, resolver, dimensions) {
46803       var needsRedraw = false;
46804       var types = utilArrayGroupBy(d2, "type");
46805       var entities = [].concat(types.relation || [], types.way || [], types.node || []);
46806       var currHidden, geometry, matches, i3, j3;
46807       for (i3 = 0; i3 < _keys.length; i3++) {
46808         _rules[_keys[i3]].count = 0;
46809       }
46810       _cullFactor = dimensions[0] * dimensions[1] / 1e6;
46811       for (i3 = 0; i3 < entities.length; i3++) {
46812         geometry = entities[i3].geometry(resolver);
46813         matches = Object.keys(features.getMatches(entities[i3], resolver, geometry));
46814         for (j3 = 0; j3 < matches.length; j3++) {
46815           _rules[matches[j3]].count++;
46816         }
46817       }
46818       currHidden = features.hidden();
46819       if (currHidden !== _hidden) {
46820         _hidden = currHidden;
46821         needsRedraw = true;
46822         dispatch14.call("change");
46823       }
46824       return needsRedraw;
46825     };
46826     features.stats = function() {
46827       for (var i3 = 0; i3 < _keys.length; i3++) {
46828         _stats[_keys[i3]] = _rules[_keys[i3]].count;
46829       }
46830       return _stats;
46831     };
46832     features.clear = function(d2) {
46833       for (var i3 = 0; i3 < d2.length; i3++) {
46834         features.clearEntity(d2[i3]);
46835       }
46836     };
46837     features.clearEntity = function(entity) {
46838       delete _cache5[osmEntity.key(entity)];
46839     };
46840     features.reset = function() {
46841       Array.from(_deferred2).forEach(function(handle) {
46842         window.cancelIdleCallback(handle);
46843         _deferred2.delete(handle);
46844       });
46845       _cache5 = {};
46846     };
46847     function relationShouldBeChecked(relation) {
46848       return relation.tags.type === "boundary";
46849     }
46850     features.getMatches = function(entity, resolver, geometry) {
46851       if (geometry === "vertex" || geometry === "relation" && !relationShouldBeChecked(entity))
46852         return {};
46853       var ent = osmEntity.key(entity);
46854       if (!_cache5[ent]) {
46855         _cache5[ent] = {};
46856       }
46857       if (!_cache5[ent].matches) {
46858         var matches = {};
46859         var hasMatch = false;
46860         for (var i3 = 0; i3 < _keys.length; i3++) {
46861           if (_keys[i3] === "others") {
46862             if (hasMatch)
46863               continue;
46864             if (entity.type === "way") {
46865               var parents = features.getParents(entity, resolver, geometry);
46866               if (parents.length === 1 && parents[0].isMultipolygon() || // 2b. or belongs only to boundary relations
46867               parents.length > 0 && parents.every(function(parent) {
46868                 return parent.tags.type === "boundary";
46869               })) {
46870                 var pkey = osmEntity.key(parents[0]);
46871                 if (_cache5[pkey] && _cache5[pkey].matches) {
46872                   matches = Object.assign({}, _cache5[pkey].matches);
46873                   continue;
46874                 }
46875               }
46876             }
46877           }
46878           if (_rules[_keys[i3]].filter(entity.tags, geometry)) {
46879             matches[_keys[i3]] = hasMatch = true;
46880           }
46881         }
46882         _cache5[ent].matches = matches;
46883       }
46884       return _cache5[ent].matches;
46885     };
46886     features.getParents = function(entity, resolver, geometry) {
46887       if (geometry === "point")
46888         return [];
46889       var ent = osmEntity.key(entity);
46890       if (!_cache5[ent]) {
46891         _cache5[ent] = {};
46892       }
46893       if (!_cache5[ent].parents) {
46894         var parents = [];
46895         if (geometry === "vertex") {
46896           parents = resolver.parentWays(entity);
46897         } else {
46898           parents = resolver.parentRelations(entity);
46899         }
46900         _cache5[ent].parents = parents;
46901       }
46902       return _cache5[ent].parents;
46903     };
46904     features.isHiddenPreset = function(preset, geometry) {
46905       if (!_hidden.length)
46906         return false;
46907       if (!preset.tags)
46908         return false;
46909       var test = preset.setTags({}, geometry);
46910       for (var key in _rules) {
46911         if (_rules[key].filter(test, geometry)) {
46912           if (_hidden.indexOf(key) !== -1) {
46913             return key;
46914           }
46915           return false;
46916         }
46917       }
46918       return false;
46919     };
46920     features.isHiddenFeature = function(entity, resolver, geometry) {
46921       if (!_hidden.length)
46922         return false;
46923       if (!entity.version)
46924         return false;
46925       if (_forceVisible[entity.id])
46926         return false;
46927       var matches = Object.keys(features.getMatches(entity, resolver, geometry));
46928       return matches.length && matches.every(function(k2) {
46929         return features.hidden(k2);
46930       });
46931     };
46932     features.isHiddenChild = function(entity, resolver, geometry) {
46933       if (!_hidden.length)
46934         return false;
46935       if (!entity.version || geometry === "point")
46936         return false;
46937       if (_forceVisible[entity.id])
46938         return false;
46939       var parents = features.getParents(entity, resolver, geometry);
46940       if (!parents.length)
46941         return false;
46942       for (var i3 = 0; i3 < parents.length; i3++) {
46943         if (!features.isHidden(parents[i3], resolver, parents[i3].geometry(resolver))) {
46944           return false;
46945         }
46946       }
46947       return true;
46948     };
46949     features.hasHiddenConnections = function(entity, resolver) {
46950       if (!_hidden.length)
46951         return false;
46952       var childNodes, connections;
46953       if (entity.type === "midpoint") {
46954         childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
46955         connections = [];
46956       } else {
46957         childNodes = entity.nodes ? resolver.childNodes(entity) : [];
46958         connections = features.getParents(entity, resolver, entity.geometry(resolver));
46959       }
46960       connections = childNodes.reduce(function(result, e3) {
46961         return resolver.isShared(e3) ? utilArrayUnion(result, resolver.parentWays(e3)) : result;
46962       }, connections);
46963       return connections.some(function(e3) {
46964         return features.isHidden(e3, resolver, e3.geometry(resolver));
46965       });
46966     };
46967     features.isHidden = function(entity, resolver, geometry) {
46968       if (!_hidden.length)
46969         return false;
46970       if (!entity.version)
46971         return false;
46972       var fn = geometry === "vertex" ? features.isHiddenChild : features.isHiddenFeature;
46973       return fn(entity, resolver, geometry);
46974     };
46975     features.filter = function(d2, resolver) {
46976       if (!_hidden.length)
46977         return d2;
46978       var result = [];
46979       for (var i3 = 0; i3 < d2.length; i3++) {
46980         var entity = d2[i3];
46981         if (!features.isHidden(entity, resolver, entity.geometry(resolver))) {
46982           result.push(entity);
46983         }
46984       }
46985       return result;
46986     };
46987     features.forceVisible = function(entityIDs) {
46988       if (!arguments.length)
46989         return Object.keys(_forceVisible);
46990       _forceVisible = {};
46991       for (var i3 = 0; i3 < entityIDs.length; i3++) {
46992         _forceVisible[entityIDs[i3]] = true;
46993         var entity = context.hasEntity(entityIDs[i3]);
46994         if (entity && entity.type === "relation") {
46995           for (var j3 in entity.members) {
46996             _forceVisible[entity.members[j3].id] = true;
46997           }
46998         }
46999       }
47000       return features;
47001     };
47002     features.init = function() {
47003       var storage = corePreferences("disabled-features");
47004       if (storage) {
47005         var storageDisabled = storage.replace(/;/g, ",").split(",");
47006         storageDisabled.forEach(features.disable);
47007       }
47008       var hash = utilStringQs(window.location.hash);
47009       if (hash.disable_features) {
47010         var hashDisabled = hash.disable_features.replace(/;/g, ",").split(",");
47011         hashDisabled.forEach(features.disable);
47012       }
47013     };
47014     context.history().on("merge.features", function(newEntities) {
47015       if (!newEntities)
47016         return;
47017       var handle = window.requestIdleCallback(function() {
47018         var graph = context.graph();
47019         var types = utilArrayGroupBy(newEntities, "type");
47020         var entities = [].concat(types.relation || [], types.way || [], types.node || []);
47021         for (var i3 = 0; i3 < entities.length; i3++) {
47022           var geometry = entities[i3].geometry(graph);
47023           features.getMatches(entities[i3], graph, geometry);
47024         }
47025       });
47026       _deferred2.add(handle);
47027     });
47028     return features;
47029   }
47030
47031   // modules/svg/areas.js
47032   var import_fast_deep_equal5 = __toESM(require_fast_deep_equal());
47033
47034   // modules/svg/helpers.js
47035   function svgPassiveVertex(node, graph, activeID) {
47036     if (!activeID)
47037       return 1;
47038     if (activeID === node.id)
47039       return 0;
47040     var parents = graph.parentWays(node);
47041     var i3, j3, nodes, isClosed, ix1, ix2, ix3, ix4, max3;
47042     for (i3 = 0; i3 < parents.length; i3++) {
47043       nodes = parents[i3].nodes;
47044       isClosed = parents[i3].isClosed();
47045       for (j3 = 0; j3 < nodes.length; j3++) {
47046         if (nodes[j3] === node.id) {
47047           ix1 = j3 - 2;
47048           ix2 = j3 - 1;
47049           ix3 = j3 + 1;
47050           ix4 = j3 + 2;
47051           if (isClosed) {
47052             max3 = nodes.length - 1;
47053             if (ix1 < 0)
47054               ix1 = max3 + ix1;
47055             if (ix2 < 0)
47056               ix2 = max3 + ix2;
47057             if (ix3 > max3)
47058               ix3 = ix3 - max3;
47059             if (ix4 > max3)
47060               ix4 = ix4 - max3;
47061           }
47062           if (nodes[ix1] === activeID)
47063             return 0;
47064           else if (nodes[ix2] === activeID)
47065             return 2;
47066           else if (nodes[ix3] === activeID)
47067             return 2;
47068           else if (nodes[ix4] === activeID)
47069             return 0;
47070           else if (isClosed && nodes.indexOf(activeID) !== -1)
47071             return 0;
47072         }
47073       }
47074     }
47075     return 1;
47076   }
47077   function svgMarkerSegments(projection2, graph, dt2, shouldReverse, bothDirections) {
47078     return function(entity) {
47079       var i3 = 0;
47080       var offset = dt2;
47081       var segments = [];
47082       var clip = identity_default2().clipExtent(projection2.clipExtent()).stream;
47083       var coordinates = graph.childNodes(entity).map(function(n3) {
47084         return n3.loc;
47085       });
47086       var a2, b2;
47087       if (shouldReverse(entity)) {
47088         coordinates.reverse();
47089       }
47090       stream_default({
47091         type: "LineString",
47092         coordinates
47093       }, projection2.stream(clip({
47094         lineStart: function() {
47095         },
47096         lineEnd: function() {
47097           a2 = null;
47098         },
47099         point: function(x2, y2) {
47100           b2 = [x2, y2];
47101           if (a2) {
47102             var span = geoVecLength(a2, b2) - offset;
47103             if (span >= 0) {
47104               var heading = geoVecAngle(a2, b2);
47105               var dx = dt2 * Math.cos(heading);
47106               var dy = dt2 * Math.sin(heading);
47107               var p2 = [
47108                 a2[0] + offset * Math.cos(heading),
47109                 a2[1] + offset * Math.sin(heading)
47110               ];
47111               var coord2 = [a2, p2];
47112               for (span -= dt2; span >= 0; span -= dt2) {
47113                 p2 = geoVecAdd(p2, [dx, dy]);
47114                 coord2.push(p2);
47115               }
47116               coord2.push(b2);
47117               var segment = "";
47118               var j3;
47119               for (j3 = 0; j3 < coord2.length; j3++) {
47120                 segment += (j3 === 0 ? "M" : "L") + coord2[j3][0] + "," + coord2[j3][1];
47121               }
47122               segments.push({ id: entity.id, index: i3++, d: segment });
47123               if (bothDirections(entity)) {
47124                 segment = "";
47125                 for (j3 = coord2.length - 1; j3 >= 0; j3--) {
47126                   segment += (j3 === coord2.length - 1 ? "M" : "L") + coord2[j3][0] + "," + coord2[j3][1];
47127                 }
47128                 segments.push({ id: entity.id, index: i3++, d: segment });
47129               }
47130             }
47131             offset = -span;
47132           }
47133           a2 = b2;
47134         }
47135       })));
47136       return segments;
47137     };
47138   }
47139   function svgPath(projection2, graph, isArea) {
47140     var cache = {};
47141     var padding = isArea ? 65 : 5;
47142     var viewport = projection2.clipExtent();
47143     var paddedExtent = [
47144       [viewport[0][0] - padding, viewport[0][1] - padding],
47145       [viewport[1][0] + padding, viewport[1][1] + padding]
47146     ];
47147     var clip = identity_default2().clipExtent(paddedExtent).stream;
47148     var project = projection2.stream;
47149     var path = path_default().projection({ stream: function(output) {
47150       return project(clip(output));
47151     } });
47152     var svgpath = function(entity) {
47153       if (entity.id in cache) {
47154         return cache[entity.id];
47155       } else {
47156         return cache[entity.id] = path(entity.asGeoJSON(graph));
47157       }
47158     };
47159     svgpath.geojson = function(d2) {
47160       if (d2.__featurehash__ !== void 0) {
47161         if (d2.__featurehash__ in cache) {
47162           return cache[d2.__featurehash__];
47163         } else {
47164           return cache[d2.__featurehash__] = path(d2);
47165         }
47166       } else {
47167         return path(d2);
47168       }
47169     };
47170     return svgpath;
47171   }
47172   function svgPointTransform(projection2) {
47173     var svgpoint = function(entity) {
47174       var pt2 = projection2(entity.loc);
47175       return "translate(" + pt2[0] + "," + pt2[1] + ")";
47176     };
47177     svgpoint.geojson = function(d2) {
47178       return svgpoint(d2.properties.entity);
47179     };
47180     return svgpoint;
47181   }
47182   function svgRelationMemberTags(graph) {
47183     return function(entity) {
47184       var tags = entity.tags;
47185       var shouldCopyMultipolygonTags = !entity.hasInterestingTags();
47186       graph.parentRelations(entity).forEach(function(relation) {
47187         var type2 = relation.tags.type;
47188         if (type2 === "multipolygon" && shouldCopyMultipolygonTags || type2 === "boundary") {
47189           tags = Object.assign({}, relation.tags, tags);
47190         }
47191       });
47192       return tags;
47193     };
47194   }
47195   function svgSegmentWay(way, graph, activeID) {
47196     if (activeID === void 0) {
47197       return graph.transient(way, "waySegments", getWaySegments);
47198     } else {
47199       return getWaySegments();
47200     }
47201     function getWaySegments() {
47202       var isActiveWay = way.nodes.indexOf(activeID) !== -1;
47203       var features = { passive: [], active: [] };
47204       var start2 = {};
47205       var end = {};
47206       var node, type2;
47207       for (var i3 = 0; i3 < way.nodes.length; i3++) {
47208         node = graph.entity(way.nodes[i3]);
47209         type2 = svgPassiveVertex(node, graph, activeID);
47210         end = { node, type: type2 };
47211         if (start2.type !== void 0) {
47212           if (start2.node.id === activeID || end.node.id === activeID) {
47213           } else if (isActiveWay && (start2.type === 2 || end.type === 2)) {
47214             pushActive(start2, end, i3);
47215           } else if (start2.type === 0 && end.type === 0) {
47216             pushActive(start2, end, i3);
47217           } else {
47218             pushPassive(start2, end, i3);
47219           }
47220         }
47221         start2 = end;
47222       }
47223       return features;
47224       function pushActive(start3, end2, index) {
47225         features.active.push({
47226           type: "Feature",
47227           id: way.id + "-" + index + "-nope",
47228           properties: {
47229             nope: true,
47230             target: true,
47231             entity: way,
47232             nodes: [start3.node, end2.node],
47233             index
47234           },
47235           geometry: {
47236             type: "LineString",
47237             coordinates: [start3.node.loc, end2.node.loc]
47238           }
47239         });
47240       }
47241       function pushPassive(start3, end2, index) {
47242         features.passive.push({
47243           type: "Feature",
47244           id: way.id + "-" + index,
47245           properties: {
47246             target: true,
47247             entity: way,
47248             nodes: [start3.node, end2.node],
47249             index
47250           },
47251           geometry: {
47252             type: "LineString",
47253             coordinates: [start3.node.loc, end2.node.loc]
47254           }
47255         });
47256       }
47257     }
47258   }
47259
47260   // modules/svg/tag_classes.js
47261   function svgTagClasses() {
47262     var primaries = [
47263       "building",
47264       "highway",
47265       "railway",
47266       "waterway",
47267       "aeroway",
47268       "aerialway",
47269       "piste:type",
47270       "boundary",
47271       "power",
47272       "amenity",
47273       "natural",
47274       "landuse",
47275       "leisure",
47276       "military",
47277       "place",
47278       "man_made",
47279       "route",
47280       "attraction",
47281       "building:part",
47282       "indoor"
47283     ];
47284     var statuses = Object.keys(osmLifecyclePrefixes);
47285     var secondaries = [
47286       "oneway",
47287       "bridge",
47288       "tunnel",
47289       "embankment",
47290       "cutting",
47291       "barrier",
47292       "surface",
47293       "tracktype",
47294       "footway",
47295       "crossing",
47296       "service",
47297       "sport",
47298       "public_transport",
47299       "location",
47300       "parking",
47301       "golf",
47302       "type",
47303       "leisure",
47304       "man_made",
47305       "indoor",
47306       "construction",
47307       "proposed"
47308     ];
47309     var _tags = function(entity) {
47310       return entity.tags;
47311     };
47312     var tagClasses = function(selection2) {
47313       selection2.each(function tagClassesEach(entity) {
47314         var value = this.className;
47315         if (value.baseVal !== void 0) {
47316           value = value.baseVal;
47317         }
47318         var t2 = _tags(entity);
47319         var computed = tagClasses.getClassesString(t2, value);
47320         if (computed !== value) {
47321           select_default2(this).attr("class", computed);
47322         }
47323       });
47324     };
47325     tagClasses.getClassesString = function(t2, value) {
47326       var primary, status;
47327       var i3, j3, k2, v2;
47328       var overrideGeometry;
47329       if (/\bstroke\b/.test(value)) {
47330         if (!!t2.barrier && t2.barrier !== "no") {
47331           overrideGeometry = "line";
47332         }
47333       }
47334       var classes = value.trim().split(/\s+/).filter(function(klass) {
47335         return klass.length && !/^tag-/.test(klass);
47336       }).map(function(klass) {
47337         return klass === "line" || klass === "area" ? overrideGeometry || klass : klass;
47338       });
47339       for (i3 = 0; i3 < primaries.length; i3++) {
47340         k2 = primaries[i3];
47341         v2 = t2[k2];
47342         if (!v2 || v2 === "no")
47343           continue;
47344         if (k2 === "piste:type") {
47345           k2 = "piste";
47346         } else if (k2 === "building:part") {
47347           k2 = "building_part";
47348         }
47349         primary = k2;
47350         if (statuses.indexOf(v2) !== -1) {
47351           status = v2;
47352           classes.push("tag-" + k2);
47353         } else {
47354           classes.push("tag-" + k2);
47355           classes.push("tag-" + k2 + "-" + v2);
47356         }
47357         break;
47358       }
47359       if (!primary) {
47360         for (i3 = 0; i3 < statuses.length; i3++) {
47361           for (j3 = 0; j3 < primaries.length; j3++) {
47362             k2 = statuses[i3] + ":" + primaries[j3];
47363             v2 = t2[k2];
47364             if (!v2 || v2 === "no")
47365               continue;
47366             status = statuses[i3];
47367             break;
47368           }
47369         }
47370       }
47371       if (!status) {
47372         for (i3 = 0; i3 < statuses.length; i3++) {
47373           k2 = statuses[i3];
47374           v2 = t2[k2];
47375           if (!v2 || v2 === "no")
47376             continue;
47377           if (v2 === "yes") {
47378             status = k2;
47379           } else if (primary && primary === v2) {
47380             status = k2;
47381           } else if (!primary && primaries.indexOf(v2) !== -1) {
47382             status = k2;
47383             primary = v2;
47384             classes.push("tag-" + v2);
47385           }
47386           if (status)
47387             break;
47388         }
47389       }
47390       if (status) {
47391         classes.push("tag-status");
47392         classes.push("tag-status-" + status);
47393       }
47394       for (i3 = 0; i3 < secondaries.length; i3++) {
47395         k2 = secondaries[i3];
47396         v2 = t2[k2];
47397         if (!v2 || v2 === "no" || k2 === primary)
47398           continue;
47399         classes.push("tag-" + k2);
47400         classes.push("tag-" + k2 + "-" + v2);
47401       }
47402       if (primary === "highway" && !osmPathHighwayTagValues[t2.highway] || primary === "aeroway") {
47403         var surface = t2.highway === "track" ? "unpaved" : "paved";
47404         for (k2 in t2) {
47405           v2 = t2[k2];
47406           if (k2 in osmPavedTags) {
47407             surface = osmPavedTags[k2][v2] ? "paved" : "unpaved";
47408           }
47409           if (k2 in osmSemipavedTags && !!osmSemipavedTags[k2][v2]) {
47410             surface = "semipaved";
47411           }
47412         }
47413         classes.push("tag-" + surface);
47414       }
47415       var qid = t2.wikidata || t2["flag:wikidata"] || t2["brand:wikidata"] || t2["network:wikidata"] || t2["operator:wikidata"];
47416       if (qid) {
47417         classes.push("tag-wikidata");
47418       }
47419       return classes.filter((klass) => /^[-_a-z0-9]+$/.test(klass)).join(" ").trim();
47420     };
47421     tagClasses.tags = function(val) {
47422       if (!arguments.length)
47423         return _tags;
47424       _tags = val;
47425       return tagClasses;
47426     };
47427     return tagClasses;
47428   }
47429
47430   // modules/svg/tag_pattern.js
47431   var patterns = {
47432     // tag - pattern name
47433     // -or-
47434     // tag - value - pattern name
47435     // -or-
47436     // tag - value - rules (optional tag-values, pattern name)
47437     // (matches earlier rules first, so fallback should be last entry)
47438     amenity: {
47439       grave_yard: "cemetery",
47440       fountain: "water_standing"
47441     },
47442     landuse: {
47443       cemetery: [
47444         { religion: "christian", pattern: "cemetery_christian" },
47445         { religion: "buddhist", pattern: "cemetery_buddhist" },
47446         { religion: "muslim", pattern: "cemetery_muslim" },
47447         { religion: "jewish", pattern: "cemetery_jewish" },
47448         { pattern: "cemetery" }
47449       ],
47450       construction: "construction",
47451       farmland: "farmland",
47452       farmyard: "farmyard",
47453       forest: [
47454         { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
47455         { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
47456         { leaf_type: "leafless", pattern: "forest_leafless" },
47457         { pattern: "forest" }
47458         // same as 'leaf_type:mixed'
47459       ],
47460       grave_yard: "cemetery",
47461       grass: "grass",
47462       landfill: "landfill",
47463       meadow: "meadow",
47464       military: "construction",
47465       orchard: "orchard",
47466       quarry: "quarry",
47467       vineyard: "vineyard"
47468     },
47469     leisure: {
47470       horse_riding: "farmyard"
47471     },
47472     natural: {
47473       beach: "beach",
47474       grassland: "grass",
47475       sand: "beach",
47476       scrub: "scrub",
47477       water: [
47478         { water: "pond", pattern: "pond" },
47479         { water: "reservoir", pattern: "water_standing" },
47480         { pattern: "waves" }
47481       ],
47482       wetland: [
47483         { wetland: "marsh", pattern: "wetland_marsh" },
47484         { wetland: "swamp", pattern: "wetland_swamp" },
47485         { wetland: "bog", pattern: "wetland_bog" },
47486         { wetland: "reedbed", pattern: "wetland_reedbed" },
47487         { pattern: "wetland" }
47488       ],
47489       wood: [
47490         { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
47491         { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
47492         { leaf_type: "leafless", pattern: "forest_leafless" },
47493         { pattern: "forest" }
47494         // same as 'leaf_type:mixed'
47495       ]
47496     },
47497     golf: {
47498       green: "golf_green",
47499       tee: "grass",
47500       fairway: "grass",
47501       rough: "scrub"
47502     },
47503     surface: {
47504       grass: "grass",
47505       sand: "beach"
47506     }
47507   };
47508   function svgTagPattern(tags) {
47509     if (tags.building && tags.building !== "no") {
47510       return null;
47511     }
47512     for (var tag in patterns) {
47513       var entityValue = tags[tag];
47514       if (!entityValue)
47515         continue;
47516       if (typeof patterns[tag] === "string") {
47517         return "pattern-" + patterns[tag];
47518       } else {
47519         var values = patterns[tag];
47520         for (var value in values) {
47521           if (entityValue !== value)
47522             continue;
47523           var rules = values[value];
47524           if (typeof rules === "string") {
47525             return "pattern-" + rules;
47526           }
47527           for (var ruleKey in rules) {
47528             var rule = rules[ruleKey];
47529             var pass = true;
47530             for (var criterion in rule) {
47531               if (criterion !== "pattern") {
47532                 var v2 = tags[criterion];
47533                 if (!v2 || v2 !== rule[criterion]) {
47534                   pass = false;
47535                   break;
47536                 }
47537               }
47538             }
47539             if (pass) {
47540               return "pattern-" + rule.pattern;
47541             }
47542           }
47543         }
47544       }
47545     }
47546     return null;
47547   }
47548
47549   // modules/svg/areas.js
47550   function svgAreas(projection2, context) {
47551     function getPatternStyle(tags) {
47552       var imageID = svgTagPattern(tags);
47553       if (imageID) {
47554         return 'url("#ideditor-' + imageID + '")';
47555       }
47556       return "";
47557     }
47558     function drawTargets(selection2, graph, entities, filter2) {
47559       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
47560       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
47561       var getPath = svgPath(projection2).geojson;
47562       var activeID = context.activeID();
47563       var base = context.history().base();
47564       var data = { targets: [], nopes: [] };
47565       entities.forEach(function(way) {
47566         var features = svgSegmentWay(way, graph, activeID);
47567         data.targets.push.apply(data.targets, features.passive);
47568         data.nopes.push.apply(data.nopes, features.active);
47569       });
47570       var targetData = data.targets.filter(getPath);
47571       var targets = selection2.selectAll(".area.target-allowed").filter(function(d2) {
47572         return filter2(d2.properties.entity);
47573       }).data(targetData, function key(d2) {
47574         return d2.id;
47575       });
47576       targets.exit().remove();
47577       var segmentWasEdited = function(d2) {
47578         var wayID = d2.properties.entity.id;
47579         if (!base.entities[wayID] || !(0, import_fast_deep_equal5.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
47580           return false;
47581         }
47582         return d2.properties.nodes.some(function(n3) {
47583           return !base.entities[n3.id] || !(0, import_fast_deep_equal5.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
47584         });
47585       };
47586       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
47587         return "way area target target-allowed " + targetClass + d2.id;
47588       }).classed("segment-edited", segmentWasEdited);
47589       var nopeData = data.nopes.filter(getPath);
47590       var nopes = selection2.selectAll(".area.target-nope").filter(function(d2) {
47591         return filter2(d2.properties.entity);
47592       }).data(nopeData, function key(d2) {
47593         return d2.id;
47594       });
47595       nopes.exit().remove();
47596       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
47597         return "way area target target-nope " + nopeClass + d2.id;
47598       }).classed("segment-edited", segmentWasEdited);
47599     }
47600     function drawAreas(selection2, graph, entities, filter2) {
47601       var path = svgPath(projection2, graph, true);
47602       var areas = {};
47603       var multipolygon;
47604       var base = context.history().base();
47605       for (var i3 = 0; i3 < entities.length; i3++) {
47606         var entity = entities[i3];
47607         if (entity.geometry(graph) !== "area")
47608           continue;
47609         multipolygon = osmIsOldMultipolygonOuterMember(entity, graph);
47610         if (multipolygon) {
47611           areas[multipolygon.id] = {
47612             entity: multipolygon.mergeTags(entity.tags),
47613             area: Math.abs(entity.area(graph))
47614           };
47615         } else if (!areas[entity.id]) {
47616           areas[entity.id] = {
47617             entity,
47618             area: Math.abs(entity.area(graph))
47619           };
47620         }
47621       }
47622       var fills = Object.values(areas).filter(function hasPath(a2) {
47623         return path(a2.entity);
47624       });
47625       fills.sort(function areaSort(a2, b2) {
47626         return b2.area - a2.area;
47627       });
47628       fills = fills.map(function(a2) {
47629         return a2.entity;
47630       });
47631       var strokes = fills.filter(function(area) {
47632         return area.type === "way";
47633       });
47634       var data = {
47635         clip: fills,
47636         shadow: strokes,
47637         stroke: strokes,
47638         fill: fills
47639       };
47640       var clipPaths = context.surface().selectAll("defs").selectAll(".clipPath-osm").filter(filter2).data(data.clip, osmEntity.key);
47641       clipPaths.exit().remove();
47642       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-osm").attr("id", function(entity2) {
47643         return "ideditor-" + entity2.id + "-clippath";
47644       });
47645       clipPathsEnter.append("path");
47646       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", path);
47647       var drawLayer = selection2.selectAll(".layer-osm.areas");
47648       var touchLayer = selection2.selectAll(".layer-touch.areas");
47649       var areagroup = drawLayer.selectAll("g.areagroup").data(["fill", "shadow", "stroke"]);
47650       areagroup = areagroup.enter().append("g").attr("class", function(d2) {
47651         return "areagroup area-" + d2;
47652       }).merge(areagroup);
47653       var paths = areagroup.selectAll("path").filter(filter2).data(function(layer) {
47654         return data[layer];
47655       }, osmEntity.key);
47656       paths.exit().remove();
47657       var fillpaths = selection2.selectAll(".area-fill path.area").nodes();
47658       var bisect = bisector(function(node) {
47659         return -node.__data__.area(graph);
47660       }).left;
47661       function sortedByArea(entity2) {
47662         if (this._parent.__data__ === "fill") {
47663           return fillpaths[bisect(fillpaths, -entity2.area(graph))];
47664         }
47665       }
47666       paths = paths.enter().insert("path", sortedByArea).merge(paths).each(function(entity2) {
47667         var layer = this.parentNode.__data__;
47668         this.setAttribute("class", entity2.type + " area " + layer + " " + entity2.id);
47669         if (layer === "fill") {
47670           this.setAttribute("clip-path", "url(#ideditor-" + entity2.id + "-clippath)");
47671           this.style.fill = this.style.stroke = getPatternStyle(entity2.tags);
47672         }
47673       }).classed("added", function(d2) {
47674         return !base.entities[d2.id];
47675       }).classed("geometry-edited", function(d2) {
47676         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);
47677       }).classed("retagged", function(d2) {
47678         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);
47679       }).call(svgTagClasses()).attr("d", path);
47680       touchLayer.call(drawTargets, graph, data.stroke, filter2);
47681     }
47682     return drawAreas;
47683   }
47684
47685   // modules/svg/data.js
47686   var import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify());
47687
47688   // node_modules/@tmcw/togeojson/dist/togeojson.es.mjs
47689   function $(element, tagName) {
47690     return Array.from(element.getElementsByTagName(tagName));
47691   }
47692   function normalizeId(id2) {
47693     return id2[0] === "#" ? id2 : "#".concat(id2);
47694   }
47695   function $ns(element, tagName, ns) {
47696     return Array.from(element.getElementsByTagNameNS(ns, tagName));
47697   }
47698   function nodeVal(node) {
47699     node == null ? void 0 : node.normalize();
47700     return node && node.textContent || "";
47701   }
47702   function get1(node, tagName, callback) {
47703     const n3 = node.getElementsByTagName(tagName);
47704     const result = n3.length ? n3[0] : null;
47705     if (result && callback)
47706       callback(result);
47707     return result;
47708   }
47709   function get3(node, tagName, callback) {
47710     const properties = {};
47711     if (!node)
47712       return properties;
47713     const n3 = node.getElementsByTagName(tagName);
47714     const result = n3.length ? n3[0] : null;
47715     if (result && callback) {
47716       return callback(result, properties);
47717     }
47718     return properties;
47719   }
47720   function val1(node, tagName, callback) {
47721     const val = nodeVal(get1(node, tagName));
47722     if (val && callback)
47723       return callback(val) || {};
47724     return {};
47725   }
47726   function $num(node, tagName, callback) {
47727     const val = parseFloat(nodeVal(get1(node, tagName)));
47728     if (isNaN(val))
47729       return void 0;
47730     if (val && callback)
47731       return callback(val) || {};
47732     return {};
47733   }
47734   function num1(node, tagName, callback) {
47735     const val = parseFloat(nodeVal(get1(node, tagName)));
47736     if (isNaN(val))
47737       return void 0;
47738     if (callback)
47739       callback(val);
47740     return val;
47741   }
47742   function getMulti(node, propertyNames) {
47743     const properties = {};
47744     for (const property of propertyNames) {
47745       val1(node, property, (val) => {
47746         properties[property] = val;
47747       });
47748     }
47749     return properties;
47750   }
47751   function isElement(node) {
47752     return (node == null ? void 0 : node.nodeType) === 1;
47753   }
47754   function getLineStyle(node) {
47755     return get3(node, "line", (lineStyle) => {
47756       const val = Object.assign({}, val1(lineStyle, "color", (color2) => {
47757         return { stroke: "#".concat(color2) };
47758       }), $num(lineStyle, "opacity", (opacity) => {
47759         return { "stroke-opacity": opacity };
47760       }), $num(lineStyle, "width", (width) => {
47761         return { "stroke-width": width * 96 / 25.4 };
47762       }));
47763       return val;
47764     });
47765   }
47766   function getExtensions(node) {
47767     let values = [];
47768     if (node === null)
47769       return values;
47770     for (const child of Array.from(node.childNodes)) {
47771       if (!isElement(child))
47772         continue;
47773       const name = abbreviateName(child.nodeName);
47774       if (name === "gpxtpx:TrackPointExtension") {
47775         values = values.concat(getExtensions(child));
47776       } else {
47777         const val = nodeVal(child);
47778         values.push([name, parseNumeric(val)]);
47779       }
47780     }
47781     return values;
47782   }
47783   function abbreviateName(name) {
47784     return ["heart", "gpxtpx:hr", "hr"].includes(name) ? "heart" : name;
47785   }
47786   function parseNumeric(val) {
47787     const num = parseFloat(val);
47788     return isNaN(num) ? val : num;
47789   }
47790   function coordPair$1(node) {
47791     const ll = [
47792       parseFloat(node.getAttribute("lon") || ""),
47793       parseFloat(node.getAttribute("lat") || "")
47794     ];
47795     if (isNaN(ll[0]) || isNaN(ll[1])) {
47796       return null;
47797     }
47798     num1(node, "ele", (val) => {
47799       ll.push(val);
47800     });
47801     const time = get1(node, "time");
47802     return {
47803       coordinates: ll,
47804       time: time ? nodeVal(time) : null,
47805       extendedValues: getExtensions(get1(node, "extensions"))
47806     };
47807   }
47808   function extractProperties(node) {
47809     var _a;
47810     const properties = getMulti(node, [
47811       "name",
47812       "cmt",
47813       "desc",
47814       "type",
47815       "time",
47816       "keywords"
47817     ]);
47818     const extensions = Array.from(node.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3", "*"));
47819     for (const child of extensions) {
47820       if (((_a = child.parentNode) == null ? void 0 : _a.parentNode) === node) {
47821         properties[child.tagName.replace(":", "_")] = nodeVal(child);
47822       }
47823     }
47824     const links = $(node, "link");
47825     if (links.length) {
47826       properties.links = links.map((link2) => Object.assign({ href: link2.getAttribute("href") }, getMulti(link2, ["text", "type"])));
47827     }
47828     return properties;
47829   }
47830   function getPoints$1(node, pointname) {
47831     const pts = $(node, pointname);
47832     const line = [];
47833     const times = [];
47834     const extendedValues = {};
47835     for (let i3 = 0; i3 < pts.length; i3++) {
47836       const c2 = coordPair$1(pts[i3]);
47837       if (!c2) {
47838         continue;
47839       }
47840       line.push(c2.coordinates);
47841       if (c2.time)
47842         times.push(c2.time);
47843       for (const [name, val] of c2.extendedValues) {
47844         const plural = name === "heart" ? name : name.replace("gpxtpx:", "") + "s";
47845         if (!extendedValues[plural]) {
47846           extendedValues[plural] = Array(pts.length).fill(null);
47847         }
47848         extendedValues[plural][i3] = val;
47849       }
47850     }
47851     if (line.length < 2)
47852       return;
47853     return {
47854       line,
47855       times,
47856       extendedValues
47857     };
47858   }
47859   function getRoute(node) {
47860     const line = getPoints$1(node, "rtept");
47861     if (!line)
47862       return;
47863     return {
47864       type: "Feature",
47865       properties: Object.assign({ _gpxType: "rte" }, extractProperties(node), getLineStyle(get1(node, "extensions"))),
47866       geometry: {
47867         type: "LineString",
47868         coordinates: line.line
47869       }
47870     };
47871   }
47872   function getTrack(node) {
47873     const segments = $(node, "trkseg");
47874     const track = [];
47875     const times = [];
47876     const extractedLines = [];
47877     for (const segment of segments) {
47878       const line = getPoints$1(segment, "trkpt");
47879       if (line) {
47880         extractedLines.push(line);
47881         if (line.times && line.times.length)
47882           times.push(line.times);
47883       }
47884     }
47885     if (extractedLines.length === 0)
47886       return null;
47887     const multi = extractedLines.length > 1;
47888     const properties = Object.assign({ _gpxType: "trk" }, extractProperties(node), getLineStyle(get1(node, "extensions")), times.length ? {
47889       coordinateProperties: {
47890         times: multi ? times : times[0]
47891       }
47892     } : {});
47893     for (const line of extractedLines) {
47894       track.push(line.line);
47895       if (!properties.coordinateProperties) {
47896         properties.coordinateProperties = {};
47897       }
47898       const props = properties.coordinateProperties;
47899       const entries = Object.entries(line.extendedValues);
47900       for (let i3 = 0; i3 < entries.length; i3++) {
47901         const [name, val] = entries[i3];
47902         if (multi) {
47903           if (!props[name]) {
47904             props[name] = extractedLines.map((line2) => new Array(line2.line.length).fill(null));
47905           }
47906           props[name][i3] = val;
47907         } else {
47908           props[name] = val;
47909         }
47910       }
47911     }
47912     return {
47913       type: "Feature",
47914       properties,
47915       geometry: multi ? {
47916         type: "MultiLineString",
47917         coordinates: track
47918       } : {
47919         type: "LineString",
47920         coordinates: track[0]
47921       }
47922     };
47923   }
47924   function getPoint(node) {
47925     const properties = Object.assign(extractProperties(node), getMulti(node, ["sym"]));
47926     const pair3 = coordPair$1(node);
47927     if (!pair3)
47928       return null;
47929     return {
47930       type: "Feature",
47931       properties,
47932       geometry: {
47933         type: "Point",
47934         coordinates: pair3.coordinates
47935       }
47936     };
47937   }
47938   function* gpxGen(node) {
47939     for (const track of $(node, "trk")) {
47940       const feature3 = getTrack(track);
47941       if (feature3)
47942         yield feature3;
47943     }
47944     for (const route of $(node, "rte")) {
47945       const feature3 = getRoute(route);
47946       if (feature3)
47947         yield feature3;
47948     }
47949     for (const waypoint of $(node, "wpt")) {
47950       const point2 = getPoint(waypoint);
47951       if (point2)
47952         yield point2;
47953     }
47954   }
47955   function gpx(node) {
47956     return {
47957       type: "FeatureCollection",
47958       features: Array.from(gpxGen(node))
47959     };
47960   }
47961   function fixColor(v2, prefix) {
47962     const properties = {};
47963     const colorProp = prefix == "stroke" || prefix === "fill" ? prefix : prefix + "-color";
47964     if (v2[0] === "#") {
47965       v2 = v2.substring(1);
47966     }
47967     if (v2.length === 6 || v2.length === 3) {
47968       properties[colorProp] = "#" + v2;
47969     } else if (v2.length === 8) {
47970       properties[prefix + "-opacity"] = parseInt(v2.substring(0, 2), 16) / 255;
47971       properties[colorProp] = "#" + v2.substring(6, 8) + v2.substring(4, 6) + v2.substring(2, 4);
47972     }
47973     return properties;
47974   }
47975   function numericProperty(node, source, target) {
47976     const properties = {};
47977     num1(node, source, (val) => {
47978       properties[target] = val;
47979     });
47980     return properties;
47981   }
47982   function getColor(node, output) {
47983     return get3(node, "color", (elem) => fixColor(nodeVal(elem), output));
47984   }
47985   function extractIconHref(node) {
47986     return get3(node, "Icon", (icon2, properties) => {
47987       val1(icon2, "href", (href) => {
47988         properties.icon = href;
47989       });
47990       return properties;
47991     });
47992   }
47993   function extractIcon(node) {
47994     return get3(node, "IconStyle", (iconStyle) => {
47995       return Object.assign(getColor(iconStyle, "icon"), numericProperty(iconStyle, "scale", "icon-scale"), numericProperty(iconStyle, "heading", "icon-heading"), get3(iconStyle, "hotSpot", (hotspot) => {
47996         const left = parseFloat(hotspot.getAttribute("x") || "");
47997         const top = parseFloat(hotspot.getAttribute("y") || "");
47998         const xunits = hotspot.getAttribute("xunits") || "";
47999         const yunits = hotspot.getAttribute("yunits") || "";
48000         if (!isNaN(left) && !isNaN(top))
48001           return {
48002             "icon-offset": [left, top],
48003             "icon-offset-units": [xunits, yunits]
48004           };
48005         return {};
48006       }), extractIconHref(iconStyle));
48007     });
48008   }
48009   function extractLabel(node) {
48010     return get3(node, "LabelStyle", (labelStyle) => {
48011       return Object.assign(getColor(labelStyle, "label"), numericProperty(labelStyle, "scale", "label-scale"));
48012     });
48013   }
48014   function extractLine(node) {
48015     return get3(node, "LineStyle", (lineStyle) => {
48016       return Object.assign(getColor(lineStyle, "stroke"), numericProperty(lineStyle, "width", "stroke-width"));
48017     });
48018   }
48019   function extractPoly(node) {
48020     return get3(node, "PolyStyle", (polyStyle, properties) => {
48021       return Object.assign(properties, get3(polyStyle, "color", (elem) => fixColor(nodeVal(elem), "fill")), val1(polyStyle, "fill", (fill) => {
48022         if (fill === "0")
48023           return { "fill-opacity": 0 };
48024       }), val1(polyStyle, "outline", (outline) => {
48025         if (outline === "0")
48026           return { "stroke-opacity": 0 };
48027       }));
48028     });
48029   }
48030   function extractStyle(node) {
48031     return Object.assign({}, extractPoly(node), extractLine(node), extractLabel(node), extractIcon(node));
48032   }
48033   var toNumber2 = (x2) => Number(x2);
48034   var typeConverters = {
48035     string: (x2) => x2,
48036     int: toNumber2,
48037     uint: toNumber2,
48038     short: toNumber2,
48039     ushort: toNumber2,
48040     float: toNumber2,
48041     double: toNumber2,
48042     bool: (x2) => Boolean(x2)
48043   };
48044   function extractExtendedData(node, schema) {
48045     return get3(node, "ExtendedData", (extendedData, properties) => {
48046       for (const data of $(extendedData, "Data")) {
48047         properties[data.getAttribute("name") || ""] = nodeVal(get1(data, "value"));
48048       }
48049       for (const simpleData of $(extendedData, "SimpleData")) {
48050         const name = simpleData.getAttribute("name") || "";
48051         const typeConverter = schema[name] || typeConverters.string;
48052         properties[name] = typeConverter(nodeVal(simpleData));
48053       }
48054       return properties;
48055     });
48056   }
48057   function getMaybeHTMLDescription(node) {
48058     const descriptionNode = get1(node, "description");
48059     for (const c2 of Array.from((descriptionNode == null ? void 0 : descriptionNode.childNodes) || [])) {
48060       if (c2.nodeType === 4) {
48061         return {
48062           description: {
48063             "@type": "html",
48064             value: nodeVal(c2)
48065           }
48066         };
48067       }
48068     }
48069     return {};
48070   }
48071   function extractTimeSpan(node) {
48072     return get3(node, "TimeSpan", (timeSpan) => {
48073       return {
48074         timespan: {
48075           begin: nodeVal(get1(timeSpan, "begin")),
48076           end: nodeVal(get1(timeSpan, "end"))
48077         }
48078       };
48079     });
48080   }
48081   function extractTimeStamp(node) {
48082     return get3(node, "TimeStamp", (timeStamp) => {
48083       return { timestamp: nodeVal(get1(timeStamp, "when")) };
48084     });
48085   }
48086   function extractCascadedStyle(node, styleMap) {
48087     return val1(node, "styleUrl", (styleUrl) => {
48088       styleUrl = normalizeId(styleUrl);
48089       if (styleMap[styleUrl]) {
48090         return Object.assign({ styleUrl }, styleMap[styleUrl]);
48091       }
48092       return { styleUrl };
48093     });
48094   }
48095   var removeSpace = /\s*/g;
48096   var trimSpace = /^\s*|\s*$/g;
48097   var splitSpace = /\s+/;
48098   function coord1(value) {
48099     return value.replace(removeSpace, "").split(",").map(parseFloat).filter((num) => !isNaN(num)).slice(0, 3);
48100   }
48101   function coord(value) {
48102     return value.replace(trimSpace, "").split(splitSpace).map(coord1).filter((coord2) => {
48103       return coord2.length >= 2;
48104     });
48105   }
48106   function gxCoords(node) {
48107     let elems = $(node, "coord");
48108     if (elems.length === 0) {
48109       elems = $ns(node, "coord", "*");
48110     }
48111     const coordinates = elems.map((elem) => {
48112       return nodeVal(elem).split(" ").map(parseFloat);
48113     });
48114     if (coordinates.length === 0) {
48115       return null;
48116     }
48117     return {
48118       geometry: coordinates.length > 2 ? {
48119         type: "LineString",
48120         coordinates
48121       } : {
48122         type: "Point",
48123         coordinates: coordinates[0]
48124       },
48125       times: $(node, "when").map((elem) => nodeVal(elem))
48126     };
48127   }
48128   function fixRing(ring) {
48129     if (ring.length === 0)
48130       return ring;
48131     const first = ring[0];
48132     const last = ring[ring.length - 1];
48133     let equal = true;
48134     for (let i3 = 0; i3 < Math.max(first.length, last.length); i3++) {
48135       if (first[i3] !== last[i3]) {
48136         equal = false;
48137         break;
48138       }
48139     }
48140     if (!equal) {
48141       return ring.concat([ring[0]]);
48142     }
48143     return ring;
48144   }
48145   function getCoordinates(node) {
48146     return nodeVal(get1(node, "coordinates"));
48147   }
48148   function getGeometry(node) {
48149     let geometries = [];
48150     let coordTimes = [];
48151     for (let i3 = 0; i3 < node.childNodes.length; i3++) {
48152       const child = node.childNodes.item(i3);
48153       if (isElement(child)) {
48154         switch (child.tagName) {
48155           case "MultiGeometry":
48156           case "MultiTrack":
48157           case "gx:MultiTrack": {
48158             const childGeometries = getGeometry(child);
48159             geometries = geometries.concat(childGeometries.geometries);
48160             coordTimes = coordTimes.concat(childGeometries.coordTimes);
48161             break;
48162           }
48163           case "Point": {
48164             const coordinates = coord1(getCoordinates(child));
48165             if (coordinates.length >= 2) {
48166               geometries.push({
48167                 type: "Point",
48168                 coordinates
48169               });
48170             }
48171             break;
48172           }
48173           case "LinearRing":
48174           case "LineString": {
48175             const coordinates = coord(getCoordinates(child));
48176             if (coordinates.length >= 2) {
48177               geometries.push({
48178                 type: "LineString",
48179                 coordinates
48180               });
48181             }
48182             break;
48183           }
48184           case "Polygon": {
48185             const coords = [];
48186             for (const linearRing of $(child, "LinearRing")) {
48187               const ring = fixRing(coord(getCoordinates(linearRing)));
48188               if (ring.length >= 4) {
48189                 coords.push(ring);
48190               }
48191             }
48192             if (coords.length) {
48193               geometries.push({
48194                 type: "Polygon",
48195                 coordinates: coords
48196               });
48197             }
48198             break;
48199           }
48200           case "Track":
48201           case "gx:Track": {
48202             const gx = gxCoords(child);
48203             if (!gx)
48204               break;
48205             const { times, geometry } = gx;
48206             geometries.push(geometry);
48207             if (times.length)
48208               coordTimes.push(times);
48209             break;
48210           }
48211         }
48212       }
48213     }
48214     return {
48215       geometries,
48216       coordTimes
48217     };
48218   }
48219   function geometryListToGeometry(geometries) {
48220     return geometries.length === 0 ? null : geometries.length === 1 ? geometries[0] : {
48221       type: "GeometryCollection",
48222       geometries
48223     };
48224   }
48225   function getPlacemark(node, styleMap, schema, options2) {
48226     var _a;
48227     const { coordTimes, geometries } = getGeometry(node);
48228     const geometry = geometryListToGeometry(geometries);
48229     if (!geometry && options2.skipNullGeometry) {
48230       return null;
48231     }
48232     const feature3 = {
48233       type: "Feature",
48234       geometry,
48235       properties: Object.assign(getMulti(node, [
48236         "name",
48237         "address",
48238         "visibility",
48239         "open",
48240         "phoneNumber",
48241         "description"
48242       ]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractExtendedData(node, schema), extractTimeSpan(node), extractTimeStamp(node), coordTimes.length ? {
48243         coordinateProperties: {
48244           times: coordTimes.length === 1 ? coordTimes[0] : coordTimes
48245         }
48246       } : {})
48247     };
48248     if (((_a = feature3.properties) == null ? void 0 : _a.visibility) !== void 0) {
48249       feature3.properties.visibility = feature3.properties.visibility !== "0";
48250     }
48251     const id2 = node.getAttribute("id");
48252     if (id2 !== null && id2 !== "")
48253       feature3.id = id2;
48254     return feature3;
48255   }
48256   function getGroundOverlayBox(node) {
48257     const latLonQuad = get1(node, "gx:LatLonQuad");
48258     if (latLonQuad) {
48259       const ring = fixRing(coord(getCoordinates(node)));
48260       return {
48261         geometry: {
48262           type: "Polygon",
48263           coordinates: [ring]
48264         }
48265       };
48266     }
48267     return getLatLonBox(node);
48268   }
48269   var DEGREES_TO_RADIANS = Math.PI / 180;
48270   function rotateBox(bbox2, coordinates, rotation) {
48271     const center = [(bbox2[0] + bbox2[2]) / 2, (bbox2[1] + bbox2[3]) / 2];
48272     return [
48273       coordinates[0].map((coordinate) => {
48274         const dy = coordinate[1] - center[1];
48275         const dx = coordinate[0] - center[0];
48276         const distance = Math.sqrt(Math.pow(dy, 2) + Math.pow(dx, 2));
48277         const angle2 = Math.atan2(dy, dx) + rotation * DEGREES_TO_RADIANS;
48278         return [
48279           center[0] + Math.cos(angle2) * distance,
48280           center[1] + Math.sin(angle2) * distance
48281         ];
48282       })
48283     ];
48284   }
48285   function getLatLonBox(node) {
48286     const latLonBox = get1(node, "LatLonBox");
48287     if (latLonBox) {
48288       const north = num1(latLonBox, "north");
48289       const west = num1(latLonBox, "west");
48290       const east = num1(latLonBox, "east");
48291       const south = num1(latLonBox, "south");
48292       const rotation = num1(latLonBox, "rotation");
48293       if (typeof north === "number" && typeof south === "number" && typeof west === "number" && typeof east === "number") {
48294         const bbox2 = [west, south, east, north];
48295         let coordinates = [
48296           [
48297             [west, north],
48298             [east, north],
48299             [east, south],
48300             [west, south],
48301             [west, north]
48302             // top left (again)
48303           ]
48304         ];
48305         if (typeof rotation === "number") {
48306           coordinates = rotateBox(bbox2, coordinates, rotation);
48307         }
48308         return {
48309           bbox: bbox2,
48310           geometry: {
48311             type: "Polygon",
48312             coordinates
48313           }
48314         };
48315       }
48316     }
48317     return null;
48318   }
48319   function getGroundOverlay(node, styleMap, schema, options2) {
48320     var _a;
48321     const box = getGroundOverlayBox(node);
48322     const geometry = (box == null ? void 0 : box.geometry) || null;
48323     if (!geometry && options2.skipNullGeometry) {
48324       return null;
48325     }
48326     const feature3 = {
48327       type: "Feature",
48328       geometry,
48329       properties: Object.assign(
48330         /**
48331          * Related to
48332          * https://gist.github.com/tmcw/037a1cb6660d74a392e9da7446540f46
48333          */
48334         { "@geometry-type": "groundoverlay" },
48335         getMulti(node, [
48336           "name",
48337           "address",
48338           "visibility",
48339           "open",
48340           "phoneNumber",
48341           "description"
48342         ]),
48343         getMaybeHTMLDescription(node),
48344         extractCascadedStyle(node, styleMap),
48345         extractStyle(node),
48346         extractIconHref(node),
48347         extractExtendedData(node, schema),
48348         extractTimeSpan(node),
48349         extractTimeStamp(node)
48350       )
48351     };
48352     if (box == null ? void 0 : box.bbox) {
48353       feature3.bbox = box.bbox;
48354     }
48355     if (((_a = feature3.properties) == null ? void 0 : _a.visibility) !== void 0) {
48356       feature3.properties.visibility = feature3.properties.visibility !== "0";
48357     }
48358     const id2 = node.getAttribute("id");
48359     if (id2 !== null && id2 !== "")
48360       feature3.id = id2;
48361     return feature3;
48362   }
48363   function getStyleId(style) {
48364     let id2 = style.getAttribute("id");
48365     const parentNode = style.parentNode;
48366     if (!id2 && isElement(parentNode) && parentNode.localName === "CascadingStyle") {
48367       id2 = parentNode.getAttribute("kml:id") || parentNode.getAttribute("id");
48368     }
48369     return normalizeId(id2 || "");
48370   }
48371   function buildStyleMap(node) {
48372     const styleMap = {};
48373     for (const style of $(node, "Style")) {
48374       styleMap[getStyleId(style)] = extractStyle(style);
48375     }
48376     for (const map2 of $(node, "StyleMap")) {
48377       const id2 = normalizeId(map2.getAttribute("id") || "");
48378       val1(map2, "styleUrl", (styleUrl) => {
48379         styleUrl = normalizeId(styleUrl);
48380         if (styleMap[styleUrl]) {
48381           styleMap[id2] = styleMap[styleUrl];
48382         }
48383       });
48384     }
48385     return styleMap;
48386   }
48387   function buildSchema(node) {
48388     const schema = {};
48389     for (const field of $(node, "SimpleField")) {
48390       schema[field.getAttribute("name") || ""] = typeConverters[field.getAttribute("type") || ""] || typeConverters["string"];
48391     }
48392     return schema;
48393   }
48394   function* kmlGen(node, options2 = {
48395     skipNullGeometry: false
48396   }) {
48397     const styleMap = buildStyleMap(node);
48398     const schema = buildSchema(node);
48399     for (const placemark of $(node, "Placemark")) {
48400       const feature3 = getPlacemark(placemark, styleMap, schema, options2);
48401       if (feature3)
48402         yield feature3;
48403     }
48404     for (const groundOverlay of $(node, "GroundOverlay")) {
48405       const feature3 = getGroundOverlay(groundOverlay, styleMap, schema, options2);
48406       if (feature3)
48407         yield feature3;
48408     }
48409   }
48410   function kml(node, options2 = {
48411     skipNullGeometry: false
48412   }) {
48413     return {
48414       type: "FeatureCollection",
48415       features: Array.from(kmlGen(node, options2))
48416     };
48417   }
48418
48419   // modules/svg/data.js
48420   var _initialized = false;
48421   var _enabled = false;
48422   var _geojson;
48423   function svgData(projection2, context, dispatch14) {
48424     var throttledRedraw = throttle_default(function() {
48425       dispatch14.call("change");
48426     }, 1e3);
48427     var _showLabels = true;
48428     var detected = utilDetect();
48429     var layer = select_default2(null);
48430     var _vtService;
48431     var _fileList;
48432     var _template;
48433     var _src;
48434     const supportedFormats = [
48435       ".gpx",
48436       ".kml",
48437       ".geojson",
48438       ".json"
48439     ];
48440     function init2() {
48441       if (_initialized)
48442         return;
48443       _geojson = {};
48444       _enabled = true;
48445       function over(d3_event) {
48446         d3_event.stopPropagation();
48447         d3_event.preventDefault();
48448         d3_event.dataTransfer.dropEffect = "copy";
48449       }
48450       context.container().attr("dropzone", "copy").on("drop.svgData", function(d3_event) {
48451         d3_event.stopPropagation();
48452         d3_event.preventDefault();
48453         if (!detected.filedrop)
48454           return;
48455         var f3 = d3_event.dataTransfer.files[0];
48456         var extension = getExtension(f3.name);
48457         if (!supportedFormats.includes(extension))
48458           return;
48459         drawData.fileList(d3_event.dataTransfer.files);
48460       }).on("dragenter.svgData", over).on("dragexit.svgData", over).on("dragover.svgData", over);
48461       _initialized = true;
48462     }
48463     function getService() {
48464       if (services.vectorTile && !_vtService) {
48465         _vtService = services.vectorTile;
48466         _vtService.event.on("loadedData", throttledRedraw);
48467       } else if (!services.vectorTile && _vtService) {
48468         _vtService = null;
48469       }
48470       return _vtService;
48471     }
48472     function showLayer() {
48473       layerOn();
48474       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
48475         dispatch14.call("change");
48476       });
48477     }
48478     function hideLayer() {
48479       throttledRedraw.cancel();
48480       layer.transition().duration(250).style("opacity", 0).on("end", layerOff);
48481     }
48482     function layerOn() {
48483       layer.style("display", "block");
48484     }
48485     function layerOff() {
48486       layer.selectAll(".viewfield-group").remove();
48487       layer.style("display", "none");
48488     }
48489     function ensureIDs(gj) {
48490       if (!gj)
48491         return null;
48492       if (gj.type === "FeatureCollection") {
48493         for (var i3 = 0; i3 < gj.features.length; i3++) {
48494           ensureFeatureID(gj.features[i3]);
48495         }
48496       } else {
48497         ensureFeatureID(gj);
48498       }
48499       return gj;
48500     }
48501     function ensureFeatureID(feature3) {
48502       if (!feature3)
48503         return;
48504       feature3.__featurehash__ = utilHashcode((0, import_fast_json_stable_stringify.default)(feature3));
48505       return feature3;
48506     }
48507     function getFeatures(gj) {
48508       if (!gj)
48509         return [];
48510       if (gj.type === "FeatureCollection") {
48511         return gj.features;
48512       } else {
48513         return [gj];
48514       }
48515     }
48516     function featureKey(d2) {
48517       return d2.__featurehash__;
48518     }
48519     function isPolygon(d2) {
48520       return d2.geometry.type === "Polygon" || d2.geometry.type === "MultiPolygon";
48521     }
48522     function clipPathID(d2) {
48523       return "ideditor-data-" + d2.__featurehash__ + "-clippath";
48524     }
48525     function featureClasses(d2) {
48526       return [
48527         "data" + d2.__featurehash__,
48528         d2.geometry.type,
48529         isPolygon(d2) ? "area" : "",
48530         d2.__layerID__ || ""
48531       ].filter(Boolean).join(" ");
48532     }
48533     function drawData(selection2) {
48534       var vtService = getService();
48535       var getPath = svgPath(projection2).geojson;
48536       var getAreaPath = svgPath(projection2, null, true).geojson;
48537       var hasData = drawData.hasData();
48538       layer = selection2.selectAll(".layer-mapdata").data(_enabled && hasData ? [0] : []);
48539       layer.exit().remove();
48540       layer = layer.enter().append("g").attr("class", "layer-mapdata").merge(layer);
48541       var surface = context.surface();
48542       if (!surface || surface.empty())
48543         return;
48544       var geoData, polygonData;
48545       if (_template && vtService) {
48546         var sourceID = _template;
48547         vtService.loadTiles(sourceID, _template, projection2);
48548         geoData = vtService.data(sourceID, projection2);
48549       } else {
48550         geoData = getFeatures(_geojson);
48551       }
48552       geoData = geoData.filter(getPath);
48553       polygonData = geoData.filter(isPolygon);
48554       var clipPaths = surface.selectAll("defs").selectAll(".clipPath-data").data(polygonData, featureKey);
48555       clipPaths.exit().remove();
48556       var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-data").attr("id", clipPathID);
48557       clipPathsEnter.append("path");
48558       clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", getAreaPath);
48559       var datagroups = layer.selectAll("g.datagroup").data(["fill", "shadow", "stroke"]);
48560       datagroups = datagroups.enter().append("g").attr("class", function(d2) {
48561         return "datagroup datagroup-" + d2;
48562       }).merge(datagroups);
48563       var pathData = {
48564         fill: polygonData,
48565         shadow: geoData,
48566         stroke: geoData
48567       };
48568       var paths = datagroups.selectAll("path").data(function(layer2) {
48569         return pathData[layer2];
48570       }, featureKey);
48571       paths.exit().remove();
48572       paths = paths.enter().append("path").attr("class", function(d2) {
48573         var datagroup = this.parentNode.__data__;
48574         return "pathdata " + datagroup + " " + featureClasses(d2);
48575       }).attr("clip-path", function(d2) {
48576         var datagroup = this.parentNode.__data__;
48577         return datagroup === "fill" ? "url(#" + clipPathID(d2) + ")" : null;
48578       }).merge(paths).attr("d", function(d2) {
48579         var datagroup = this.parentNode.__data__;
48580         return datagroup === "fill" ? getAreaPath(d2) : getPath(d2);
48581       });
48582       layer.call(drawLabels, "label-halo", geoData).call(drawLabels, "label", geoData);
48583       function drawLabels(selection3, textClass, data) {
48584         var labelPath = path_default(projection2);
48585         var labelData = data.filter(function(d2) {
48586           return _showLabels && d2.properties && (d2.properties.desc || d2.properties.name);
48587         });
48588         var labels = selection3.selectAll("text." + textClass).data(labelData, featureKey);
48589         labels.exit().remove();
48590         labels = labels.enter().append("text").attr("class", function(d2) {
48591           return textClass + " " + featureClasses(d2);
48592         }).merge(labels).text(function(d2) {
48593           return d2.properties.desc || d2.properties.name;
48594         }).attr("x", function(d2) {
48595           var centroid = labelPath.centroid(d2);
48596           return centroid[0] + 11;
48597         }).attr("y", function(d2) {
48598           var centroid = labelPath.centroid(d2);
48599           return centroid[1];
48600         });
48601       }
48602     }
48603     function getExtension(fileName) {
48604       if (!fileName)
48605         return;
48606       var re3 = /\.(gpx|kml|(geo)?json|png)$/i;
48607       var match = fileName.toLowerCase().match(re3);
48608       return match && match.length && match[0];
48609     }
48610     function xmlToDom(textdata) {
48611       return new DOMParser().parseFromString(textdata, "text/xml");
48612     }
48613     function stringifyGeojsonProperties(feature3) {
48614       const properties = feature3.properties;
48615       for (const key in properties) {
48616         const property = properties[key];
48617         if (typeof property === "number" || typeof property === "boolean" || Array.isArray(property)) {
48618           properties[key] = property.toString();
48619         } else if (property === null) {
48620           properties[key] = "null";
48621         } else if (typeof property === "object") {
48622           properties[key] = JSON.stringify(property);
48623         }
48624       }
48625     }
48626     drawData.setFile = function(extension, data) {
48627       _template = null;
48628       _fileList = null;
48629       _geojson = null;
48630       _src = null;
48631       var gj;
48632       switch (extension) {
48633         case ".gpx":
48634           gj = gpx(xmlToDom(data));
48635           break;
48636         case ".kml":
48637           gj = kml(xmlToDom(data));
48638           break;
48639         case ".geojson":
48640         case ".json":
48641           gj = JSON.parse(data);
48642           if (gj.type === "FeatureCollection") {
48643             gj.features.forEach(stringifyGeojsonProperties);
48644           } else if (gj.type === "Feature") {
48645             stringifyGeojsonProperties(gj);
48646           }
48647           break;
48648       }
48649       gj = gj || {};
48650       if (Object.keys(gj).length) {
48651         _geojson = ensureIDs(gj);
48652         _src = extension + " data file";
48653         this.fitZoom();
48654       }
48655       dispatch14.call("change");
48656       return this;
48657     };
48658     drawData.showLabels = function(val) {
48659       if (!arguments.length)
48660         return _showLabels;
48661       _showLabels = val;
48662       return this;
48663     };
48664     drawData.enabled = function(val) {
48665       if (!arguments.length)
48666         return _enabled;
48667       _enabled = val;
48668       if (_enabled) {
48669         showLayer();
48670       } else {
48671         hideLayer();
48672       }
48673       dispatch14.call("change");
48674       return this;
48675     };
48676     drawData.hasData = function() {
48677       var gj = _geojson || {};
48678       return !!(_template || Object.keys(gj).length);
48679     };
48680     drawData.template = function(val, src) {
48681       if (!arguments.length)
48682         return _template;
48683       var osm = context.connection();
48684       if (osm) {
48685         var blocklists = osm.imageryBlocklists();
48686         var fail = false;
48687         var tested = 0;
48688         var regex;
48689         for (var i3 = 0; i3 < blocklists.length; i3++) {
48690           regex = blocklists[i3];
48691           fail = regex.test(val);
48692           tested++;
48693           if (fail)
48694             break;
48695         }
48696         if (!tested) {
48697           regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
48698           fail = regex.test(val);
48699         }
48700       }
48701       _template = val;
48702       _fileList = null;
48703       _geojson = null;
48704       _src = src || "vectortile:" + val.split(/[?#]/)[0];
48705       dispatch14.call("change");
48706       return this;
48707     };
48708     drawData.geojson = function(gj, src) {
48709       if (!arguments.length)
48710         return _geojson;
48711       _template = null;
48712       _fileList = null;
48713       _geojson = null;
48714       _src = null;
48715       gj = gj || {};
48716       if (Object.keys(gj).length) {
48717         _geojson = ensureIDs(gj);
48718         _src = src || "unknown.geojson";
48719       }
48720       dispatch14.call("change");
48721       return this;
48722     };
48723     drawData.fileList = function(fileList) {
48724       if (!arguments.length)
48725         return _fileList;
48726       _template = null;
48727       _geojson = null;
48728       _src = null;
48729       _fileList = fileList;
48730       if (!fileList || !fileList.length)
48731         return this;
48732       var f3 = fileList[0];
48733       var extension = getExtension(f3.name);
48734       var reader = new FileReader();
48735       reader.onload = function() {
48736         return function(e3) {
48737           drawData.setFile(extension, e3.target.result);
48738         };
48739       }(f3);
48740       reader.readAsText(f3);
48741       return this;
48742     };
48743     drawData.url = function(url, defaultExtension) {
48744       _template = null;
48745       _fileList = null;
48746       _geojson = null;
48747       _src = null;
48748       var testUrl = url.split(/[?#]/)[0];
48749       var extension = getExtension(testUrl) || defaultExtension;
48750       if (extension) {
48751         _template = null;
48752         text_default3(url).then(function(data) {
48753           drawData.setFile(extension, data);
48754         }).catch(function() {
48755         });
48756       } else {
48757         drawData.template(url);
48758       }
48759       return this;
48760     };
48761     drawData.getSrc = function() {
48762       return _src || "";
48763     };
48764     drawData.fitZoom = function() {
48765       var features = getFeatures(_geojson);
48766       if (!features.length)
48767         return;
48768       var map2 = context.map();
48769       var viewport = map2.trimmedExtent().polygon();
48770       var coords = features.reduce(function(coords2, feature3) {
48771         var geom = feature3.geometry;
48772         if (!geom)
48773           return coords2;
48774         var c2 = geom.coordinates;
48775         switch (geom.type) {
48776           case "Point":
48777             c2 = [c2];
48778           case "MultiPoint":
48779           case "LineString":
48780             break;
48781           case "MultiPolygon":
48782             c2 = utilArrayFlatten(c2);
48783           case "Polygon":
48784           case "MultiLineString":
48785             c2 = utilArrayFlatten(c2);
48786             break;
48787         }
48788         return utilArrayUnion(coords2, c2);
48789       }, []);
48790       if (!geoPolygonIntersectsPolygon(viewport, coords, true)) {
48791         var extent = geoExtent(bounds_default({ type: "LineString", coordinates: coords }));
48792         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
48793       }
48794       return this;
48795     };
48796     init2();
48797     return drawData;
48798   }
48799
48800   // modules/svg/debug.js
48801   function svgDebug(projection2, context) {
48802     function drawDebug(selection2) {
48803       const showTile = context.getDebug("tile");
48804       const showCollision = context.getDebug("collision");
48805       const showImagery = context.getDebug("imagery");
48806       const showTouchTargets = context.getDebug("target");
48807       const showDownloaded = context.getDebug("downloaded");
48808       let debugData = [];
48809       if (showTile) {
48810         debugData.push({ class: "red", label: "tile" });
48811       }
48812       if (showCollision) {
48813         debugData.push({ class: "yellow", label: "collision" });
48814       }
48815       if (showImagery) {
48816         debugData.push({ class: "orange", label: "imagery" });
48817       }
48818       if (showTouchTargets) {
48819         debugData.push({ class: "pink", label: "touchTargets" });
48820       }
48821       if (showDownloaded) {
48822         debugData.push({ class: "purple", label: "downloaded" });
48823       }
48824       let legend = context.container().select(".main-content").selectAll(".debug-legend").data(debugData.length ? [0] : []);
48825       legend.exit().remove();
48826       legend = legend.enter().append("div").attr("class", "fillD debug-legend").merge(legend);
48827       let legendItems = legend.selectAll(".debug-legend-item").data(debugData, (d2) => d2.label);
48828       legendItems.exit().remove();
48829       legendItems.enter().append("span").attr("class", (d2) => "debug-legend-item ".concat(d2.class)).text((d2) => d2.label);
48830       let layer = selection2.selectAll(".layer-debug").data(showImagery || showDownloaded ? [0] : []);
48831       layer.exit().remove();
48832       layer = layer.enter().append("g").attr("class", "layer-debug").merge(layer);
48833       const extent = context.map().extent();
48834       _mainFileFetcher.get("imagery").then((d2) => {
48835         const hits = showImagery && d2.query.bbox(extent.rectangle(), true) || [];
48836         const features = hits.map((d4) => d4.features[d4.id]);
48837         let imagery = layer.selectAll("path.debug-imagery").data(features);
48838         imagery.exit().remove();
48839         imagery.enter().append("path").attr("class", "debug-imagery debug orange");
48840       }).catch(() => {
48841       });
48842       const osm = context.connection();
48843       let dataDownloaded = [];
48844       if (osm && showDownloaded) {
48845         const rtree = osm.caches("get").tile.rtree;
48846         dataDownloaded = rtree.all().map((bbox2) => {
48847           return {
48848             type: "Feature",
48849             properties: { id: bbox2.id },
48850             geometry: {
48851               type: "Polygon",
48852               coordinates: [[
48853                 [bbox2.minX, bbox2.minY],
48854                 [bbox2.minX, bbox2.maxY],
48855                 [bbox2.maxX, bbox2.maxY],
48856                 [bbox2.maxX, bbox2.minY],
48857                 [bbox2.minX, bbox2.minY]
48858               ]]
48859             }
48860           };
48861         });
48862       }
48863       let downloaded = layer.selectAll("path.debug-downloaded").data(showDownloaded ? dataDownloaded : []);
48864       downloaded.exit().remove();
48865       downloaded.enter().append("path").attr("class", "debug-downloaded debug purple");
48866       layer.selectAll("path").attr("d", svgPath(projection2).geojson);
48867     }
48868     drawDebug.enabled = function() {
48869       if (!arguments.length) {
48870         return context.getDebug("tile") || context.getDebug("collision") || context.getDebug("imagery") || context.getDebug("target") || context.getDebug("downloaded");
48871       } else {
48872         return this;
48873       }
48874     };
48875     return drawDebug;
48876   }
48877
48878   // modules/svg/defs.js
48879   function svgDefs(context) {
48880     var _defsSelection = select_default2(null);
48881     var _spritesheetIds = [
48882       "iD-sprite",
48883       "maki-sprite",
48884       "temaki-sprite",
48885       "fa-sprite",
48886       "roentgen-sprite",
48887       "community-sprite"
48888     ];
48889     function drawDefs(selection2) {
48890       _defsSelection = selection2.append("defs");
48891       _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");
48892       function addSidedMarker(name, color2, offset) {
48893         _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);
48894       }
48895       addSidedMarker("natural", "rgb(170, 170, 170)", 0);
48896       addSidedMarker("coastline", "#77dede", 1);
48897       addSidedMarker("waterway", "#77dede", 1);
48898       addSidedMarker("barrier", "#ddd", 1);
48899       addSidedMarker("man_made", "#fff", 0);
48900       _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");
48901       _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");
48902       var patterns2 = _defsSelection.selectAll("pattern").data([
48903         // pattern name, pattern image name
48904         ["beach", "dots"],
48905         ["construction", "construction"],
48906         ["cemetery", "cemetery"],
48907         ["cemetery_christian", "cemetery_christian"],
48908         ["cemetery_buddhist", "cemetery_buddhist"],
48909         ["cemetery_muslim", "cemetery_muslim"],
48910         ["cemetery_jewish", "cemetery_jewish"],
48911         ["farmland", "farmland"],
48912         ["farmyard", "farmyard"],
48913         ["forest", "forest"],
48914         ["forest_broadleaved", "forest_broadleaved"],
48915         ["forest_needleleaved", "forest_needleleaved"],
48916         ["forest_leafless", "forest_leafless"],
48917         ["golf_green", "grass"],
48918         ["grass", "grass"],
48919         ["landfill", "landfill"],
48920         ["meadow", "grass"],
48921         ["orchard", "orchard"],
48922         ["pond", "pond"],
48923         ["quarry", "quarry"],
48924         ["scrub", "bushes"],
48925         ["vineyard", "vineyard"],
48926         ["water_standing", "lines"],
48927         ["waves", "waves"],
48928         ["wetland", "wetland"],
48929         ["wetland_marsh", "wetland_marsh"],
48930         ["wetland_swamp", "wetland_swamp"],
48931         ["wetland_bog", "wetland_bog"],
48932         ["wetland_reedbed", "wetland_reedbed"]
48933       ]).enter().append("pattern").attr("id", function(d2) {
48934         return "ideditor-pattern-" + d2[0];
48935       }).attr("width", 32).attr("height", 32).attr("patternUnits", "userSpaceOnUse");
48936       patterns2.append("rect").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("class", function(d2) {
48937         return "pattern-color-" + d2[0];
48938       });
48939       patterns2.append("image").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("xlink:href", function(d2) {
48940         return context.imagePath("pattern/" + d2[1] + ".png");
48941       });
48942       _defsSelection.selectAll("clipPath").data([12, 18, 20, 32, 45]).enter().append("clipPath").attr("id", function(d2) {
48943         return "ideditor-clip-square-" + d2;
48944       }).append("rect").attr("x", 0).attr("y", 0).attr("width", function(d2) {
48945         return d2;
48946       }).attr("height", function(d2) {
48947         return d2;
48948       });
48949       addSprites(_spritesheetIds, true);
48950     }
48951     function addSprites(ids, overrideColors) {
48952       _spritesheetIds = utilArrayUniq(_spritesheetIds.concat(ids));
48953       var spritesheets = _defsSelection.selectAll(".spritesheet").data(_spritesheetIds);
48954       spritesheets.enter().append("g").attr("class", function(d2) {
48955         return "spritesheet spritesheet-" + d2;
48956       }).each(function(d2) {
48957         var url = context.imagePath(d2 + ".svg");
48958         var node = select_default2(this).node();
48959         svg(url).then(function(svg2) {
48960           node.appendChild(
48961             select_default2(svg2.documentElement).attr("id", "ideditor-" + d2).node()
48962           );
48963           if (overrideColors && d2 !== "iD-sprite") {
48964             select_default2(node).selectAll("path").attr("fill", "currentColor");
48965           }
48966         }).catch(function() {
48967         });
48968       });
48969       spritesheets.exit().remove();
48970     }
48971     drawDefs.addSprites = addSprites;
48972     return drawDefs;
48973   }
48974
48975   // modules/svg/keepRight.js
48976   var _layerEnabled = false;
48977   var _qaService;
48978   function svgKeepRight(projection2, context, dispatch14) {
48979     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
48980     const minZoom4 = 12;
48981     let touchLayer = select_default2(null);
48982     let drawLayer = select_default2(null);
48983     let layerVisible = false;
48984     function markerPath(selection2, klass) {
48985       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");
48986     }
48987     function getService() {
48988       if (services.keepRight && !_qaService) {
48989         _qaService = services.keepRight;
48990         _qaService.on("loaded", throttledRedraw);
48991       } else if (!services.keepRight && _qaService) {
48992         _qaService = null;
48993       }
48994       return _qaService;
48995     }
48996     function editOn() {
48997       if (!layerVisible) {
48998         layerVisible = true;
48999         drawLayer.style("display", "block");
49000       }
49001     }
49002     function editOff() {
49003       if (layerVisible) {
49004         layerVisible = false;
49005         drawLayer.style("display", "none");
49006         drawLayer.selectAll(".qaItem.keepRight").remove();
49007         touchLayer.selectAll(".qaItem.keepRight").remove();
49008       }
49009     }
49010     function layerOn() {
49011       editOn();
49012       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
49013     }
49014     function layerOff() {
49015       throttledRedraw.cancel();
49016       drawLayer.interrupt();
49017       touchLayer.selectAll(".qaItem.keepRight").remove();
49018       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
49019         editOff();
49020         dispatch14.call("change");
49021       });
49022     }
49023     function updateMarkers() {
49024       if (!layerVisible || !_layerEnabled)
49025         return;
49026       const service = getService();
49027       const selectedID = context.selectedErrorID();
49028       const data = service ? service.getItems(projection2) : [];
49029       const getTransform = svgPointTransform(projection2);
49030       const markers = drawLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
49031       markers.exit().remove();
49032       const markersEnter = markers.enter().append("g").attr("class", (d2) => "qaItem ".concat(d2.service, " itemId-").concat(d2.id, " itemType-").concat(d2.parentIssueType));
49033       markersEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
49034       markersEnter.append("path").call(markerPath, "shadow");
49035       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");
49036       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
49037       if (touchLayer.empty())
49038         return;
49039       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
49040       const targets = touchLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
49041       targets.exit().remove();
49042       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);
49043       function sortY(a2, b2) {
49044         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];
49045       }
49046     }
49047     function drawKeepRight(selection2) {
49048       const service = getService();
49049       const surface = context.surface();
49050       if (surface && !surface.empty()) {
49051         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
49052       }
49053       drawLayer = selection2.selectAll(".layer-keepRight").data(service ? [0] : []);
49054       drawLayer.exit().remove();
49055       drawLayer = drawLayer.enter().append("g").attr("class", "layer-keepRight").style("display", _layerEnabled ? "block" : "none").merge(drawLayer);
49056       if (_layerEnabled) {
49057         if (service && ~~context.map().zoom() >= minZoom4) {
49058           editOn();
49059           service.loadIssues(projection2);
49060           updateMarkers();
49061         } else {
49062           editOff();
49063         }
49064       }
49065     }
49066     drawKeepRight.enabled = function(val) {
49067       if (!arguments.length)
49068         return _layerEnabled;
49069       _layerEnabled = val;
49070       if (_layerEnabled) {
49071         layerOn();
49072       } else {
49073         layerOff();
49074         if (context.selectedErrorID()) {
49075           context.enter(modeBrowse(context));
49076         }
49077       }
49078       dispatch14.call("change");
49079       return this;
49080     };
49081     drawKeepRight.supported = () => !!getService();
49082     return drawKeepRight;
49083   }
49084
49085   // modules/svg/geolocate.js
49086   function svgGeolocate(projection2) {
49087     var layer = select_default2(null);
49088     var _position;
49089     function init2() {
49090       if (svgGeolocate.initialized)
49091         return;
49092       svgGeolocate.enabled = false;
49093       svgGeolocate.initialized = true;
49094     }
49095     function showLayer() {
49096       layer.style("display", "block");
49097     }
49098     function hideLayer() {
49099       layer.transition().duration(250).style("opacity", 0);
49100     }
49101     function layerOn() {
49102       layer.style("opacity", 0).transition().duration(250).style("opacity", 1);
49103     }
49104     function layerOff() {
49105       layer.style("display", "none");
49106     }
49107     function transform2(d2) {
49108       return svgPointTransform(projection2)(d2);
49109     }
49110     function accuracy(accuracy2, loc) {
49111       var degreesRadius = geoMetersToLat(accuracy2), tangentLoc = [loc[0], loc[1] + degreesRadius], projectedTangent = projection2(tangentLoc), projectedLoc = projection2([loc[0], loc[1]]);
49112       return Math.round(projectedLoc[1] - projectedTangent[1]).toString();
49113     }
49114     function update() {
49115       var geolocation = { loc: [_position.coords.longitude, _position.coords.latitude] };
49116       var groups = layer.selectAll(".geolocations").selectAll(".geolocation").data([geolocation]);
49117       groups.exit().remove();
49118       var pointsEnter = groups.enter().append("g").attr("class", "geolocation");
49119       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");
49120       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");
49121       groups.merge(pointsEnter).attr("transform", transform2);
49122       layer.select(".geolocate-radius").attr("r", accuracy(_position.coords.accuracy, geolocation.loc));
49123     }
49124     function drawLocation(selection2) {
49125       var enabled = svgGeolocate.enabled;
49126       layer = selection2.selectAll(".layer-geolocate").data([0]);
49127       layer.exit().remove();
49128       var layerEnter = layer.enter().append("g").attr("class", "layer-geolocate").style("display", enabled ? "block" : "none");
49129       layerEnter.append("g").attr("class", "geolocations");
49130       layer = layerEnter.merge(layer);
49131       if (enabled) {
49132         update();
49133       } else {
49134         layerOff();
49135       }
49136     }
49137     drawLocation.enabled = function(position, enabled) {
49138       if (!arguments.length)
49139         return svgGeolocate.enabled;
49140       _position = position;
49141       svgGeolocate.enabled = enabled;
49142       if (svgGeolocate.enabled) {
49143         showLayer();
49144         layerOn();
49145       } else {
49146         hideLayer();
49147       }
49148       return this;
49149     };
49150     init2();
49151     return drawLocation;
49152   }
49153
49154   // modules/svg/labels.js
49155   var import_rbush6 = __toESM(require_rbush_min());
49156   function svgLabels(projection2, context) {
49157     var path = path_default(projection2);
49158     var detected = utilDetect();
49159     var baselineHack = detected.ie || detected.browser.toLowerCase() === "edge" || detected.browser.toLowerCase() === "firefox" && detected.version >= 70;
49160     var _rdrawn = new import_rbush6.default();
49161     var _rskipped = new import_rbush6.default();
49162     var _textWidthCache = {};
49163     var _entitybboxes = {};
49164     var labelStack = [
49165       ["line", "aeroway", "*", 12],
49166       ["line", "highway", "motorway", 12],
49167       ["line", "highway", "trunk", 12],
49168       ["line", "highway", "primary", 12],
49169       ["line", "highway", "secondary", 12],
49170       ["line", "highway", "tertiary", 12],
49171       ["line", "highway", "*", 12],
49172       ["line", "railway", "*", 12],
49173       ["line", "waterway", "*", 12],
49174       ["area", "aeroway", "*", 12],
49175       ["area", "amenity", "*", 12],
49176       ["area", "building", "*", 12],
49177       ["area", "historic", "*", 12],
49178       ["area", "leisure", "*", 12],
49179       ["area", "man_made", "*", 12],
49180       ["area", "natural", "*", 12],
49181       ["area", "shop", "*", 12],
49182       ["area", "tourism", "*", 12],
49183       ["area", "camp_site", "*", 12],
49184       ["point", "aeroway", "*", 10],
49185       ["point", "amenity", "*", 10],
49186       ["point", "building", "*", 10],
49187       ["point", "historic", "*", 10],
49188       ["point", "leisure", "*", 10],
49189       ["point", "man_made", "*", 10],
49190       ["point", "natural", "*", 10],
49191       ["point", "shop", "*", 10],
49192       ["point", "tourism", "*", 10],
49193       ["point", "camp_site", "*", 10],
49194       ["line", "ref", "*", 12],
49195       ["area", "ref", "*", 12],
49196       ["point", "ref", "*", 10],
49197       ["line", "name", "*", 12],
49198       ["area", "name", "*", 12],
49199       ["point", "name", "*", 10]
49200     ];
49201     function shouldSkipIcon(preset) {
49202       var noIcons = ["building", "landuse", "natural"];
49203       return noIcons.some(function(s2) {
49204         return preset.id.indexOf(s2) >= 0;
49205       });
49206     }
49207     function get4(array2, prop) {
49208       return function(d2, i3) {
49209         return array2[i3][prop];
49210       };
49211     }
49212     function textWidth(text2, size, elem) {
49213       var c2 = _textWidthCache[size];
49214       if (!c2)
49215         c2 = _textWidthCache[size] = {};
49216       if (c2[text2]) {
49217         return c2[text2];
49218       } else if (elem) {
49219         c2[text2] = elem.getComputedTextLength();
49220         return c2[text2];
49221       } else {
49222         var str2 = encodeURIComponent(text2).match(/%[CDEFcdef]/g);
49223         if (str2 === null) {
49224           return size / 3 * 2 * text2.length;
49225         } else {
49226           return size / 3 * (2 * text2.length + str2.length);
49227         }
49228       }
49229     }
49230     function drawLinePaths(selection2, entities, filter2, classes, labels) {
49231       var paths = selection2.selectAll("path").filter(filter2).data(entities, osmEntity.key);
49232       paths.exit().remove();
49233       paths.enter().append("path").style("stroke-width", get4(labels, "font-size")).attr("id", function(d2) {
49234         return "ideditor-labelpath-" + d2.id;
49235       }).attr("class", classes).merge(paths).attr("d", get4(labels, "lineString"));
49236     }
49237     function drawLineLabels(selection2, entities, filter2, classes, labels) {
49238       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
49239       texts.exit().remove();
49240       texts.enter().append("text").attr("class", function(d2, i3) {
49241         return classes + " " + labels[i3].classes + " " + d2.id;
49242       }).attr("dy", baselineHack ? "0.35em" : null).append("textPath").attr("class", "textpath");
49243       selection2.selectAll("text." + classes).selectAll(".textpath").filter(filter2).data(entities, osmEntity.key).attr("startOffset", "50%").attr("xlink:href", function(d2) {
49244         return "#ideditor-labelpath-" + d2.id;
49245       }).text(utilDisplayNameForPath);
49246     }
49247     function drawPointLabels(selection2, entities, filter2, classes, labels) {
49248       var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
49249       texts.exit().remove();
49250       texts.enter().append("text").attr("class", function(d2, i3) {
49251         return classes + " " + labels[i3].classes + " " + d2.id;
49252       }).merge(texts).attr("x", get4(labels, "x")).attr("y", get4(labels, "y")).style("text-anchor", get4(labels, "textAnchor")).text(utilDisplayName).each(function(d2, i3) {
49253         textWidth(utilDisplayName(d2), labels[i3].height, this);
49254       });
49255     }
49256     function drawAreaLabels(selection2, entities, filter2, classes, labels) {
49257       entities = entities.filter(hasText);
49258       labels = labels.filter(hasText);
49259       drawPointLabels(selection2, entities, filter2, classes, labels);
49260       function hasText(d2, i3) {
49261         return labels[i3].hasOwnProperty("x") && labels[i3].hasOwnProperty("y");
49262       }
49263     }
49264     function drawAreaIcons(selection2, entities, filter2, classes, labels) {
49265       var icons = selection2.selectAll("use." + classes).filter(filter2).data(entities, osmEntity.key);
49266       icons.exit().remove();
49267       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) {
49268         var preset = _mainPresetIndex.match(d2, context.graph());
49269         var picon = preset && preset.icon;
49270         return picon ? "#" + picon : "";
49271       });
49272     }
49273     function drawCollisionBoxes(selection2, rtree, which) {
49274       var classes = "debug " + which + " " + (which === "debug-skipped" ? "orange" : "yellow");
49275       var gj = [];
49276       if (context.getDebug("collision")) {
49277         gj = rtree.all().map(function(d2) {
49278           return { type: "Polygon", coordinates: [[
49279             [d2.minX, d2.minY],
49280             [d2.maxX, d2.minY],
49281             [d2.maxX, d2.maxY],
49282             [d2.minX, d2.maxY],
49283             [d2.minX, d2.minY]
49284           ]] };
49285         });
49286       }
49287       var boxes = selection2.selectAll("." + which).data(gj);
49288       boxes.exit().remove();
49289       boxes.enter().append("path").attr("class", classes).merge(boxes).attr("d", path_default());
49290     }
49291     function drawLabels(selection2, graph, entities, filter2, dimensions, fullRedraw) {
49292       var wireframe = context.surface().classed("fill-wireframe");
49293       var zoom = geoScaleToZoom(projection2.scale());
49294       var labelable = [];
49295       var renderNodeAs = {};
49296       var i3, j3, k2, entity, geometry;
49297       for (i3 = 0; i3 < labelStack.length; i3++) {
49298         labelable.push([]);
49299       }
49300       if (fullRedraw) {
49301         _rdrawn.clear();
49302         _rskipped.clear();
49303         _entitybboxes = {};
49304       } else {
49305         for (i3 = 0; i3 < entities.length; i3++) {
49306           entity = entities[i3];
49307           var toRemove = [].concat(_entitybboxes[entity.id] || []).concat(_entitybboxes[entity.id + "I"] || []);
49308           for (j3 = 0; j3 < toRemove.length; j3++) {
49309             _rdrawn.remove(toRemove[j3]);
49310             _rskipped.remove(toRemove[j3]);
49311           }
49312         }
49313       }
49314       for (i3 = 0; i3 < entities.length; i3++) {
49315         entity = entities[i3];
49316         geometry = entity.geometry(graph);
49317         if (geometry === "point" || geometry === "vertex" && isInterestingVertex(entity)) {
49318           var hasDirections = entity.directions(graph, projection2).length;
49319           var markerPadding;
49320           if (!wireframe && geometry === "point" && !(zoom >= 18 && hasDirections)) {
49321             renderNodeAs[entity.id] = "point";
49322             markerPadding = 20;
49323           } else {
49324             renderNodeAs[entity.id] = "vertex";
49325             markerPadding = 0;
49326           }
49327           var coord2 = projection2(entity.loc);
49328           var nodePadding = 10;
49329           var bbox2 = {
49330             minX: coord2[0] - nodePadding,
49331             minY: coord2[1] - nodePadding - markerPadding,
49332             maxX: coord2[0] + nodePadding,
49333             maxY: coord2[1] + nodePadding
49334           };
49335           doInsert(bbox2, entity.id + "P");
49336         }
49337         if (geometry === "vertex") {
49338           geometry = "point";
49339         }
49340         var preset = geometry === "area" && _mainPresetIndex.match(entity, graph);
49341         var icon2 = preset && !shouldSkipIcon(preset) && preset.icon;
49342         if (!icon2 && !utilDisplayName(entity))
49343           continue;
49344         for (k2 = 0; k2 < labelStack.length; k2++) {
49345           var matchGeom = labelStack[k2][0];
49346           var matchKey = labelStack[k2][1];
49347           var matchVal = labelStack[k2][2];
49348           var hasVal = entity.tags[matchKey];
49349           if (geometry === matchGeom && hasVal && (matchVal === "*" || matchVal === hasVal)) {
49350             labelable[k2].push(entity);
49351             break;
49352           }
49353         }
49354       }
49355       var positions = {
49356         point: [],
49357         line: [],
49358         area: []
49359       };
49360       var labelled = {
49361         point: [],
49362         line: [],
49363         area: []
49364       };
49365       for (k2 = 0; k2 < labelable.length; k2++) {
49366         var fontSize = labelStack[k2][3];
49367         for (i3 = 0; i3 < labelable[k2].length; i3++) {
49368           entity = labelable[k2][i3];
49369           geometry = entity.geometry(graph);
49370           var getName = geometry === "line" ? utilDisplayNameForPath : utilDisplayName;
49371           var name = getName(entity);
49372           var width = name && textWidth(name, fontSize);
49373           var p2 = null;
49374           if (geometry === "point" || geometry === "vertex") {
49375             if (wireframe)
49376               continue;
49377             var renderAs = renderNodeAs[entity.id];
49378             if (renderAs === "vertex" && zoom < 17)
49379               continue;
49380             p2 = getPointLabel(entity, width, fontSize, renderAs);
49381           } else if (geometry === "line") {
49382             p2 = getLineLabel(entity, width, fontSize);
49383           } else if (geometry === "area") {
49384             p2 = getAreaLabel(entity, width, fontSize);
49385           }
49386           if (p2) {
49387             if (geometry === "vertex") {
49388               geometry = "point";
49389             }
49390             p2.classes = geometry + " tag-" + labelStack[k2][1];
49391             positions[geometry].push(p2);
49392             labelled[geometry].push(entity);
49393           }
49394         }
49395       }
49396       function isInterestingVertex(entity2) {
49397         var selectedIDs = context.selectedIDs();
49398         return entity2.hasInterestingTags() || entity2.isEndpoint(graph) || entity2.isConnected(graph) || selectedIDs.indexOf(entity2.id) !== -1 || graph.parentWays(entity2).some(function(parent) {
49399           return selectedIDs.indexOf(parent.id) !== -1;
49400         });
49401       }
49402       function getPointLabel(entity2, width2, height, geometry2) {
49403         var y2 = geometry2 === "point" ? -12 : 0;
49404         var pointOffsets = {
49405           ltr: [15, y2, "start"],
49406           rtl: [-15, y2, "end"]
49407         };
49408         var textDirection = _mainLocalizer.textDirection();
49409         var coord3 = projection2(entity2.loc);
49410         var textPadding = 2;
49411         var offset = pointOffsets[textDirection];
49412         var p3 = {
49413           height,
49414           width: width2,
49415           x: coord3[0] + offset[0],
49416           y: coord3[1] + offset[1],
49417           textAnchor: offset[2]
49418         };
49419         var bbox3;
49420         if (textDirection === "rtl") {
49421           bbox3 = {
49422             minX: p3.x - width2 - textPadding,
49423             minY: p3.y - height / 2 - textPadding,
49424             maxX: p3.x + textPadding,
49425             maxY: p3.y + height / 2 + textPadding
49426           };
49427         } else {
49428           bbox3 = {
49429             minX: p3.x - textPadding,
49430             minY: p3.y - height / 2 - textPadding,
49431             maxX: p3.x + width2 + textPadding,
49432             maxY: p3.y + height / 2 + textPadding
49433           };
49434         }
49435         if (tryInsert([bbox3], entity2.id, true)) {
49436           return p3;
49437         }
49438       }
49439       function getLineLabel(entity2, width2, height) {
49440         var viewport = geoExtent(context.projection.clipExtent()).polygon();
49441         var points = graph.childNodes(entity2).map(function(node) {
49442           return projection2(node.loc);
49443         });
49444         var length = geoPathLength(points);
49445         if (length < width2 + 20)
49446           return;
49447         var lineOffsets = [
49448           50,
49449           45,
49450           55,
49451           40,
49452           60,
49453           35,
49454           65,
49455           30,
49456           70,
49457           25,
49458           75,
49459           20,
49460           80,
49461           15,
49462           95,
49463           10,
49464           90,
49465           5,
49466           95
49467         ];
49468         var padding = 3;
49469         for (var i4 = 0; i4 < lineOffsets.length; i4++) {
49470           var offset = lineOffsets[i4];
49471           var middle = offset / 100 * length;
49472           var start2 = middle - width2 / 2;
49473           if (start2 < 0 || start2 + width2 > length)
49474             continue;
49475           var sub = subpath(points, start2, start2 + width2);
49476           if (!sub || !geoPolygonIntersectsPolygon(viewport, sub, true)) {
49477             continue;
49478           }
49479           var isReverse = reverse(sub);
49480           if (isReverse) {
49481             sub = sub.reverse();
49482           }
49483           var bboxes = [];
49484           var boxsize = (height + 2) / 2;
49485           for (var j4 = 0; j4 < sub.length - 1; j4++) {
49486             var a2 = sub[j4];
49487             var b2 = sub[j4 + 1];
49488             var num = Math.max(1, Math.floor(geoVecLength(a2, b2) / boxsize / 2));
49489             for (var box = 0; box < num; box++) {
49490               var p3 = geoVecInterp(a2, b2, box / num);
49491               var x05 = p3[0] - boxsize - padding;
49492               var y05 = p3[1] - boxsize - padding;
49493               var x12 = p3[0] + boxsize + padding;
49494               var y12 = p3[1] + boxsize + padding;
49495               bboxes.push({
49496                 minX: Math.min(x05, x12),
49497                 minY: Math.min(y05, y12),
49498                 maxX: Math.max(x05, x12),
49499                 maxY: Math.max(y05, y12)
49500               });
49501             }
49502           }
49503           if (tryInsert(bboxes, entity2.id, false)) {
49504             return {
49505               "font-size": height + 2,
49506               lineString: lineString2(sub),
49507               startOffset: offset + "%"
49508             };
49509           }
49510         }
49511         function reverse(p4) {
49512           var angle2 = Math.atan2(p4[1][1] - p4[0][1], p4[1][0] - p4[0][0]);
49513           return !(p4[0][0] < p4[p4.length - 1][0] && angle2 < Math.PI / 2 && angle2 > -Math.PI / 2);
49514         }
49515         function lineString2(points2) {
49516           return "M" + points2.join("L");
49517         }
49518         function subpath(points2, from, to) {
49519           var sofar = 0;
49520           var start3, end, i0, i1;
49521           for (var i5 = 0; i5 < points2.length - 1; i5++) {
49522             var a3 = points2[i5];
49523             var b3 = points2[i5 + 1];
49524             var current = geoVecLength(a3, b3);
49525             var portion;
49526             if (!start3 && sofar + current >= from) {
49527               portion = (from - sofar) / current;
49528               start3 = [
49529                 a3[0] + portion * (b3[0] - a3[0]),
49530                 a3[1] + portion * (b3[1] - a3[1])
49531               ];
49532               i0 = i5 + 1;
49533             }
49534             if (!end && sofar + current >= to) {
49535               portion = (to - sofar) / current;
49536               end = [
49537                 a3[0] + portion * (b3[0] - a3[0]),
49538                 a3[1] + portion * (b3[1] - a3[1])
49539               ];
49540               i1 = i5 + 1;
49541             }
49542             sofar += current;
49543           }
49544           var result = points2.slice(i0, i1);
49545           result.unshift(start3);
49546           result.push(end);
49547           return result;
49548         }
49549       }
49550       function getAreaLabel(entity2, width2, height) {
49551         var centroid = path.centroid(entity2.asGeoJSON(graph));
49552         var extent = entity2.extent(graph);
49553         var areaWidth = projection2(extent[1])[0] - projection2(extent[0])[0];
49554         if (isNaN(centroid[0]) || areaWidth < 20)
49555           return;
49556         var preset2 = _mainPresetIndex.match(entity2, context.graph());
49557         var picon = preset2 && preset2.icon;
49558         var iconSize = 17;
49559         var padding = 2;
49560         var p3 = {};
49561         if (picon) {
49562           if (addIcon()) {
49563             addLabel(iconSize + padding);
49564             return p3;
49565           }
49566         } else {
49567           if (addLabel(0)) {
49568             return p3;
49569           }
49570         }
49571         function addIcon() {
49572           var iconX = centroid[0] - iconSize / 2;
49573           var iconY = centroid[1] - iconSize / 2;
49574           var bbox3 = {
49575             minX: iconX,
49576             minY: iconY,
49577             maxX: iconX + iconSize,
49578             maxY: iconY + iconSize
49579           };
49580           if (tryInsert([bbox3], entity2.id + "I", true)) {
49581             p3.transform = "translate(" + iconX + "," + iconY + ")";
49582             return true;
49583           }
49584           return false;
49585         }
49586         function addLabel(yOffset) {
49587           if (width2 && areaWidth >= width2 + 20) {
49588             var labelX = centroid[0];
49589             var labelY = centroid[1] + yOffset;
49590             var bbox3 = {
49591               minX: labelX - width2 / 2 - padding,
49592               minY: labelY - height / 2 - padding,
49593               maxX: labelX + width2 / 2 + padding,
49594               maxY: labelY + height / 2 + padding
49595             };
49596             if (tryInsert([bbox3], entity2.id, true)) {
49597               p3.x = labelX;
49598               p3.y = labelY;
49599               p3.textAnchor = "middle";
49600               p3.height = height;
49601               return true;
49602             }
49603           }
49604           return false;
49605         }
49606       }
49607       function doInsert(bbox3, id2) {
49608         bbox3.id = id2;
49609         var oldbox = _entitybboxes[id2];
49610         if (oldbox) {
49611           _rdrawn.remove(oldbox);
49612         }
49613         _entitybboxes[id2] = bbox3;
49614         _rdrawn.insert(bbox3);
49615       }
49616       function tryInsert(bboxes, id2, saveSkipped) {
49617         var skipped = false;
49618         for (var i4 = 0; i4 < bboxes.length; i4++) {
49619           var bbox3 = bboxes[i4];
49620           bbox3.id = id2;
49621           if (bbox3.minX < 0 || bbox3.minY < 0 || bbox3.maxX > dimensions[0] || bbox3.maxY > dimensions[1]) {
49622             skipped = true;
49623             break;
49624           }
49625           if (_rdrawn.collides(bbox3)) {
49626             skipped = true;
49627             break;
49628           }
49629         }
49630         _entitybboxes[id2] = bboxes;
49631         if (skipped) {
49632           if (saveSkipped) {
49633             _rskipped.load(bboxes);
49634           }
49635         } else {
49636           _rdrawn.load(bboxes);
49637         }
49638         return !skipped;
49639       }
49640       var layer = selection2.selectAll(".layer-osm.labels");
49641       layer.selectAll(".labels-group").data(["halo", "label", "debug"]).enter().append("g").attr("class", function(d2) {
49642         return "labels-group " + d2;
49643       });
49644       var halo = layer.selectAll(".labels-group.halo");
49645       var label = layer.selectAll(".labels-group.label");
49646       var debug2 = layer.selectAll(".labels-group.debug");
49647       drawPointLabels(label, labelled.point, filter2, "pointlabel", positions.point);
49648       drawPointLabels(halo, labelled.point, filter2, "pointlabel-halo", positions.point);
49649       drawLinePaths(layer, labelled.line, filter2, "", positions.line);
49650       drawLineLabels(label, labelled.line, filter2, "linelabel", positions.line);
49651       drawLineLabels(halo, labelled.line, filter2, "linelabel-halo", positions.line);
49652       drawAreaLabels(label, labelled.area, filter2, "arealabel", positions.area);
49653       drawAreaLabels(halo, labelled.area, filter2, "arealabel-halo", positions.area);
49654       drawAreaIcons(label, labelled.area, filter2, "areaicon", positions.area);
49655       drawAreaIcons(halo, labelled.area, filter2, "areaicon-halo", positions.area);
49656       drawCollisionBoxes(debug2, _rskipped, "debug-skipped");
49657       drawCollisionBoxes(debug2, _rdrawn, "debug-drawn");
49658       layer.call(filterLabels);
49659     }
49660     function filterLabels(selection2) {
49661       var drawLayer = selection2.selectAll(".layer-osm.labels");
49662       var layers = drawLayer.selectAll(".labels-group.halo, .labels-group.label");
49663       layers.selectAll(".nolabel").classed("nolabel", false);
49664       var mouse = context.map().mouse();
49665       var graph = context.graph();
49666       var selectedIDs = context.selectedIDs();
49667       var ids = [];
49668       var pad2, bbox2;
49669       if (mouse) {
49670         pad2 = 20;
49671         bbox2 = { minX: mouse[0] - pad2, minY: mouse[1] - pad2, maxX: mouse[0] + pad2, maxY: mouse[1] + pad2 };
49672         var nearMouse = _rdrawn.search(bbox2).map(function(entity2) {
49673           return entity2.id;
49674         });
49675         ids.push.apply(ids, nearMouse);
49676       }
49677       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
49678         var entity = graph.hasEntity(selectedIDs[i3]);
49679         if (entity && entity.type === "node") {
49680           ids.push(selectedIDs[i3]);
49681         }
49682       }
49683       layers.selectAll(utilEntitySelector(ids)).classed("nolabel", true);
49684       var debug2 = selection2.selectAll(".labels-group.debug");
49685       var gj = [];
49686       if (context.getDebug("collision")) {
49687         gj = bbox2 ? [{
49688           type: "Polygon",
49689           coordinates: [[
49690             [bbox2.minX, bbox2.minY],
49691             [bbox2.maxX, bbox2.minY],
49692             [bbox2.maxX, bbox2.maxY],
49693             [bbox2.minX, bbox2.maxY],
49694             [bbox2.minX, bbox2.minY]
49695           ]]
49696         }] : [];
49697       }
49698       var box = debug2.selectAll(".debug-mouse").data(gj);
49699       box.exit().remove();
49700       box.enter().append("path").attr("class", "debug debug-mouse yellow").merge(box).attr("d", path_default());
49701     }
49702     var throttleFilterLabels = throttle_default(filterLabels, 100);
49703     drawLabels.observe = function(selection2) {
49704       var listener = function() {
49705         throttleFilterLabels(selection2);
49706       };
49707       selection2.on("mousemove.hidelabels", listener);
49708       context.on("enter.hidelabels", listener);
49709     };
49710     drawLabels.off = function(selection2) {
49711       throttleFilterLabels.cancel();
49712       selection2.on("mousemove.hidelabels", null);
49713       context.on("enter.hidelabels", null);
49714     };
49715     return drawLabels;
49716   }
49717
49718   // node_modules/exifr/dist/full.esm.mjs
49719   var e = "undefined" != typeof self ? self : global;
49720   var t = "undefined" != typeof navigator;
49721   var i2 = t && "undefined" == typeof HTMLImageElement;
49722   var n2 = !("undefined" == typeof global || "undefined" == typeof process || !process.versions || !process.versions.node);
49723   var s = e.Buffer;
49724   var r = e.BigInt;
49725   var a = !!s;
49726   var o = (e3) => e3;
49727   function l(e3, t2 = o) {
49728     if (n2)
49729       try {
49730         return "function" == typeof __require ? Promise.resolve(t2(__require(e3))) : Promise.resolve().then(() => (
49731           /* webpackIgnore: true */
49732           __toESM(__require(e3))
49733         )).then(t2);
49734       } catch (t3) {
49735         console.warn("Couldn't load ".concat(e3));
49736       }
49737   }
49738   var h = e.fetch;
49739   var u = (e3) => h = e3;
49740   if (!e.fetch) {
49741     const e3 = l("http", (e4) => e4), t2 = l("https", (e4) => e4), i3 = (n3, { headers: s2 } = {}) => new Promise(async (r2, a2) => {
49742       let { port: o2, hostname: l2, pathname: h2, protocol: u2, search: c2 } = new URL(n3);
49743       const f3 = { method: "GET", hostname: l2, path: encodeURI(h2) + c2, headers: s2 };
49744       "" !== o2 && (f3.port = Number(o2));
49745       const d2 = ("https:" === u2 ? await t2 : await e3).request(f3, (e4) => {
49746         if (301 === e4.statusCode || 302 === e4.statusCode) {
49747           let t3 = new URL(e4.headers.location, n3).toString();
49748           return i3(t3, { headers: s2 }).then(r2).catch(a2);
49749         }
49750         r2({ status: e4.statusCode, arrayBuffer: () => new Promise((t3) => {
49751           let i4 = [];
49752           e4.on("data", (e6) => i4.push(e6)), e4.on("end", () => t3(Buffer.concat(i4)));
49753         }) });
49754       });
49755       d2.on("error", a2), d2.end();
49756     });
49757     u(i3);
49758   }
49759   function c(e3, t2, i3) {
49760     return t2 in e3 ? Object.defineProperty(e3, t2, { value: i3, enumerable: true, configurable: true, writable: true }) : e3[t2] = i3, e3;
49761   }
49762   var f2 = (e3) => p(e3) ? void 0 : e3;
49763   var d = (e3) => void 0 !== e3;
49764   function p(e3) {
49765     return void 0 === e3 || (e3 instanceof Map ? 0 === e3.size : 0 === Object.values(e3).filter(d).length);
49766   }
49767   function g2(e3) {
49768     let t2 = new Error(e3);
49769     throw delete t2.stack, t2;
49770   }
49771   function m(e3) {
49772     return "" === (e3 = function(e4) {
49773       for (; e4.endsWith("\0"); )
49774         e4 = e4.slice(0, -1);
49775       return e4;
49776     }(e3).trim()) ? void 0 : e3;
49777   }
49778   function S(e3) {
49779     let t2 = function(e4) {
49780       let t3 = 0;
49781       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;
49782     }(e3);
49783     return e3.jfif.enabled && (t2 += 50), e3.xmp.enabled && (t2 += 2e4), e3.iptc.enabled && (t2 += 14e3), e3.icc.enabled && (t2 += 6e3), t2;
49784   }
49785   var C = (e3) => String.fromCharCode.apply(null, e3);
49786   var y = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : void 0;
49787   function b(e3) {
49788     return y ? y.decode(e3) : a ? Buffer.from(e3).toString("utf8") : decodeURIComponent(escape(C(e3)));
49789   }
49790   var I = class _I {
49791     static from(e3, t2) {
49792       return e3 instanceof this && e3.le === t2 ? e3 : new _I(e3, void 0, void 0, t2);
49793     }
49794     constructor(e3, t2 = 0, i3, n3) {
49795       if ("boolean" == typeof n3 && (this.le = n3), Array.isArray(e3) && (e3 = new Uint8Array(e3)), 0 === e3)
49796         this.byteOffset = 0, this.byteLength = 0;
49797       else if (e3 instanceof ArrayBuffer) {
49798         void 0 === i3 && (i3 = e3.byteLength - t2);
49799         let n4 = new DataView(e3, t2, i3);
49800         this._swapDataView(n4);
49801       } else if (e3 instanceof Uint8Array || e3 instanceof DataView || e3 instanceof _I) {
49802         void 0 === i3 && (i3 = e3.byteLength - t2), (t2 += e3.byteOffset) + i3 > e3.byteOffset + e3.byteLength && g2("Creating view outside of available memory in ArrayBuffer");
49803         let n4 = new DataView(e3.buffer, t2, i3);
49804         this._swapDataView(n4);
49805       } else if ("number" == typeof e3) {
49806         let t3 = new DataView(new ArrayBuffer(e3));
49807         this._swapDataView(t3);
49808       } else
49809         g2("Invalid input argument for BufferView: " + e3);
49810     }
49811     _swapArrayBuffer(e3) {
49812       this._swapDataView(new DataView(e3));
49813     }
49814     _swapBuffer(e3) {
49815       this._swapDataView(new DataView(e3.buffer, e3.byteOffset, e3.byteLength));
49816     }
49817     _swapDataView(e3) {
49818       this.dataView = e3, this.buffer = e3.buffer, this.byteOffset = e3.byteOffset, this.byteLength = e3.byteLength;
49819     }
49820     _lengthToEnd(e3) {
49821       return this.byteLength - e3;
49822     }
49823     set(e3, t2, i3 = _I) {
49824       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);
49825     }
49826     subarray(e3, t2) {
49827       return t2 = t2 || this._lengthToEnd(e3), new _I(this, e3, t2);
49828     }
49829     toUint8() {
49830       return new Uint8Array(this.buffer, this.byteOffset, this.byteLength);
49831     }
49832     getUint8Array(e3, t2) {
49833       return new Uint8Array(this.buffer, this.byteOffset + e3, t2);
49834     }
49835     getString(e3 = 0, t2 = this.byteLength) {
49836       return b(this.getUint8Array(e3, t2));
49837     }
49838     getLatin1String(e3 = 0, t2 = this.byteLength) {
49839       let i3 = this.getUint8Array(e3, t2);
49840       return C(i3);
49841     }
49842     getUnicodeString(e3 = 0, t2 = this.byteLength) {
49843       const i3 = [];
49844       for (let n3 = 0; n3 < t2 && e3 + n3 < this.byteLength; n3 += 2)
49845         i3.push(this.getUint16(e3 + n3));
49846       return C(i3);
49847     }
49848     getInt8(e3) {
49849       return this.dataView.getInt8(e3);
49850     }
49851     getUint8(e3) {
49852       return this.dataView.getUint8(e3);
49853     }
49854     getInt16(e3, t2 = this.le) {
49855       return this.dataView.getInt16(e3, t2);
49856     }
49857     getInt32(e3, t2 = this.le) {
49858       return this.dataView.getInt32(e3, t2);
49859     }
49860     getUint16(e3, t2 = this.le) {
49861       return this.dataView.getUint16(e3, t2);
49862     }
49863     getUint32(e3, t2 = this.le) {
49864       return this.dataView.getUint32(e3, t2);
49865     }
49866     getFloat32(e3, t2 = this.le) {
49867       return this.dataView.getFloat32(e3, t2);
49868     }
49869     getFloat64(e3, t2 = this.le) {
49870       return this.dataView.getFloat64(e3, t2);
49871     }
49872     getFloat(e3, t2 = this.le) {
49873       return this.dataView.getFloat32(e3, t2);
49874     }
49875     getDouble(e3, t2 = this.le) {
49876       return this.dataView.getFloat64(e3, t2);
49877     }
49878     getUintBytes(e3, t2, i3) {
49879       switch (t2) {
49880         case 1:
49881           return this.getUint8(e3, i3);
49882         case 2:
49883           return this.getUint16(e3, i3);
49884         case 4:
49885           return this.getUint32(e3, i3);
49886         case 8:
49887           return this.getUint64 && this.getUint64(e3, i3);
49888       }
49889     }
49890     getUint(e3, t2, i3) {
49891       switch (t2) {
49892         case 8:
49893           return this.getUint8(e3, i3);
49894         case 16:
49895           return this.getUint16(e3, i3);
49896         case 32:
49897           return this.getUint32(e3, i3);
49898         case 64:
49899           return this.getUint64 && this.getUint64(e3, i3);
49900       }
49901     }
49902     toString(e3) {
49903       return this.dataView.toString(e3, this.constructor.name);
49904     }
49905     ensureChunk() {
49906     }
49907   };
49908   function P(e3, t2) {
49909     g2("".concat(e3, " '").concat(t2, "' was not loaded, try using full build of exifr."));
49910   }
49911   var k = class extends Map {
49912     constructor(e3) {
49913       super(), this.kind = e3;
49914     }
49915     get(e3, t2) {
49916       return this.has(e3) || P(this.kind, e3), t2 && (e3 in t2 || function(e4, t3) {
49917         g2("Unknown ".concat(e4, " '").concat(t3, "'."));
49918       }(this.kind, e3), t2[e3].enabled || P(this.kind, e3)), super.get(e3);
49919     }
49920     keyList() {
49921       return Array.from(this.keys());
49922     }
49923   };
49924   var w = new k("file parser");
49925   var T = new k("segment parser");
49926   var A = new k("file reader");
49927   function D(e3, n3) {
49928     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");
49929   }
49930   function O(e3, i3) {
49931     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");
49932     var s2;
49933   }
49934   async function x(e3, t2, i3, n3) {
49935     return A.has(i3) ? v(e3, t2, i3) : n3 ? async function(e4, t3) {
49936       let i4 = await t3(e4);
49937       return new I(i4);
49938     }(e3, n3) : void g2("Parser ".concat(i3, " is not loaded"));
49939   }
49940   async function v(e3, t2, i3) {
49941     let n3 = new (A.get(i3))(e3, t2);
49942     return await n3.read(), n3;
49943   }
49944   var M = (e3) => h(e3).then((e4) => e4.arrayBuffer());
49945   var R = (e3) => new Promise((t2, i3) => {
49946     let n3 = new FileReader();
49947     n3.onloadend = () => t2(n3.result || new ArrayBuffer()), n3.onerror = i3, n3.readAsArrayBuffer(e3);
49948   });
49949   var L = class extends Map {
49950     get tagKeys() {
49951       return this.allKeys || (this.allKeys = Array.from(this.keys())), this.allKeys;
49952     }
49953     get tagValues() {
49954       return this.allValues || (this.allValues = Array.from(this.values())), this.allValues;
49955     }
49956   };
49957   function U(e3, t2, i3) {
49958     let n3 = new L();
49959     for (let [e4, t3] of i3)
49960       n3.set(e4, t3);
49961     if (Array.isArray(t2))
49962       for (let i4 of t2)
49963         e3.set(i4, n3);
49964     else
49965       e3.set(t2, n3);
49966     return n3;
49967   }
49968   function F(e3, t2, i3) {
49969     let n3, s2 = e3.get(t2);
49970     for (n3 of i3)
49971       s2.set(n3[0], n3[1]);
49972   }
49973   var E = /* @__PURE__ */ new Map();
49974   var B = /* @__PURE__ */ new Map();
49975   var N = /* @__PURE__ */ new Map();
49976   var G = ["chunked", "firstChunkSize", "firstChunkSizeNode", "firstChunkSizeBrowser", "chunkSize", "chunkLimit"];
49977   var V = ["jfif", "xmp", "icc", "iptc", "ihdr"];
49978   var z = ["tiff", ...V];
49979   var H = ["ifd0", "ifd1", "exif", "gps", "interop"];
49980   var j2 = [...z, ...H];
49981   var W = ["makerNote", "userComment"];
49982   var K = ["translateKeys", "translateValues", "reviveValues", "multiSegment"];
49983   var X = [...K, "sanitize", "mergeOutput", "silentErrors"];
49984   var _ = class {
49985     get translate() {
49986       return this.translateKeys || this.translateValues || this.reviveValues;
49987     }
49988   };
49989   var Y = class extends _ {
49990     get needed() {
49991       return this.enabled || this.deps.size > 0;
49992     }
49993     constructor(e3, t2, i3, n3) {
49994       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)
49995         if (Array.isArray(i3))
49996           this.parse = this.enabled = true, this.canBeFiltered && i3.length > 0 && this.translateTagSet(i3, this.pick);
49997         else if ("object" == typeof i3) {
49998           if (this.enabled = true, this.parse = false !== i3.parse, this.canBeFiltered) {
49999             let { pick: e4, skip: t3 } = i3;
50000             e4 && e4.length > 0 && this.translateTagSet(e4, this.pick), t3 && t3.length > 0 && this.translateTagSet(t3, this.skip);
50001           }
50002           this.applyInheritables(i3);
50003         } else
50004           true === i3 || false === i3 ? this.parse = this.enabled = i3 : g2("Invalid options argument: ".concat(i3));
50005     }
50006     applyInheritables(e3) {
50007       let t2, i3;
50008       for (t2 of K)
50009         i3 = e3[t2], void 0 !== i3 && (this[t2] = i3);
50010     }
50011     translateTagSet(e3, t2) {
50012       if (this.dict) {
50013         let i3, n3, { tagKeys: s2, tagValues: r2 } = this.dict;
50014         for (i3 of e3)
50015           "string" == typeof i3 ? (n3 = r2.indexOf(i3), -1 === n3 && (n3 = s2.indexOf(Number(i3))), -1 !== n3 && t2.add(Number(s2[n3]))) : t2.add(i3);
50016       } else
50017         for (let i3 of e3)
50018           t2.add(i3);
50019     }
50020     finalizeFilters() {
50021       !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);
50022     }
50023   };
50024   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 };
50025   var J = /* @__PURE__ */ new Map();
50026   var q = class extends _ {
50027     static useCached(e3) {
50028       let t2 = J.get(e3);
50029       return void 0 !== t2 || (t2 = new this(e3), J.set(e3, t2)), t2;
50030     }
50031     constructor(e3) {
50032       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();
50033     }
50034     setupFromUndefined() {
50035       let e3;
50036       for (e3 of G)
50037         this[e3] = $2[e3];
50038       for (e3 of X)
50039         this[e3] = $2[e3];
50040       for (e3 of W)
50041         this[e3] = $2[e3];
50042       for (e3 of j2)
50043         this[e3] = new Y(e3, $2[e3], void 0, this);
50044     }
50045     setupFromTrue() {
50046       let e3;
50047       for (e3 of G)
50048         this[e3] = $2[e3];
50049       for (e3 of X)
50050         this[e3] = $2[e3];
50051       for (e3 of W)
50052         this[e3] = true;
50053       for (e3 of j2)
50054         this[e3] = new Y(e3, true, void 0, this);
50055     }
50056     setupFromArray(e3) {
50057       let t2;
50058       for (t2 of G)
50059         this[t2] = $2[t2];
50060       for (t2 of X)
50061         this[t2] = $2[t2];
50062       for (t2 of W)
50063         this[t2] = $2[t2];
50064       for (t2 of j2)
50065         this[t2] = new Y(t2, false, void 0, this);
50066       this.setupGlobalFilters(e3, void 0, H);
50067     }
50068     setupFromObject(e3) {
50069       let t2;
50070       for (t2 of (H.ifd0 = H.ifd0 || H.image, H.ifd1 = H.ifd1 || H.thumbnail, Object.assign(this, e3), G))
50071         this[t2] = Z(e3[t2], $2[t2]);
50072       for (t2 of X)
50073         this[t2] = Z(e3[t2], $2[t2]);
50074       for (t2 of W)
50075         this[t2] = Z(e3[t2], $2[t2]);
50076       for (t2 of z)
50077         this[t2] = new Y(t2, $2[t2], e3[t2], this);
50078       for (t2 of H)
50079         this[t2] = new Y(t2, $2[t2], e3[t2], this.tiff);
50080       this.setupGlobalFilters(e3.pick, e3.skip, H, j2), true === e3.tiff ? this.batchEnableWithBool(H, true) : false === e3.tiff ? this.batchEnableWithUserValue(H, e3) : Array.isArray(e3.tiff) ? this.setupGlobalFilters(e3.tiff, void 0, H) : "object" == typeof e3.tiff && this.setupGlobalFilters(e3.tiff.pick, e3.tiff.skip, H);
50081     }
50082     batchEnableWithBool(e3, t2) {
50083       for (let i3 of e3)
50084         this[i3].enabled = t2;
50085     }
50086     batchEnableWithUserValue(e3, t2) {
50087       for (let i3 of e3) {
50088         let e4 = t2[i3];
50089         this[i3].enabled = false !== e4 && void 0 !== e4;
50090       }
50091     }
50092     setupGlobalFilters(e3, t2, i3, n3 = i3) {
50093       if (e3 && e3.length) {
50094         for (let e4 of n3)
50095           this[e4].enabled = false;
50096         let t3 = Q(e3, i3);
50097         for (let [e4, i4] of t3)
50098           ee(this[e4].pick, i4), this[e4].enabled = true;
50099       } else if (t2 && t2.length) {
50100         let e4 = Q(t2, i3);
50101         for (let [t3, i4] of e4)
50102           ee(this[t3].skip, i4);
50103       }
50104     }
50105     filterNestedSegmentTags() {
50106       let { ifd0: e3, exif: t2, xmp: i3, iptc: n3, icc: s2 } = this;
50107       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);
50108     }
50109     traverseTiffDependencyTree() {
50110       let { ifd0: e3, exif: t2, gps: i3, interop: n3 } = this;
50111       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;
50112       for (let e4 of H)
50113         this[e4].finalizeFilters();
50114     }
50115     get onlyTiff() {
50116       return !V.map((e3) => this[e3].enabled).some((e3) => true === e3) && this.tiff.enabled;
50117     }
50118     checkLoadedPlugins() {
50119       for (let e3 of z)
50120         this[e3].enabled && !T.has(e3) && P("segment parser", e3);
50121     }
50122   };
50123   function Q(e3, t2) {
50124     let i3, n3, s2, r2, a2 = [];
50125     for (s2 of t2) {
50126       for (r2 of (i3 = E.get(s2), n3 = [], i3))
50127         (e3.includes(r2[0]) || e3.includes(r2[1])) && n3.push(r2[0]);
50128       n3.length && a2.push([s2, n3]);
50129     }
50130     return a2;
50131   }
50132   function Z(e3, t2) {
50133     return void 0 !== e3 ? e3 : void 0 !== t2 ? t2 : void 0;
50134   }
50135   function ee(e3, t2) {
50136     for (let i3 of t2)
50137       e3.add(i3);
50138   }
50139   c(q, "default", $2);
50140   var te = class {
50141     constructor(e3) {
50142       c(this, "parsers", {}), c(this, "output", {}), c(this, "errors", []), c(this, "pushToErrors", (e4) => this.errors.push(e4)), this.options = q.useCached(e3);
50143     }
50144     async read(e3) {
50145       this.file = await D(e3, this.options);
50146     }
50147     setup() {
50148       if (this.fileParser)
50149         return;
50150       let { file: e3 } = this, t2 = e3.getUint16(0);
50151       for (let [i3, n3] of w)
50152         if (n3.canHandle(e3, t2))
50153           return this.fileParser = new n3(this.options, this.file, this.parsers), e3[i3] = true;
50154       this.file.close && this.file.close(), g2("Unknown file format");
50155     }
50156     async parse() {
50157       let { output: e3, errors: t2 } = this;
50158       return this.setup(), this.options.silentErrors ? (await this.executeParsers().catch(this.pushToErrors), t2.push(...this.fileParser.errors)) : await this.executeParsers(), this.file.close && this.file.close(), this.options.silentErrors && t2.length > 0 && (e3.errors = t2), f2(e3);
50159     }
50160     async executeParsers() {
50161       let { output: e3 } = this;
50162       await this.fileParser.parse();
50163       let t2 = Object.values(this.parsers).map(async (t3) => {
50164         let i3 = await t3.parse();
50165         t3.assignToOutput(e3, i3);
50166       });
50167       this.options.silentErrors && (t2 = t2.map((e4) => e4.catch(this.pushToErrors))), await Promise.all(t2);
50168     }
50169     async extractThumbnail() {
50170       this.setup();
50171       let { options: e3, file: t2 } = this, i3 = T.get("tiff", e3);
50172       var n3;
50173       if (t2.tiff ? n3 = { start: 0, type: "tiff" } : t2.jpeg && (n3 = await this.fileParser.getOrFindSegment("tiff")), void 0 === n3)
50174         return;
50175       let s2 = await this.fileParser.ensureSegmentChunk(n3), r2 = this.parsers.tiff = new i3(s2, e3, t2), a2 = await r2.extractThumbnail();
50176       return t2.close && t2.close(), a2;
50177     }
50178   };
50179   async function ie(e3, t2) {
50180     let i3 = new te(t2);
50181     return await i3.read(e3), i3.parse();
50182   }
50183   var ne = Object.freeze({ __proto__: null, parse: ie, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j2, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q });
50184   var se = class {
50185     constructor(e3, t2, i3) {
50186       c(this, "errors", []), c(this, "ensureSegmentChunk", async (e4) => {
50187         let t3 = e4.start, i4 = e4.size || 65536;
50188         if (this.file.chunked)
50189           if (this.file.available(t3, i4))
50190             e4.chunk = this.file.subarray(t3, i4);
50191           else
50192             try {
50193               e4.chunk = await this.file.readChunk(t3, i4);
50194             } catch (t4) {
50195               g2("Couldn't read segment: ".concat(JSON.stringify(e4), ". ").concat(t4.message));
50196             }
50197         else
50198           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));
50199         return e4.chunk;
50200       }), this.extendOptions && this.extendOptions(e3), this.options = e3, this.file = t2, this.parsers = i3;
50201     }
50202     injectSegment(e3, t2) {
50203       this.options[e3].enabled && this.createParser(e3, t2);
50204     }
50205     createParser(e3, t2) {
50206       let i3 = new (T.get(e3))(t2, this.options, this.file);
50207       return this.parsers[e3] = i3;
50208     }
50209     createParsers(e3) {
50210       for (let t2 of e3) {
50211         let { type: e4, chunk: i3 } = t2, n3 = this.options[e4];
50212         if (n3 && n3.enabled) {
50213           let t3 = this.parsers[e4];
50214           t3 && t3.append || t3 || this.createParser(e4, i3);
50215         }
50216       }
50217     }
50218     async readSegments(e3) {
50219       let t2 = e3.map(this.ensureSegmentChunk);
50220       await Promise.all(t2);
50221     }
50222   };
50223   var re2 = class {
50224     static findPosition(e3, t2) {
50225       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;
50226       return { offset: t2, length: i3, headerLength: n3, start: s2, size: r2, end: s2 + r2 };
50227     }
50228     static parse(e3, t2 = {}) {
50229       return new this(e3, new q({ [this.type]: t2 }), e3).parse();
50230     }
50231     normalizeInput(e3) {
50232       return e3 instanceof I ? e3 : new I(e3);
50233     }
50234     constructor(e3, t2 = {}, i3) {
50235       c(this, "errors", []), c(this, "raw", /* @__PURE__ */ new Map()), c(this, "handleError", (e4) => {
50236         if (!this.options.silentErrors)
50237           throw e4;
50238         this.errors.push(e4.message);
50239       }), 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;
50240     }
50241     translate() {
50242       this.canTranslate && (this.translated = this.translateBlock(this.raw, this.type));
50243     }
50244     get output() {
50245       return this.translated ? this.translated : this.raw ? Object.fromEntries(this.raw) : void 0;
50246     }
50247     translateBlock(e3, t2) {
50248       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 = {};
50249       for (let [t3, r3] of e3)
50250         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;
50251       return h2;
50252     }
50253     translateValue(e3, t2) {
50254       return t2[e3] || t2.DEFAULT || e3;
50255     }
50256     assignToOutput(e3, t2) {
50257       this.assignObjectToOutput(e3, this.constructor.type, t2);
50258     }
50259     assignObjectToOutput(e3, t2, i3) {
50260       if (this.globalOptions.mergeOutput)
50261         return Object.assign(e3, i3);
50262       e3[t2] ? Object.assign(e3[t2], i3) : e3[t2] = i3;
50263     }
50264   };
50265   c(re2, "headerLength", 4), c(re2, "type", void 0), c(re2, "multiSegment", false), c(re2, "canHandle", () => false);
50266   function ae(e3) {
50267     return 192 === e3 || 194 === e3 || 196 === e3 || 219 === e3 || 221 === e3 || 218 === e3 || 254 === e3;
50268   }
50269   function oe(e3) {
50270     return e3 >= 224 && e3 <= 239;
50271   }
50272   function le(e3, t2, i3) {
50273     for (let [n3, s2] of T)
50274       if (s2.canHandle(e3, t2, i3))
50275         return n3;
50276   }
50277   var he = class extends se {
50278     constructor(...e3) {
50279       super(...e3), c(this, "appSegments", []), c(this, "jpegSegments", []), c(this, "unknownSegments", []);
50280     }
50281     static canHandle(e3, t2) {
50282       return 65496 === t2;
50283     }
50284     async parse() {
50285       await this.findAppSegments(), await this.readSegments(this.appSegments), this.mergeMultiSegments(), this.createParsers(this.mergedAppSegments || this.appSegments);
50286     }
50287     setupSegmentFinderArgs(e3) {
50288       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;
50289     }
50290     async findAppSegments(e3 = 0, t2) {
50291       this.setupSegmentFinderArgs(t2);
50292       let { file: i3, findAll: n3, wanted: s2, remaining: r2 } = this;
50293       if (!n3 && this.file.chunked && (n3 = Array.from(s2).some((e4) => {
50294         let t3 = T.get(e4), i4 = this.options[e4];
50295         return t3.multiSegment && i4.multiSegment;
50296       }), n3 && await this.file.readWhole()), e3 = this.findAppSegmentsInRange(e3, i3.byteLength), !this.options.onlyTiff && i3.chunked) {
50297         let t3 = false;
50298         for (; r2.size > 0 && !t3 && (i3.canReadNextChunk || this.unfinishedMultiSegment); ) {
50299           let { nextChunkOffset: n4 } = i3, s3 = this.appSegments.some((e4) => !this.file.available(e4.offset || e4.start, e4.length || e4.size));
50300           if (t3 = e3 > n4 && !s3 ? !await i3.readNextChunk(e3) : !await i3.readNextChunk(n4), void 0 === (e3 = this.findAppSegmentsInRange(e3, i3.byteLength)))
50301             return;
50302         }
50303       }
50304     }
50305     findAppSegmentsInRange(e3, t2) {
50306       t2 -= 2;
50307       let i3, n3, s2, r2, a2, o2, { file: l2, findAll: h2, wanted: u2, remaining: c2, options: f3 } = this;
50308       for (; e3 < t2; e3++)
50309         if (255 === l2.getUint8(e3)) {
50310           if (i3 = l2.getUint8(e3 + 1), oe(i3)) {
50311             if (n3 = l2.getUint16(e3 + 2), s2 = le(l2, e3, n3), s2 && u2.has(s2) && (r2 = T.get(s2), a2 = r2.findPosition(l2, e3), o2 = f3[s2], a2.type = s2, this.appSegments.push(a2), !h2 && (r2.multiSegment && o2.multiSegment ? (this.unfinishedMultiSegment = a2.chunkNumber < a2.chunkCount, this.unfinishedMultiSegment || c2.delete(s2)) : c2.delete(s2), 0 === c2.size)))
50312               break;
50313             f3.recordUnknownSegments && (a2 = re2.findPosition(l2, e3), a2.marker = i3, this.unknownSegments.push(a2)), e3 += n3 + 1;
50314           } else if (ae(i3)) {
50315             if (n3 = l2.getUint16(e3 + 2), 218 === i3 && false !== f3.stopAfterSos)
50316               return;
50317             f3.recordJpegSegments && this.jpegSegments.push({ offset: e3, length: n3, marker: i3 }), e3 += n3 + 1;
50318           }
50319         }
50320       return e3;
50321     }
50322     mergeMultiSegments() {
50323       if (!this.appSegments.some((e4) => e4.multiSegment))
50324         return;
50325       let e3 = function(e4, t2) {
50326         let i3, n3, s2, r2 = /* @__PURE__ */ new Map();
50327         for (let a2 = 0; a2 < e4.length; a2++)
50328           i3 = e4[a2], n3 = i3[t2], r2.has(n3) ? s2 = r2.get(n3) : r2.set(n3, s2 = []), s2.push(i3);
50329         return Array.from(r2);
50330       }(this.appSegments, "type");
50331       this.mergedAppSegments = e3.map(([e4, t2]) => {
50332         let i3 = T.get(e4, this.options);
50333         if (i3.handleMultiSegments) {
50334           return { type: e4, chunk: i3.handleMultiSegments(t2) };
50335         }
50336         return t2[0];
50337       });
50338     }
50339     getSegment(e3) {
50340       return this.appSegments.find((t2) => t2.type === e3);
50341     }
50342     async getOrFindSegment(e3) {
50343       let t2 = this.getSegment(e3);
50344       return void 0 === t2 && (await this.findAppSegments(0, [e3]), t2 = this.getSegment(e3)), t2;
50345     }
50346   };
50347   c(he, "type", "jpeg"), w.set("jpeg", he);
50348   var ue = [void 0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 4];
50349   var ce = class extends re2 {
50350     parseHeader() {
50351       var e3 = this.chunk.getUint16();
50352       18761 === e3 ? this.le = true : 19789 === e3 && (this.le = false), this.chunk.le = this.le, this.headerParsed = true;
50353     }
50354     parseTags(e3, t2, i3 = /* @__PURE__ */ new Map()) {
50355       let { pick: n3, skip: s2 } = this.options[t2];
50356       n3 = new Set(n3);
50357       let r2 = n3.size > 0, a2 = 0 === s2.size, o2 = this.chunk.getUint16(e3);
50358       e3 += 2;
50359       for (let l2 = 0; l2 < o2; l2++) {
50360         let o3 = this.chunk.getUint16(e3);
50361         if (r2) {
50362           if (n3.has(o3) && (i3.set(o3, this.parseTag(e3, o3, t2)), n3.delete(o3), 0 === n3.size))
50363             break;
50364         } else
50365           !a2 && s2.has(o3) || i3.set(o3, this.parseTag(e3, o3, t2));
50366         e3 += 12;
50367       }
50368       return i3;
50369     }
50370     parseTag(e3, t2, i3) {
50371       let { chunk: n3 } = this, s2 = n3.getUint16(e3 + 2), r2 = n3.getUint32(e3 + 4), a2 = ue[s2];
50372       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)
50373         return n3.getUint8Array(e3, r2);
50374       if (2 === s2)
50375         return m(n3.getString(e3, r2));
50376       if (7 === s2)
50377         return n3.getUint8Array(e3, r2);
50378       if (1 === r2)
50379         return this.parseTagValue(s2, e3);
50380       {
50381         let t3 = new (function(e4) {
50382           switch (e4) {
50383             case 1:
50384               return Uint8Array;
50385             case 3:
50386               return Uint16Array;
50387             case 4:
50388               return Uint32Array;
50389             case 5:
50390               return Array;
50391             case 6:
50392               return Int8Array;
50393             case 8:
50394               return Int16Array;
50395             case 9:
50396               return Int32Array;
50397             case 10:
50398               return Array;
50399             case 11:
50400               return Float32Array;
50401             case 12:
50402               return Float64Array;
50403             default:
50404               return Array;
50405           }
50406         }(s2))(r2), i4 = a2;
50407         for (let n4 = 0; n4 < r2; n4++)
50408           t3[n4] = this.parseTagValue(s2, e3), e3 += i4;
50409         return t3;
50410       }
50411     }
50412     parseTagValue(e3, t2) {
50413       let { chunk: i3 } = this;
50414       switch (e3) {
50415         case 1:
50416           return i3.getUint8(t2);
50417         case 3:
50418           return i3.getUint16(t2);
50419         case 4:
50420           return i3.getUint32(t2);
50421         case 5:
50422           return i3.getUint32(t2) / i3.getUint32(t2 + 4);
50423         case 6:
50424           return i3.getInt8(t2);
50425         case 8:
50426           return i3.getInt16(t2);
50427         case 9:
50428           return i3.getInt32(t2);
50429         case 10:
50430           return i3.getInt32(t2) / i3.getInt32(t2 + 4);
50431         case 11:
50432           return i3.getFloat(t2);
50433         case 12:
50434           return i3.getDouble(t2);
50435         case 13:
50436           return i3.getUint32(t2);
50437         default:
50438           g2("Invalid tiff type ".concat(e3));
50439       }
50440     }
50441   };
50442   var fe = class extends ce {
50443     static canHandle(e3, t2) {
50444       return 225 === e3.getUint8(t2 + 1) && 1165519206 === e3.getUint32(t2 + 4) && 0 === e3.getUint16(t2 + 8);
50445     }
50446     async parse() {
50447       this.parseHeader();
50448       let { options: e3 } = this;
50449       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();
50450     }
50451     safeParse(e3) {
50452       let t2 = this[e3]();
50453       return void 0 !== t2.catch && (t2 = t2.catch(this.handleError)), t2;
50454     }
50455     findIfd0Offset() {
50456       void 0 === this.ifd0Offset && (this.ifd0Offset = this.chunk.getUint32(4));
50457     }
50458     findIfd1Offset() {
50459       if (void 0 === this.ifd1Offset) {
50460         this.findIfd0Offset();
50461         let e3 = this.chunk.getUint16(this.ifd0Offset), t2 = this.ifd0Offset + 2 + 12 * e3;
50462         this.ifd1Offset = this.chunk.getUint32(t2);
50463       }
50464     }
50465     parseBlock(e3, t2) {
50466       let i3 = /* @__PURE__ */ new Map();
50467       return this[t2] = i3, this.parseTags(e3, t2, i3), i3;
50468     }
50469     async parseIfd0Block() {
50470       if (this.ifd0)
50471         return;
50472       let { file: e3 } = this;
50473       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));
50474       let t2 = this.parseBlock(this.ifd0Offset, "ifd0");
50475       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;
50476     }
50477     async parseExifBlock() {
50478       if (this.exif)
50479         return;
50480       if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.exifOffset)
50481         return;
50482       this.file.tiff && await this.file.ensureChunk(this.exifOffset, S(this.options));
50483       let e3 = this.parseBlock(this.exifOffset, "exif");
50484       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;
50485     }
50486     unpack(e3, t2) {
50487       let i3 = e3.get(t2);
50488       i3 && 1 === i3.length && e3.set(t2, i3[0]);
50489     }
50490     async parseGpsBlock() {
50491       if (this.gps)
50492         return;
50493       if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.gpsOffset)
50494         return;
50495       let e3 = this.parseBlock(this.gpsOffset, "gps");
50496       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;
50497     }
50498     async parseInteropBlock() {
50499       if (!this.interop && (this.ifd0 || await this.parseIfd0Block(), void 0 !== this.interopOffset || this.exif || await this.parseExifBlock(), void 0 !== this.interopOffset))
50500         return this.parseBlock(this.interopOffset, "interop");
50501     }
50502     async parseThumbnailBlock(e3 = false) {
50503       if (!this.ifd1 && !this.ifd1Parsed && (!this.options.mergeOutput || e3))
50504         return this.findIfd1Offset(), this.ifd1Offset > 0 && (this.parseBlock(this.ifd1Offset, "ifd1"), this.ifd1Parsed = true), this.ifd1;
50505     }
50506     async extractThumbnail() {
50507       if (this.headerParsed || this.parseHeader(), this.ifd1Parsed || await this.parseThumbnailBlock(true), void 0 === this.ifd1)
50508         return;
50509       let e3 = this.ifd1.get(513), t2 = this.ifd1.get(514);
50510       return this.chunk.getUint8Array(e3, t2);
50511     }
50512     get image() {
50513       return this.ifd0;
50514     }
50515     get thumbnail() {
50516       return this.ifd1;
50517     }
50518     createOutput() {
50519       let e3, t2, i3, n3 = {};
50520       for (t2 of H)
50521         if (e3 = this[t2], !p(e3))
50522           if (i3 = this.canTranslate ? this.translateBlock(e3, t2) : Object.fromEntries(e3), this.options.mergeOutput) {
50523             if ("ifd1" === t2)
50524               continue;
50525             Object.assign(n3, i3);
50526           } else
50527             n3[t2] = i3;
50528       return this.makerNote && (n3.makerNote = this.makerNote), this.userComment && (n3.userComment = this.userComment), n3;
50529     }
50530     assignToOutput(e3, t2) {
50531       if (this.globalOptions.mergeOutput)
50532         Object.assign(e3, t2);
50533       else
50534         for (let [i3, n3] of Object.entries(t2))
50535           this.assignObjectToOutput(e3, i3, n3);
50536     }
50537   };
50538   function de(e3, t2, i3, n3) {
50539     var s2 = e3 + t2 / 60 + i3 / 3600;
50540     return "S" !== n3 && "W" !== n3 || (s2 *= -1), s2;
50541   }
50542   c(fe, "type", "tiff"), c(fe, "headerLength", 10), T.set("tiff", fe);
50543   var pe = Object.freeze({ __proto__: null, default: ne, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j2, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q, parse: ie });
50544   var ge = { ifd0: false, ifd1: false, exif: false, gps: false, interop: false, sanitize: false, reviveValues: true, translateKeys: false, translateValues: false, mergeOutput: false };
50545   var me = Object.assign({}, ge, { firstChunkSize: 4e4, gps: [1, 2, 3, 4] });
50546   async function Se(e3) {
50547     let t2 = new te(me);
50548     await t2.read(e3);
50549     let i3 = await t2.parse();
50550     if (i3 && i3.gps) {
50551       let { latitude: e4, longitude: t3 } = i3.gps;
50552       return { latitude: e4, longitude: t3 };
50553     }
50554   }
50555   var Ce = Object.assign({}, ge, { tiff: false, ifd1: true, mergeOutput: false });
50556   async function ye(e3) {
50557     let t2 = new te(Ce);
50558     await t2.read(e3);
50559     let i3 = await t2.extractThumbnail();
50560     return i3 && a ? s.from(i3) : i3;
50561   }
50562   async function be(e3) {
50563     let t2 = await this.thumbnail(e3);
50564     if (void 0 !== t2) {
50565       let e4 = new Blob([t2]);
50566       return URL.createObjectURL(e4);
50567     }
50568   }
50569   var Ie = Object.assign({}, ge, { firstChunkSize: 4e4, ifd0: [274] });
50570   async function Pe(e3) {
50571     let t2 = new te(Ie);
50572     await t2.read(e3);
50573     let i3 = await t2.parse();
50574     if (i3 && i3.ifd0)
50575       return i3.ifd0[274];
50576   }
50577   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 } });
50578   var we = true;
50579   var Te = true;
50580   if ("object" == typeof navigator) {
50581     let e3 = navigator.userAgent;
50582     if (e3.includes("iPad") || e3.includes("iPhone")) {
50583       let t2 = e3.match(/OS (\d+)_(\d+)/);
50584       if (t2) {
50585         let [, e4, i3] = t2, n3 = Number(e4) + 0.1 * Number(i3);
50586         we = n3 < 13.4, Te = false;
50587       }
50588     } else if (e3.includes("OS X 10")) {
50589       let [, t2] = e3.match(/OS X 10[_.](\d+)/);
50590       we = Te = Number(t2) < 15;
50591     }
50592     if (e3.includes("Chrome/")) {
50593       let [, t2] = e3.match(/Chrome\/(\d+)/);
50594       we = Te = Number(t2) < 81;
50595     } else if (e3.includes("Firefox/")) {
50596       let [, t2] = e3.match(/Firefox\/(\d+)/);
50597       we = Te = Number(t2) < 77;
50598     }
50599   }
50600   async function Ae(e3) {
50601     let t2 = await Pe(e3);
50602     return Object.assign({ canvas: we, css: Te }, ke[t2]);
50603   }
50604   var De = class extends I {
50605     constructor(...e3) {
50606       super(...e3), c(this, "ranges", new Oe()), 0 !== this.byteLength && this.ranges.add(0, this.byteLength);
50607     }
50608     _tryExtend(e3, t2, i3) {
50609       if (0 === e3 && 0 === this.byteLength && i3) {
50610         let e4 = new DataView(i3.buffer || i3, i3.byteOffset, i3.byteLength);
50611         this._swapDataView(e4);
50612       } else {
50613         let i4 = e3 + t2;
50614         if (i4 > this.byteLength) {
50615           let { dataView: e4 } = this._extend(i4);
50616           this._swapDataView(e4);
50617         }
50618       }
50619     }
50620     _extend(e3) {
50621       let t2;
50622       t2 = a ? s.allocUnsafe(e3) : new Uint8Array(e3);
50623       let i3 = new DataView(t2.buffer, t2.byteOffset, t2.byteLength);
50624       return t2.set(new Uint8Array(this.buffer, this.byteOffset, this.byteLength), 0), { uintView: t2, dataView: i3 };
50625     }
50626     subarray(e3, t2, i3 = false) {
50627       return t2 = t2 || this._lengthToEnd(e3), i3 && this._tryExtend(e3, t2), this.ranges.add(e3, t2), super.subarray(e3, t2);
50628     }
50629     set(e3, t2, i3 = false) {
50630       i3 && this._tryExtend(t2, e3.byteLength, e3);
50631       let n3 = super.set(e3, t2);
50632       return this.ranges.add(t2, n3.byteLength), n3;
50633     }
50634     async ensureChunk(e3, t2) {
50635       this.chunked && (this.ranges.available(e3, t2) || await this.readChunk(e3, t2));
50636     }
50637     available(e3, t2) {
50638       return this.ranges.available(e3, t2);
50639     }
50640   };
50641   var Oe = class {
50642     constructor() {
50643       c(this, "list", []);
50644     }
50645     get length() {
50646       return this.list.length;
50647     }
50648     add(e3, t2, i3 = 0) {
50649       let n3 = e3 + t2, s2 = this.list.filter((t3) => xe(e3, t3.offset, n3) || xe(e3, t3.end, n3));
50650       if (s2.length > 0) {
50651         e3 = Math.min(e3, ...s2.map((e4) => e4.offset)), n3 = Math.max(n3, ...s2.map((e4) => e4.end)), t2 = n3 - e3;
50652         let i4 = s2.shift();
50653         i4.offset = e3, i4.length = t2, i4.end = n3, this.list = this.list.filter((e4) => !s2.includes(e4));
50654       } else
50655         this.list.push({ offset: e3, length: t2, end: n3 });
50656     }
50657     available(e3, t2) {
50658       let i3 = e3 + t2;
50659       return this.list.some((t3) => t3.offset <= e3 && i3 <= t3.end);
50660     }
50661   };
50662   function xe(e3, t2, i3) {
50663     return e3 <= t2 && t2 <= i3;
50664   }
50665   var ve = class extends De {
50666     constructor(e3, t2) {
50667       super(0), c(this, "chunksRead", 0), this.input = e3, this.options = t2;
50668     }
50669     async readWhole() {
50670       this.chunked = false, await this.readChunk(this.nextChunkOffset);
50671     }
50672     async readChunked() {
50673       this.chunked = true, await this.readChunk(0, this.options.firstChunkSize);
50674     }
50675     async readNextChunk(e3 = this.nextChunkOffset) {
50676       if (this.fullyRead)
50677         return this.chunksRead++, false;
50678       let t2 = this.options.chunkSize, i3 = await this.readChunk(e3, t2);
50679       return !!i3 && i3.byteLength === t2;
50680     }
50681     async readChunk(e3, t2) {
50682       if (this.chunksRead++, 0 !== (t2 = this.safeWrapAddress(e3, t2)))
50683         return this._readChunk(e3, t2);
50684     }
50685     safeWrapAddress(e3, t2) {
50686       return void 0 !== this.size && e3 + t2 > this.size ? Math.max(0, this.size - e3) : t2;
50687     }
50688     get nextChunkOffset() {
50689       if (0 !== this.ranges.list.length)
50690         return this.ranges.list[0].length;
50691     }
50692     get canReadNextChunk() {
50693       return this.chunksRead < this.options.chunkLimit;
50694     }
50695     get fullyRead() {
50696       return void 0 !== this.size && this.nextChunkOffset === this.size;
50697     }
50698     read() {
50699       return this.options.chunked ? this.readChunked() : this.readWhole();
50700     }
50701     close() {
50702     }
50703   };
50704   A.set("blob", class extends ve {
50705     async readWhole() {
50706       this.chunked = false;
50707       let e3 = await R(this.input);
50708       this._swapArrayBuffer(e3);
50709     }
50710     readChunked() {
50711       return this.chunked = true, this.size = this.input.size, super.readChunked();
50712     }
50713     async _readChunk(e3, t2) {
50714       let i3 = t2 ? e3 + t2 : void 0, n3 = this.input.slice(e3, i3), s2 = await R(n3);
50715       return this.set(s2, e3, true);
50716     }
50717   });
50718   var Me = Object.freeze({ __proto__: null, default: pe, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j2, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q, parse: ie, gpsOnlyOptions: me, gps: Se, thumbnailOnlyOptions: Ce, thumbnail: ye, thumbnailUrl: be, orientationOnlyOptions: Ie, orientation: Pe, rotations: ke, get rotateCanvas() {
50719     return we;
50720   }, get rotateCss() {
50721     return Te;
50722   }, rotation: Ae });
50723   A.set("url", class extends ve {
50724     async readWhole() {
50725       this.chunked = false;
50726       let e3 = await M(this.input);
50727       e3 instanceof ArrayBuffer ? this._swapArrayBuffer(e3) : e3 instanceof Uint8Array && this._swapBuffer(e3);
50728     }
50729     async _readChunk(e3, t2) {
50730       let i3 = t2 ? e3 + t2 - 1 : void 0, n3 = this.options.httpHeaders || {};
50731       (e3 || i3) && (n3.range = "bytes=".concat([e3, i3].join("-")));
50732       let s2 = await h(this.input, { headers: n3 }), r2 = await s2.arrayBuffer(), a2 = r2.byteLength;
50733       if (416 !== s2.status)
50734         return a2 !== t2 && (this.size = e3 + a2), this.set(r2, e3, true);
50735     }
50736   });
50737   I.prototype.getUint64 = function(e3) {
50738     let t2 = this.getUint32(e3), i3 = this.getUint32(e3 + 4);
50739     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.");
50740   };
50741   var Re = class extends se {
50742     parseBoxes(e3 = 0) {
50743       let t2 = [];
50744       for (; e3 < this.file.byteLength - 4; ) {
50745         let i3 = this.parseBoxHead(e3);
50746         if (t2.push(i3), 0 === i3.length)
50747           break;
50748         e3 += i3.length;
50749       }
50750       return t2;
50751     }
50752     parseSubBoxes(e3) {
50753       e3.boxes = this.parseBoxes(e3.start);
50754     }
50755     findBox(e3, t2) {
50756       return void 0 === e3.boxes && this.parseSubBoxes(e3), e3.boxes.find((e4) => e4.kind === t2);
50757     }
50758     parseBoxHead(e3) {
50759       let t2 = this.file.getUint32(e3), i3 = this.file.getString(e3 + 4, 4), n3 = e3 + 8;
50760       return 1 === t2 && (t2 = this.file.getUint64(e3 + 8), n3 += 8), { offset: e3, length: t2, kind: i3, start: n3 };
50761     }
50762     parseBoxFullHead(e3) {
50763       if (void 0 !== e3.version)
50764         return;
50765       let t2 = this.file.getUint32(e3.start);
50766       e3.version = t2 >> 24, e3.start += 4;
50767     }
50768   };
50769   var Le = class extends Re {
50770     static canHandle(e3, t2) {
50771       if (0 !== t2)
50772         return false;
50773       let i3 = e3.getUint16(2);
50774       if (i3 > 50)
50775         return false;
50776       let n3 = 16, s2 = [];
50777       for (; n3 < i3; )
50778         s2.push(e3.getString(n3, 4)), n3 += 4;
50779       return s2.includes(this.type);
50780     }
50781     async parse() {
50782       let e3 = this.file.getUint32(0), t2 = this.parseBoxHead(e3);
50783       for (; "meta" !== t2.kind; )
50784         e3 += t2.length, await this.file.ensureChunk(e3, 16), t2 = this.parseBoxHead(e3);
50785       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);
50786     }
50787     async registerSegment(e3, t2, i3) {
50788       await this.file.ensureChunk(t2, i3);
50789       let n3 = this.file.subarray(t2, i3);
50790       this.createParser(e3, n3);
50791     }
50792     async findIcc(e3) {
50793       let t2 = this.findBox(e3, "iprp");
50794       if (void 0 === t2)
50795         return;
50796       let i3 = this.findBox(t2, "ipco");
50797       if (void 0 === i3)
50798         return;
50799       let n3 = this.findBox(i3, "colr");
50800       void 0 !== n3 && await this.registerSegment("icc", n3.offset + 12, n3.length);
50801     }
50802     async findExif(e3) {
50803       let t2 = this.findBox(e3, "iinf");
50804       if (void 0 === t2)
50805         return;
50806       let i3 = this.findBox(e3, "iloc");
50807       if (void 0 === i3)
50808         return;
50809       let n3 = this.findExifLocIdInIinf(t2), s2 = this.findExtentInIloc(i3, n3);
50810       if (void 0 === s2)
50811         return;
50812       let [r2, a2] = s2;
50813       await this.file.ensureChunk(r2, a2);
50814       let o2 = 4 + this.file.getUint32(r2);
50815       r2 += o2, a2 -= o2, await this.registerSegment("tiff", r2, a2);
50816     }
50817     findExifLocIdInIinf(e3) {
50818       this.parseBoxFullHead(e3);
50819       let t2, i3, n3, s2, r2 = e3.start, a2 = this.file.getUint16(r2);
50820       for (r2 += 2; a2--; ) {
50821         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))
50822           return this.file.getUintBytes(i3, n3);
50823         r2 += t2.length;
50824       }
50825     }
50826     get8bits(e3) {
50827       let t2 = this.file.getUint8(e3);
50828       return [t2 >> 4, 15 & t2];
50829     }
50830     findExtentInIloc(e3, t2) {
50831       this.parseBoxFullHead(e3);
50832       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);
50833       for (i3 += u2; c2--; ) {
50834         let e4 = this.file.getUintBytes(i3, o2);
50835         i3 += o2 + l2 + 2 + r2;
50836         let u3 = this.file.getUint16(i3);
50837         if (i3 += 2, e4 === t2)
50838           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)];
50839         i3 += u3 * h2;
50840       }
50841     }
50842   };
50843   var Ue = class extends Le {
50844   };
50845   c(Ue, "type", "heic");
50846   var Fe = class extends Le {
50847   };
50848   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" }]]);
50849   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" }]]);
50850   var Be = { 1: "No absolute unit of measurement", 2: "Inch", 3: "Centimeter" };
50851   Ee.set(37392, Be), Ee.set(41488, Be);
50852   var Ne = { 0: "Normal", 1: "Low", 2: "High" };
50853   function Ge(e3) {
50854     return "object" == typeof e3 && void 0 !== e3.length ? e3[0] : e3;
50855   }
50856   function Ve(e3) {
50857     let t2 = Array.from(e3).slice(1);
50858     return t2[1] > 15 && (t2 = t2.map((e4) => String.fromCharCode(e4))), "0" !== t2[2] && 0 !== t2[2] || t2.pop(), t2.join(".");
50859   }
50860   function ze(e3) {
50861     if ("string" == typeof e3) {
50862       var [t2, i3, n3, s2, r2, a2] = e3.trim().split(/[-: ]/g).map(Number), o2 = new Date(t2, i3 - 1, n3);
50863       return Number.isNaN(s2) || Number.isNaN(r2) || Number.isNaN(a2) || (o2.setHours(s2), o2.setMinutes(r2), o2.setSeconds(a2)), Number.isNaN(+o2) ? e3 : o2;
50864     }
50865   }
50866   function He(e3) {
50867     if ("string" == typeof e3)
50868       return e3;
50869     let t2 = [];
50870     if (0 === e3[1] && 0 === e3[e3.length - 1])
50871       for (let i3 = 0; i3 < e3.length; i3 += 2)
50872         t2.push(je(e3[i3 + 1], e3[i3]));
50873     else
50874       for (let i3 = 0; i3 < e3.length; i3 += 2)
50875         t2.push(je(e3[i3], e3[i3 + 1]));
50876     return m(String.fromCodePoint(...t2));
50877   }
50878   function je(e3, t2) {
50879     return e3 << 8 | t2;
50880   }
50881   Ee.set(41992, Ne), Ee.set(41993, Ne), Ee.set(41994, Ne), U(N, ["ifd0", "ifd1"], [[50827, function(e3) {
50882     return "string" != typeof e3 ? b(e3) : e3;
50883   }], [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(":")]]);
50884   var We = class extends re2 {
50885     static canHandle(e3, t2) {
50886       return 225 === e3.getUint8(t2 + 1) && 1752462448 === e3.getUint32(t2 + 4) && "http://ns.adobe.com/" === e3.getString(t2 + 4, "http://ns.adobe.com/".length);
50887     }
50888     static headerLength(e3, t2) {
50889       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;
50890     }
50891     static findPosition(e3, t2) {
50892       let i3 = super.findPosition(e3, t2);
50893       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;
50894     }
50895     static handleMultiSegments(e3) {
50896       return e3.map((e4) => e4.chunk.getString()).join("");
50897     }
50898     normalizeInput(e3) {
50899       return "string" == typeof e3 ? e3 : I.from(e3).getString();
50900     }
50901     parse(e3 = this.chunk) {
50902       if (!this.localOptions.parse)
50903         return e3;
50904       e3 = function(e4) {
50905         let t3 = {}, i4 = {};
50906         for (let e6 of Ze)
50907           t3[e6] = [], i4[e6] = 0;
50908         return e4.replace(et, (e6, n4, s2) => {
50909           if ("<" === n4) {
50910             let n5 = ++i4[s2];
50911             return t3[s2].push(n5), "".concat(e6, "#").concat(n5);
50912           }
50913           return "".concat(e6, "#").concat(t3[s2].pop());
50914         });
50915       }(e3);
50916       let t2 = Xe.findAll(e3, "rdf", "Description");
50917       0 === t2.length && t2.push(new Xe("rdf", "Description", void 0, e3));
50918       let i3, n3 = {};
50919       for (let e4 of t2)
50920         for (let t3 of e4.properties)
50921           i3 = Je(t3.ns, n3), _e(t3, i3);
50922       return function(e4) {
50923         let t3;
50924         for (let i4 in e4)
50925           t3 = e4[i4] = f2(e4[i4]), void 0 === t3 && delete e4[i4];
50926         return f2(e4);
50927       }(n3);
50928     }
50929     assignToOutput(e3, t2) {
50930       if (this.localOptions.parse)
50931         for (let [i3, n3] of Object.entries(t2))
50932           switch (i3) {
50933             case "tiff":
50934               this.assignObjectToOutput(e3, "ifd0", n3);
50935               break;
50936             case "exif":
50937               this.assignObjectToOutput(e3, "exif", n3);
50938               break;
50939             case "xmlns":
50940               break;
50941             default:
50942               this.assignObjectToOutput(e3, i3, n3);
50943           }
50944       else
50945         e3.xmp = t2;
50946     }
50947   };
50948   c(We, "type", "xmp"), c(We, "multiSegment", true), T.set("xmp", We);
50949   var Ke = class _Ke {
50950     static findAll(e3) {
50951       return qe(e3, /([a-zA-Z0-9-]+):([a-zA-Z0-9-]+)=("[^"]*"|'[^']*')/gm).map(_Ke.unpackMatch);
50952     }
50953     static unpackMatch(e3) {
50954       let t2 = e3[1], i3 = e3[2], n3 = e3[3].slice(1, -1);
50955       return n3 = Qe(n3), new _Ke(t2, i3, n3);
50956     }
50957     constructor(e3, t2, i3) {
50958       this.ns = e3, this.name = t2, this.value = i3;
50959     }
50960     serialize() {
50961       return this.value;
50962     }
50963   };
50964   var Xe = class _Xe {
50965     static findAll(e3, t2, i3) {
50966       if (void 0 !== t2 || void 0 !== i3) {
50967         t2 = t2 || "[\\w\\d-]+", i3 = i3 || "[\\w\\d-]+";
50968         var n3 = new RegExp("<(".concat(t2, "):(").concat(i3, ")(#\\d+)?((\\s+?[\\w\\d-:]+=(\"[^\"]*\"|'[^']*'))*\\s*)(\\/>|>([\\s\\S]*?)<\\/\\1:\\2\\3>)"), "gm");
50969       } else
50970         n3 = /<([\w\d-]+):([\w\d-]+)(#\d+)?((\s+?[\w\d-:]+=("[^"]*"|'[^']*'))*\s*)(\/>|>([\s\S]*?)<\/\1:\2\3>)/gm;
50971       return qe(e3, n3).map(_Xe.unpackMatch);
50972     }
50973     static unpackMatch(e3) {
50974       let t2 = e3[1], i3 = e3[2], n3 = e3[4], s2 = e3[8];
50975       return new _Xe(t2, i3, n3, s2);
50976     }
50977     constructor(e3, t2, i3, n3) {
50978       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];
50979     }
50980     get isPrimitive() {
50981       return void 0 !== this.value && 0 === this.attrs.length && 0 === this.children.length;
50982     }
50983     get isListContainer() {
50984       return 1 === this.children.length && this.children[0].isList;
50985     }
50986     get isList() {
50987       let { ns: e3, name: t2 } = this;
50988       return "rdf" === e3 && ("Seq" === t2 || "Bag" === t2 || "Alt" === t2);
50989     }
50990     get isListItem() {
50991       return "rdf" === this.ns && "li" === this.name;
50992     }
50993     serialize() {
50994       if (0 === this.properties.length && void 0 === this.value)
50995         return;
50996       if (this.isPrimitive)
50997         return this.value;
50998       if (this.isListContainer)
50999         return this.children[0].serialize();
51000       if (this.isList)
51001         return $e(this.children.map(Ye));
51002       if (this.isListItem && 1 === this.children.length && 0 === this.attrs.length)
51003         return this.children[0].serialize();
51004       let e3 = {};
51005       for (let t2 of this.properties)
51006         _e(t2, e3);
51007       return void 0 !== this.value && (e3.value = this.value), f2(e3);
51008     }
51009   };
51010   function _e(e3, t2) {
51011     let i3 = e3.serialize();
51012     void 0 !== i3 && (t2[e3.name] = i3);
51013   }
51014   var Ye = (e3) => e3.serialize();
51015   var $e = (e3) => 1 === e3.length ? e3[0] : e3;
51016   var Je = (e3, t2) => t2[e3] ? t2[e3] : t2[e3] = {};
51017   function qe(e3, t2) {
51018     let i3, n3 = [];
51019     if (!e3)
51020       return n3;
51021     for (; null !== (i3 = t2.exec(e3)); )
51022       n3.push(i3);
51023     return n3;
51024   }
51025   function Qe(e3) {
51026     if (function(e4) {
51027       return null == e4 || "null" === e4 || "undefined" === e4 || "" === e4 || "" === e4.trim();
51028     }(e3))
51029       return;
51030     let t2 = Number(e3);
51031     if (!Number.isNaN(t2))
51032       return t2;
51033     let i3 = e3.toLowerCase();
51034     return "true" === i3 || "false" !== i3 && e3.trim();
51035   }
51036   var Ze = ["rdf:li", "rdf:Seq", "rdf:Bag", "rdf:Alt", "rdf:Description"];
51037   var et = new RegExp("(<|\\/)(".concat(Ze.join("|"), ")"), "g");
51038   var tt = Object.freeze({ __proto__: null, default: Me, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j2, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q, parse: ie, gpsOnlyOptions: me, gps: Se, thumbnailOnlyOptions: Ce, thumbnail: ye, thumbnailUrl: be, orientationOnlyOptions: Ie, orientation: Pe, rotations: ke, get rotateCanvas() {
51039     return we;
51040   }, get rotateCss() {
51041     return Te;
51042   }, rotation: Ae });
51043   var at = l("fs", (e3) => e3.promises);
51044   A.set("fs", class extends ve {
51045     async readWhole() {
51046       this.chunked = false, this.fs = await at;
51047       let e3 = await this.fs.readFile(this.input);
51048       this._swapBuffer(e3);
51049     }
51050     async readChunked() {
51051       this.chunked = true, this.fs = await at, await this.open(), await this.readChunk(0, this.options.firstChunkSize);
51052     }
51053     async open() {
51054       void 0 === this.fh && (this.fh = await this.fs.open(this.input, "r"), this.size = (await this.fh.stat(this.input)).size);
51055     }
51056     async _readChunk(e3, t2) {
51057       void 0 === this.fh && await this.open(), e3 + t2 > this.size && (t2 = this.size - e3);
51058       var i3 = this.subarray(e3, t2, true);
51059       return await this.fh.read(i3.dataView, 0, t2, e3), i3;
51060     }
51061     async close() {
51062       if (this.fh) {
51063         let e3 = this.fh;
51064         this.fh = void 0, await e3.close();
51065       }
51066     }
51067   });
51068   A.set("base64", class extends ve {
51069     constructor(...e3) {
51070       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);
51071     }
51072     async _readChunk(e3, t2) {
51073       let i3, n3, r2 = this.input;
51074       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);
51075       let o2 = e3 + t2, l2 = i3 + 4 * Math.ceil(o2 / 3);
51076       r2 = r2.slice(i3, l2);
51077       let h2 = Math.min(t2, this.size - e3);
51078       if (a) {
51079         let t3 = s.from(r2, "base64").slice(n3, n3 + h2);
51080         return this.set(t3, e3, true);
51081       }
51082       {
51083         let t3 = this.subarray(e3, h2, true), i4 = atob(r2), s2 = t3.toUint8();
51084         for (let e4 = 0; e4 < h2; e4++)
51085           s2[e4] = i4.charCodeAt(n3 + e4);
51086         return t3;
51087       }
51088     }
51089   });
51090   var ot = class extends se {
51091     static canHandle(e3, t2) {
51092       return 18761 === t2 || 19789 === t2;
51093     }
51094     extendOptions(e3) {
51095       let { ifd0: t2, xmp: i3, iptc: n3, icc: s2 } = e3;
51096       i3.enabled && t2.deps.add(700), n3.enabled && t2.deps.add(33723), s2.enabled && t2.deps.add(34675), t2.finalizeFilters();
51097     }
51098     async parse() {
51099       let { tiff: e3, xmp: t2, iptc: i3, icc: n3 } = this.options;
51100       if (e3.enabled || t2.enabled || i3.enabled || n3.enabled) {
51101         let e4 = Math.max(S(this.options), this.options.chunkSize);
51102         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");
51103       }
51104     }
51105     adaptTiffPropAsSegment(e3) {
51106       if (this.parsers.tiff[e3]) {
51107         let t2 = this.parsers.tiff[e3];
51108         this.injectSegment(e3, t2);
51109       }
51110     }
51111   };
51112   c(ot, "type", "tiff"), w.set("tiff", ot);
51113   var lt = l("zlib");
51114   var ht = ["ihdr", "iccp", "text", "itxt", "exif"];
51115   var ut = class extends se {
51116     constructor(...e3) {
51117       super(...e3), c(this, "catchError", (e4) => this.errors.push(e4)), c(this, "metaChunks", []), c(this, "unknownChunks", []);
51118     }
51119     static canHandle(e3, t2) {
51120       return 35152 === t2 && 2303741511 === e3.getUint32(0) && 218765834 === e3.getUint32(4);
51121     }
51122     async parse() {
51123       let { file: e3 } = this;
51124       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);
51125     }
51126     async findPngChunksInRange(e3, t2) {
51127       let { file: i3 } = this;
51128       for (; e3 < t2; ) {
51129         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 };
51130         ht.includes(s2) ? this.metaChunks.push(a2) : this.unknownChunks.push(a2), e3 += r2;
51131       }
51132     }
51133     parseTextChunks() {
51134       let e3 = this.metaChunks.filter((e4) => "text" === e4.type);
51135       for (let t2 of e3) {
51136         let [e4, i3] = this.file.getString(t2.start, t2.size).split("\0");
51137         this.injectKeyValToIhdr(e4, i3);
51138       }
51139     }
51140     injectKeyValToIhdr(e3, t2) {
51141       let i3 = this.parsers.ihdr;
51142       i3 && i3.raw.set(e3, t2);
51143     }
51144     findIhdr() {
51145       let e3 = this.metaChunks.find((e4) => "ihdr" === e4.type);
51146       e3 && false !== this.options.ihdr.enabled && this.createParser("ihdr", e3.chunk);
51147     }
51148     async findExif() {
51149       let e3 = this.metaChunks.find((e4) => "exif" === e4.type);
51150       e3 && this.injectSegment("tiff", e3.chunk);
51151     }
51152     async findXmp() {
51153       let e3 = this.metaChunks.filter((e4) => "itxt" === e4.type);
51154       for (let t2 of e3) {
51155         "XML:com.adobe.xmp" === t2.chunk.getString(0, "XML:com.adobe.xmp".length) && this.injectSegment("xmp", t2.chunk);
51156       }
51157     }
51158     async findIcc() {
51159       let e3 = this.metaChunks.find((e4) => "iccp" === e4.type);
51160       if (!e3)
51161         return;
51162       let { chunk: t2 } = e3, i3 = t2.getUint8Array(0, 81), s2 = 0;
51163       for (; s2 < 80 && 0 !== i3[s2]; )
51164         s2++;
51165       let r2 = s2 + 2, a2 = t2.getString(0, s2);
51166       if (this.injectKeyValToIhdr("ProfileName", a2), n2) {
51167         let e4 = await lt, i4 = t2.getUint8Array(r2);
51168         i4 = e4.inflateSync(i4), this.injectSegment("icc", i4);
51169       }
51170     }
51171   };
51172   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"]]);
51173   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"]];
51174   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" }]]);
51175   var ft = class extends re2 {
51176     static canHandle(e3, t2) {
51177       return 224 === e3.getUint8(t2 + 1) && 1246120262 === e3.getUint32(t2 + 4) && 0 === e3.getUint8(t2 + 8);
51178     }
51179     parse() {
51180       return this.parseTags(), this.translate(), this.output;
51181     }
51182     parseTags() {
51183       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)]]);
51184     }
51185   };
51186   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"]]);
51187   var dt = class extends re2 {
51188     parse() {
51189       return this.parseTags(), this.translate(), this.output;
51190     }
51191     parseTags() {
51192       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)]);
51193     }
51194   };
51195   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" }]]);
51196   var pt = class extends re2 {
51197     static canHandle(e3, t2) {
51198       return 226 === e3.getUint8(t2 + 1) && 1229144927 === e3.getUint32(t2 + 4);
51199     }
51200     static findPosition(e3, t2) {
51201       let i3 = super.findPosition(e3, t2);
51202       return i3.chunkNumber = e3.getUint8(t2 + 16), i3.chunkCount = e3.getUint8(t2 + 17), i3.multiSegment = i3.chunkCount > 1, i3;
51203     }
51204     static handleMultiSegments(e3) {
51205       return function(e4) {
51206         let t2 = function(e6) {
51207           let t3 = e6[0].constructor, i3 = 0;
51208           for (let t4 of e6)
51209             i3 += t4.length;
51210           let n3 = new t3(i3), s2 = 0;
51211           for (let t4 of e6)
51212             n3.set(t4, s2), s2 += t4.length;
51213           return n3;
51214         }(e4.map((e6) => e6.chunk.toUint8()));
51215         return new I(t2);
51216       }(e3);
51217     }
51218     parse() {
51219       return this.raw = /* @__PURE__ */ new Map(), this.parseHeader(), this.parseTags(), this.translate(), this.output;
51220     }
51221     parseHeader() {
51222       let { raw: e3 } = this;
51223       this.chunk.byteLength < 84 && g2("ICC header is too short");
51224       for (let [t2, i3] of Object.entries(gt)) {
51225         t2 = parseInt(t2, 10);
51226         let n3 = i3(this.chunk, t2);
51227         "\0\0\0\0" !== n3 && e3.set(t2, n3);
51228       }
51229     }
51230     parseTags() {
51231       let e3, t2, i3, n3, s2, { raw: r2 } = this, a2 = this.chunk.getUint32(128), o2 = 132, l2 = this.chunk.byteLength;
51232       for (; a2--; ) {
51233         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)
51234           return void console.warn("reached the end of the first ICC chunk. Enable options.tiff.multiSegment to read all ICC segments.");
51235         s2 = this.parseTag(n3, t2, i3), void 0 !== s2 && "\0\0\0\0" !== s2 && r2.set(e3, s2), o2 += 12;
51236       }
51237     }
51238     parseTag(e3, t2, i3) {
51239       switch (e3) {
51240         case "desc":
51241           return this.parseDesc(t2);
51242         case "mluc":
51243           return this.parseMluc(t2);
51244         case "text":
51245           return this.parseText(t2, i3);
51246         case "sig ":
51247           return this.parseSig(t2);
51248       }
51249       if (!(t2 + i3 > this.chunk.byteLength))
51250         return this.chunk.getUint8Array(t2, i3);
51251     }
51252     parseDesc(e3) {
51253       let t2 = this.chunk.getUint32(e3 + 8) - 1;
51254       return m(this.chunk.getString(e3 + 12, t2));
51255     }
51256     parseText(e3, t2) {
51257       return m(this.chunk.getString(e3 + 8, t2 - 8));
51258     }
51259     parseSig(e3) {
51260       return m(this.chunk.getString(e3 + 8, 4));
51261     }
51262     parseMluc(e3) {
51263       let { chunk: t2 } = this, i3 = t2.getUint32(e3 + 8), n3 = t2.getUint32(e3 + 12), s2 = e3 + 16, r2 = [];
51264       for (let a2 = 0; a2 < i3; a2++) {
51265         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));
51266         r2.push({ lang: i4, country: a3, text: h2 }), s2 += n3;
51267       }
51268       return 1 === i3 ? r2[0].text : r2;
51269     }
51270     translateValue(e3, t2) {
51271       return "string" == typeof e3 ? t2[e3] || t2[e3.toLowerCase()] || e3 : t2[e3] || e3;
51272     }
51273   };
51274   c(pt, "type", "icc"), c(pt, "multiSegment", true), c(pt, "headerLength", 18);
51275   var gt = { 4: mt, 8: function(e3, t2) {
51276     return [e3.getUint8(t2), e3.getUint8(t2 + 1) >> 4, e3.getUint8(t2 + 1) % 16].map((e4) => e4.toString(10)).join(".");
51277   }, 12: mt, 16: mt, 20: mt, 24: function(e3, t2) {
51278     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);
51279     return new Date(Date.UTC(i3, n3, s2, r2, a2, o2));
51280   }, 36: mt, 40: mt, 48: mt, 52: mt, 64: (e3, t2) => e3.getUint32(t2), 80: mt };
51281   function mt(e3, t2) {
51282     return m(e3.getString(t2, 4));
51283   }
51284   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"]]);
51285   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" };
51286   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!)" };
51287   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" }]]);
51288   var yt = class extends re2 {
51289     static canHandle(e3, t2, i3) {
51290       return 237 === e3.getUint8(t2 + 1) && "Photoshop" === e3.getString(t2 + 4, 9) && void 0 !== this.containsIptc8bim(e3, t2, i3);
51291     }
51292     static headerLength(e3, t2, i3) {
51293       let n3, s2 = this.containsIptc8bim(e3, t2, i3);
51294       if (void 0 !== s2)
51295         return n3 = e3.getUint8(t2 + s2 + 7), n3 % 2 != 0 && (n3 += 1), 0 === n3 && (n3 = 4), s2 + 8 + n3;
51296     }
51297     static containsIptc8bim(e3, t2, i3) {
51298       for (let n3 = 0; n3 < i3; n3++)
51299         if (this.isIptcSegmentHead(e3, t2 + n3))
51300           return n3;
51301     }
51302     static isIptcSegmentHead(e3, t2) {
51303       return 56 === e3.getUint8(t2) && 943868237 === e3.getUint32(t2) && 1028 === e3.getUint16(t2 + 4);
51304     }
51305     parse() {
51306       let { raw: e3 } = this, t2 = this.chunk.byteLength - 1, i3 = false;
51307       for (let n3 = 0; n3 < t2; n3++)
51308         if (28 === this.chunk.getUint8(n3) && 2 === this.chunk.getUint8(n3 + 1)) {
51309           i3 = true;
51310           let t3 = this.chunk.getUint16(n3 + 3), s2 = this.chunk.getUint8(n3 + 2), r2 = this.chunk.getLatin1String(n3 + 5, t3);
51311           e3.set(s2, this.pluralizeValue(e3.get(s2), r2)), n3 += 4 + t3;
51312         } else if (i3)
51313           break;
51314       return this.translate(), this.output;
51315     }
51316     pluralizeValue(e3, t2) {
51317       return void 0 !== e3 ? e3 instanceof Array ? (e3.push(t2), e3) : [e3, t2] : t2;
51318     }
51319   };
51320   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" }]]);
51321   var full_esm_default = tt;
51322
51323   // modules/services/plane_photo.js
51324   var dispatch6 = dispatch_default("viewerChanged");
51325   var _photo;
51326   var _wrapper;
51327   var imgZoom;
51328   var _widthOverflow;
51329   function zoomPan(d3_event) {
51330     let t2 = d3_event.transform;
51331     _photo.call(utilSetTransform, t2.x, t2.y, t2.k);
51332   }
51333   function zoomBeahvior() {
51334     const { width: wrapperWidth, height: wrapperHeight } = _wrapper.node().getBoundingClientRect();
51335     const { naturalHeight, naturalWidth } = _photo.node();
51336     const intrinsicRatio = naturalWidth / naturalHeight;
51337     _widthOverflow = wrapperHeight * intrinsicRatio - wrapperWidth;
51338     return zoom_default2().extent([[0, 0], [wrapperWidth, wrapperHeight]]).translateExtent([[0, 0], [wrapperWidth + _widthOverflow, wrapperHeight]]).scaleExtent([1, 15]).on("zoom", zoomPan);
51339   }
51340   function loadImage(selection2, path) {
51341     return new Promise((resolve) => {
51342       selection2.attr("src", path);
51343       selection2.on("load", () => {
51344         resolve(selection2);
51345       });
51346     });
51347   }
51348   var plane_photo_default = {
51349     init: async function(context, selection2) {
51350       this.event = utilRebind(this, dispatch6, "on");
51351       _wrapper = selection2.append("div").attr("class", "photo-frame plane-frame").classed("hide", true);
51352       _photo = _wrapper.append("img").attr("class", "plane-photo");
51353       context.ui().photoviewer.on("resize.plane", () => {
51354         imgZoom = zoomBeahvior();
51355         _wrapper.call(imgZoom);
51356       });
51357       await Promise.resolve();
51358       return this;
51359     },
51360     showPhotoFrame: function(context) {
51361       const isHidden = context.selectAll(".photo-frame.plane-frame.hide").size();
51362       if (isHidden) {
51363         context.selectAll(".photo-frame:not(.plane-frame)").classed("hide", true);
51364         context.selectAll(".photo-frame.plane-frame").classed("hide", false);
51365       }
51366       return this;
51367     },
51368     hidePhotoFrame: function(context) {
51369       context.select("photo-frame.plane-frame").classed("hide", false);
51370       return this;
51371     },
51372     selectPhoto: function(data, keepOrientation) {
51373       dispatch6.call("viewerChanged");
51374       loadImage(_photo, "");
51375       loadImage(_photo, data.image_path).then(() => {
51376         if (!keepOrientation) {
51377           imgZoom = zoomBeahvior();
51378           _wrapper.call(imgZoom);
51379           _wrapper.call(imgZoom.transform, identity2.translate(-_widthOverflow / 2, 0));
51380         }
51381       });
51382       return this;
51383     },
51384     getYaw: function() {
51385       return 0;
51386     }
51387   };
51388
51389   // modules/svg/local_photos.js
51390   var _initialized2 = false;
51391   var _enabled2 = false;
51392   var minViewfieldZoom = 16;
51393   function svgLocalPhotos(projection2, context, dispatch14) {
51394     const detected = utilDetect();
51395     let layer = select_default2(null);
51396     let _fileList;
51397     let _photos = [];
51398     let _idAutoinc = 0;
51399     let _photoFrame;
51400     function init2() {
51401       if (_initialized2)
51402         return;
51403       _enabled2 = true;
51404       function over(d3_event) {
51405         d3_event.stopPropagation();
51406         d3_event.preventDefault();
51407         d3_event.dataTransfer.dropEffect = "copy";
51408       }
51409       context.container().attr("dropzone", "copy").on("drop.svgLocalPhotos", function(d3_event) {
51410         d3_event.stopPropagation();
51411         d3_event.preventDefault();
51412         if (!detected.filedrop)
51413           return;
51414         drawPhotos.fileList(d3_event.dataTransfer.files, (loaded) => {
51415           if (loaded.length > 0) {
51416             drawPhotos.fitZoom(false);
51417           }
51418         });
51419       }).on("dragenter.svgLocalPhotos", over).on("dragexit.svgLocalPhotos", over).on("dragover.svgLocalPhotos", over);
51420       _initialized2 = true;
51421     }
51422     function ensureViewerLoaded(context2) {
51423       if (_photoFrame) {
51424         return Promise.resolve(_photoFrame);
51425       }
51426       const viewer = context2.container().select(".photoviewer").selectAll(".local-photos-wrapper").data([0]);
51427       const viewerEnter = viewer.enter().append("div").attr("class", "photo-wrapper local-photos-wrapper").classed("hide", true);
51428       viewerEnter.append("div").attr("class", "photo-attribution fillD");
51429       return plane_photo_default.init(context2, viewerEnter).then((planePhotoFrame) => {
51430         _photoFrame = planePhotoFrame;
51431       });
51432     }
51433     function click(d3_event, image, zoomTo) {
51434       ensureViewerLoaded(context).then(() => {
51435         const viewer = context.container().select(".photoviewer").datum(image).classed("hide", false);
51436         const viewerWrap = viewer.select(".local-photos-wrapper").classed("hide", false);
51437         const attribution = viewerWrap.selectAll(".photo-attribution").text("");
51438         if (image.name) {
51439           attribution.append("span").classed("filename", true).text(image.name);
51440         }
51441         _photoFrame.selectPhoto({ image_path: "" });
51442         image.getSrc().then((src) => {
51443           _photoFrame.selectPhoto({ image_path: src }).showPhotoFrame(viewerWrap);
51444           setStyles();
51445         });
51446       });
51447       if (zoomTo) {
51448         context.map().centerEase(image.loc);
51449       }
51450     }
51451     function transform2(d2) {
51452       var svgpoint = projection2(d2.loc);
51453       return "translate(" + svgpoint[0] + "," + svgpoint[1] + ")";
51454     }
51455     function setStyles(hovered) {
51456       const viewer = context.container().select(".photoviewer");
51457       const selected = viewer.empty() ? void 0 : viewer.datum();
51458       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));
51459     }
51460     function display_markers(imageList) {
51461       imageList = imageList.filter((image) => isArray_default(image.loc) && isNumber_default(image.loc[0]) && isNumber_default(image.loc[1]));
51462       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(imageList, function(d2) {
51463         return d2.id;
51464       });
51465       groups.exit().remove();
51466       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", (d3_event, d2) => setStyles(d2)).on("mouseleave", () => setStyles(null)).on("click", click);
51467       groupsEnter.append("g").attr("class", "viewfield-scale");
51468       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
51469       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
51470       const showViewfields = context.map().zoom() >= minViewfieldZoom;
51471       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
51472       viewfields.exit().remove();
51473       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", function() {
51474         var _a;
51475         const d2 = this.parentNode.__data__;
51476         return "rotate(".concat(Math.round((_a = d2.direction) != null ? _a : 0), ",0,0),scale(1.5,1.5),translate(-8,-13)");
51477       }).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() {
51478         const d2 = this.parentNode.__data__;
51479         return isNumber_default(d2.direction) ? "visible" : "hidden";
51480       });
51481     }
51482     function drawPhotos(selection2) {
51483       layer = selection2.selectAll(".layer-local-photos").data(_photos ? [0] : []);
51484       layer.exit().remove();
51485       const layerEnter = layer.enter().append("g").attr("class", "layer-local-photos");
51486       layerEnter.append("g").attr("class", "markers");
51487       layer = layerEnter.merge(layer);
51488       if (_photos && _photos.length !== 0) {
51489         display_markers(_photos);
51490       }
51491     }
51492     function readFileAsDataURL(file) {
51493       return new Promise((resolve, reject) => {
51494         const reader = new FileReader();
51495         reader.onload = () => resolve(reader.result);
51496         reader.onerror = (error) => reject(error);
51497         reader.readAsDataURL(file);
51498       });
51499     }
51500     async function readmultifiles(files, callback) {
51501       const loaded = [];
51502       for (const file of files) {
51503         try {
51504           const exifData = await full_esm_default.parse(file);
51505           const photo = {
51506             id: _idAutoinc++,
51507             name: file.name,
51508             getSrc: () => readFileAsDataURL(file),
51509             file,
51510             loc: [exifData.longitude, exifData.latitude],
51511             direction: exifData.GPSImgDirection
51512           };
51513           loaded.push(photo);
51514           const sameName = _photos.filter((i3) => i3.name === photo.name);
51515           if (sameName.length === 0) {
51516             _photos.push(photo);
51517           } else {
51518             const thisContent = await photo.getSrc();
51519             const sameNameContent = await Promise.allSettled(sameName.map((i3) => i3.getSrc()));
51520             if (!sameNameContent.some((i3) => i3.value === thisContent)) {
51521               _photos.push(photo);
51522             }
51523           }
51524         } catch (err) {
51525         }
51526       }
51527       if (typeof callback === "function")
51528         callback(loaded);
51529       dispatch14.call("change");
51530     }
51531     drawPhotos.setFiles = function(fileList, callback) {
51532       readmultifiles(Array.from(fileList), callback);
51533       return this;
51534     };
51535     drawPhotos.fileList = function(fileList, callback) {
51536       if (!arguments.length)
51537         return _fileList;
51538       _fileList = fileList;
51539       if (!fileList || !fileList.length)
51540         return this;
51541       drawPhotos.setFiles(_fileList, callback);
51542       return this;
51543     };
51544     drawPhotos.getPhotos = function() {
51545       return _photos;
51546     };
51547     drawPhotos.removePhoto = function(id2) {
51548       _photos = _photos.filter((i3) => i3.id !== id2);
51549       dispatch14.call("change");
51550       return _photos;
51551     };
51552     drawPhotos.openPhoto = click;
51553     drawPhotos.fitZoom = function(force) {
51554       const coords = _photos.map((image) => image.loc).filter((l2) => isArray_default(l2) && isNumber_default(l2[0]) && isNumber_default(l2[1]));
51555       if (coords.length === 0)
51556         return;
51557       const extent = coords.map((l2) => geoExtent(l2, l2)).reduce((a2, b2) => a2.extend(b2));
51558       const map2 = context.map();
51559       var viewport = map2.trimmedExtent().polygon();
51560       if (force !== false || !geoPolygonIntersectsPolygon(viewport, coords, true)) {
51561         map2.centerZoom(extent.center(), Math.min(18, map2.trimmedExtentZoom(extent)));
51562       }
51563     };
51564     function showLayer() {
51565       layer.style("display", "block");
51566       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
51567         dispatch14.call("change");
51568       });
51569     }
51570     function hideLayer() {
51571       layer.transition().duration(250).style("opacity", 0).on("end", () => {
51572         layer.selectAll(".viewfield-group").remove();
51573         layer.style("display", "none");
51574       });
51575     }
51576     drawPhotos.enabled = function(val) {
51577       if (!arguments.length)
51578         return _enabled2;
51579       _enabled2 = val;
51580       if (_enabled2) {
51581         showLayer();
51582       } else {
51583         hideLayer();
51584       }
51585       dispatch14.call("change");
51586       return this;
51587     };
51588     drawPhotos.hasData = function() {
51589       return isArray_default(_photos) && _photos.length > 0;
51590     };
51591     init2();
51592     return drawPhotos;
51593   }
51594
51595   // modules/svg/improveOSM.js
51596   var _layerEnabled2 = false;
51597   var _qaService2;
51598   function svgImproveOSM(projection2, context, dispatch14) {
51599     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
51600     const minZoom4 = 12;
51601     let touchLayer = select_default2(null);
51602     let drawLayer = select_default2(null);
51603     let layerVisible = false;
51604     function markerPath(selection2, klass) {
51605       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");
51606     }
51607     function getService() {
51608       if (services.improveOSM && !_qaService2) {
51609         _qaService2 = services.improveOSM;
51610         _qaService2.on("loaded", throttledRedraw);
51611       } else if (!services.improveOSM && _qaService2) {
51612         _qaService2 = null;
51613       }
51614       return _qaService2;
51615     }
51616     function editOn() {
51617       if (!layerVisible) {
51618         layerVisible = true;
51619         drawLayer.style("display", "block");
51620       }
51621     }
51622     function editOff() {
51623       if (layerVisible) {
51624         layerVisible = false;
51625         drawLayer.style("display", "none");
51626         drawLayer.selectAll(".qaItem.improveOSM").remove();
51627         touchLayer.selectAll(".qaItem.improveOSM").remove();
51628       }
51629     }
51630     function layerOn() {
51631       editOn();
51632       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
51633     }
51634     function layerOff() {
51635       throttledRedraw.cancel();
51636       drawLayer.interrupt();
51637       touchLayer.selectAll(".qaItem.improveOSM").remove();
51638       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
51639         editOff();
51640         dispatch14.call("change");
51641       });
51642     }
51643     function updateMarkers() {
51644       if (!layerVisible || !_layerEnabled2)
51645         return;
51646       const service = getService();
51647       const selectedID = context.selectedErrorID();
51648       const data = service ? service.getItems(projection2) : [];
51649       const getTransform = svgPointTransform(projection2);
51650       const markers = drawLayer.selectAll(".qaItem.improveOSM").data(data, (d2) => d2.id);
51651       markers.exit().remove();
51652       const markersEnter = markers.enter().append("g").attr("class", (d2) => "qaItem ".concat(d2.service, " itemId-").concat(d2.id, " itemType-").concat(d2.itemType));
51653       markersEnter.append("polygon").call(markerPath, "shadow");
51654       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
51655       markersEnter.append("polygon").attr("fill", "currentColor").call(markerPath, "qaItem-fill");
51656       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 : "");
51657       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
51658       if (touchLayer.empty())
51659         return;
51660       const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
51661       const targets = touchLayer.selectAll(".qaItem.improveOSM").data(data, (d2) => d2.id);
51662       targets.exit().remove();
51663       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);
51664       function sortY(a2, b2) {
51665         return a2.id === selectedID ? 1 : b2.id === selectedID ? -1 : b2.loc[1] - a2.loc[1];
51666       }
51667     }
51668     function drawImproveOSM(selection2) {
51669       const service = getService();
51670       const surface = context.surface();
51671       if (surface && !surface.empty()) {
51672         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
51673       }
51674       drawLayer = selection2.selectAll(".layer-improveOSM").data(service ? [0] : []);
51675       drawLayer.exit().remove();
51676       drawLayer = drawLayer.enter().append("g").attr("class", "layer-improveOSM").style("display", _layerEnabled2 ? "block" : "none").merge(drawLayer);
51677       if (_layerEnabled2) {
51678         if (service && ~~context.map().zoom() >= minZoom4) {
51679           editOn();
51680           service.loadIssues(projection2);
51681           updateMarkers();
51682         } else {
51683           editOff();
51684         }
51685       }
51686     }
51687     drawImproveOSM.enabled = function(val) {
51688       if (!arguments.length)
51689         return _layerEnabled2;
51690       _layerEnabled2 = val;
51691       if (_layerEnabled2) {
51692         layerOn();
51693       } else {
51694         layerOff();
51695         if (context.selectedErrorID()) {
51696           context.enter(modeBrowse(context));
51697         }
51698       }
51699       dispatch14.call("change");
51700       return this;
51701     };
51702     drawImproveOSM.supported = () => !!getService();
51703     return drawImproveOSM;
51704   }
51705
51706   // modules/svg/osmose.js
51707   var _layerEnabled3 = false;
51708   var _qaService3;
51709   function svgOsmose(projection2, context, dispatch14) {
51710     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
51711     const minZoom4 = 12;
51712     let touchLayer = select_default2(null);
51713     let drawLayer = select_default2(null);
51714     let layerVisible = false;
51715     function markerPath(selection2, klass) {
51716       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");
51717     }
51718     function getService() {
51719       if (services.osmose && !_qaService3) {
51720         _qaService3 = services.osmose;
51721         _qaService3.on("loaded", throttledRedraw);
51722       } else if (!services.osmose && _qaService3) {
51723         _qaService3 = null;
51724       }
51725       return _qaService3;
51726     }
51727     function editOn() {
51728       if (!layerVisible) {
51729         layerVisible = true;
51730         drawLayer.style("display", "block");
51731       }
51732     }
51733     function editOff() {
51734       if (layerVisible) {
51735         layerVisible = false;
51736         drawLayer.style("display", "none");
51737         drawLayer.selectAll(".qaItem.osmose").remove();
51738         touchLayer.selectAll(".qaItem.osmose").remove();
51739       }
51740     }
51741     function layerOn() {
51742       editOn();
51743       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
51744     }
51745     function layerOff() {
51746       throttledRedraw.cancel();
51747       drawLayer.interrupt();
51748       touchLayer.selectAll(".qaItem.osmose").remove();
51749       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
51750         editOff();
51751         dispatch14.call("change");
51752       });
51753     }
51754     function updateMarkers() {
51755       if (!layerVisible || !_layerEnabled3)
51756         return;
51757       const service = getService();
51758       const selectedID = context.selectedErrorID();
51759       const data = service ? service.getItems(projection2) : [];
51760       const getTransform = svgPointTransform(projection2);
51761       const markers = drawLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
51762       markers.exit().remove();
51763       const markersEnter = markers.enter().append("g").attr("class", (d2) => "qaItem ".concat(d2.service, " itemId-").concat(d2.id, " itemType-").concat(d2.itemType));
51764       markersEnter.append("polygon").call(markerPath, "shadow");
51765       markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
51766       markersEnter.append("polygon").attr("fill", (d2) => service.getColor(d2.item)).call(markerPath, "qaItem-fill");
51767       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 : "");
51768       markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
51769       if (touchLayer.empty())
51770         return;
51771       const fillClass = context.getDebug("target") ? "pink" : "nocolor";
51772       const targets = touchLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
51773       targets.exit().remove();
51774       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);
51775       function sortY(a2, b2) {
51776         return a2.id === selectedID ? 1 : b2.id === selectedID ? -1 : b2.loc[1] - a2.loc[1];
51777       }
51778     }
51779     function drawOsmose(selection2) {
51780       const service = getService();
51781       const surface = context.surface();
51782       if (surface && !surface.empty()) {
51783         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
51784       }
51785       drawLayer = selection2.selectAll(".layer-osmose").data(service ? [0] : []);
51786       drawLayer.exit().remove();
51787       drawLayer = drawLayer.enter().append("g").attr("class", "layer-osmose").style("display", _layerEnabled3 ? "block" : "none").merge(drawLayer);
51788       if (_layerEnabled3) {
51789         if (service && ~~context.map().zoom() >= minZoom4) {
51790           editOn();
51791           service.loadIssues(projection2);
51792           updateMarkers();
51793         } else {
51794           editOff();
51795         }
51796       }
51797     }
51798     drawOsmose.enabled = function(val) {
51799       if (!arguments.length)
51800         return _layerEnabled3;
51801       _layerEnabled3 = val;
51802       if (_layerEnabled3) {
51803         getService().loadStrings().then(layerOn).catch((err) => {
51804           console.log(err);
51805         });
51806       } else {
51807         layerOff();
51808         if (context.selectedErrorID()) {
51809           context.enter(modeBrowse(context));
51810         }
51811       }
51812       dispatch14.call("change");
51813       return this;
51814     };
51815     drawOsmose.supported = () => !!getService();
51816     return drawOsmose;
51817   }
51818
51819   // modules/svg/streetside.js
51820   function svgStreetside(projection2, context, dispatch14) {
51821     var throttledRedraw = throttle_default(function() {
51822       dispatch14.call("change");
51823     }, 1e3);
51824     var minZoom4 = 14;
51825     var minMarkerZoom = 16;
51826     var minViewfieldZoom2 = 18;
51827     var layer = select_default2(null);
51828     var _viewerYaw = 0;
51829     var _selectedSequence = null;
51830     var _streetside;
51831     function init2() {
51832       if (svgStreetside.initialized)
51833         return;
51834       svgStreetside.enabled = false;
51835       svgStreetside.initialized = true;
51836     }
51837     function getService() {
51838       if (services.streetside && !_streetside) {
51839         _streetside = services.streetside;
51840         _streetside.event.on("viewerChanged.svgStreetside", viewerChanged).on("loadedImages.svgStreetside", throttledRedraw);
51841       } else if (!services.streetside && _streetside) {
51842         _streetside = null;
51843       }
51844       return _streetside;
51845     }
51846     function showLayer() {
51847       var service = getService();
51848       if (!service)
51849         return;
51850       editOn();
51851       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
51852         dispatch14.call("change");
51853       });
51854     }
51855     function hideLayer() {
51856       throttledRedraw.cancel();
51857       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
51858     }
51859     function editOn() {
51860       layer.style("display", "block");
51861     }
51862     function editOff() {
51863       layer.selectAll(".viewfield-group").remove();
51864       layer.style("display", "none");
51865     }
51866     function click(d3_event, d2) {
51867       var service = getService();
51868       if (!service)
51869         return;
51870       if (d2.sequenceKey !== _selectedSequence) {
51871         _viewerYaw = 0;
51872       }
51873       _selectedSequence = d2.sequenceKey;
51874       service.ensureViewerLoaded(context).then(function() {
51875         service.selectImage(context, d2.key).yaw(_viewerYaw).showViewer(context);
51876       });
51877       context.map().centerEase(d2.loc);
51878     }
51879     function mouseover(d3_event, d2) {
51880       var service = getService();
51881       if (service)
51882         service.setStyles(context, d2);
51883     }
51884     function mouseout() {
51885       var service = getService();
51886       if (service)
51887         service.setStyles(context, null);
51888     }
51889     function transform2(d2) {
51890       var t2 = svgPointTransform(projection2)(d2);
51891       var rot = d2.ca + _viewerYaw;
51892       if (rot) {
51893         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
51894       }
51895       return t2;
51896     }
51897     function viewerChanged() {
51898       var service = getService();
51899       if (!service)
51900         return;
51901       var viewer = service.viewer();
51902       if (!viewer)
51903         return;
51904       _viewerYaw = viewer.getYaw();
51905       if (context.map().isTransformed())
51906         return;
51907       layer.selectAll(".viewfield-group.currentView").attr("transform", transform2);
51908     }
51909     function filterBubbles(bubbles) {
51910       var fromDate = context.photos().fromDate();
51911       var toDate = context.photos().toDate();
51912       var usernames = context.photos().usernames();
51913       if (fromDate) {
51914         var fromTimestamp = new Date(fromDate).getTime();
51915         bubbles = bubbles.filter(function(bubble) {
51916           return new Date(bubble.captured_at).getTime() >= fromTimestamp;
51917         });
51918       }
51919       if (toDate) {
51920         var toTimestamp = new Date(toDate).getTime();
51921         bubbles = bubbles.filter(function(bubble) {
51922           return new Date(bubble.captured_at).getTime() <= toTimestamp;
51923         });
51924       }
51925       if (usernames) {
51926         bubbles = bubbles.filter(function(bubble) {
51927           return usernames.indexOf(bubble.captured_by) !== -1;
51928         });
51929       }
51930       return bubbles;
51931     }
51932     function filterSequences(sequences) {
51933       var fromDate = context.photos().fromDate();
51934       var toDate = context.photos().toDate();
51935       var usernames = context.photos().usernames();
51936       if (fromDate) {
51937         var fromTimestamp = new Date(fromDate).getTime();
51938         sequences = sequences.filter(function(sequences2) {
51939           return new Date(sequences2.properties.captured_at).getTime() >= fromTimestamp;
51940         });
51941       }
51942       if (toDate) {
51943         var toTimestamp = new Date(toDate).getTime();
51944         sequences = sequences.filter(function(sequences2) {
51945           return new Date(sequences2.properties.captured_at).getTime() <= toTimestamp;
51946         });
51947       }
51948       if (usernames) {
51949         sequences = sequences.filter(function(sequences2) {
51950           return usernames.indexOf(sequences2.properties.captured_by) !== -1;
51951         });
51952       }
51953       return sequences;
51954     }
51955     function update() {
51956       var viewer = context.container().select(".photoviewer");
51957       var selected = viewer.empty() ? void 0 : viewer.datum();
51958       var z2 = ~~context.map().zoom();
51959       var showMarkers = z2 >= minMarkerZoom;
51960       var showViewfields = z2 >= minViewfieldZoom2;
51961       var service = getService();
51962       var sequences = [];
51963       var bubbles = [];
51964       if (context.photos().showsPanoramic()) {
51965         sequences = service ? service.sequences(projection2) : [];
51966         bubbles = service && showMarkers ? service.bubbles(projection2) : [];
51967         sequences = filterSequences(sequences);
51968         bubbles = filterBubbles(bubbles);
51969       }
51970       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
51971         return d2.properties.key;
51972       });
51973       traces.exit().remove();
51974       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
51975       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(bubbles, function(d2) {
51976         return d2.key + (d2.sequenceKey ? "v1" : "v0");
51977       });
51978       groups.exit().remove();
51979       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
51980       groupsEnter.append("g").attr("class", "viewfield-scale");
51981       var markers = groups.merge(groupsEnter).sort(function(a2, b2) {
51982         return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
51983       }).attr("transform", transform2).select(".viewfield-scale");
51984       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
51985       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
51986       viewfields.exit().remove();
51987       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
51988       function viewfieldPath() {
51989         var d2 = this.parentNode.__data__;
51990         if (d2.pano) {
51991           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
51992         } else {
51993           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
51994         }
51995       }
51996     }
51997     function drawImages(selection2) {
51998       var enabled = svgStreetside.enabled;
51999       var service = getService();
52000       layer = selection2.selectAll(".layer-streetside-images").data(service ? [0] : []);
52001       layer.exit().remove();
52002       var layerEnter = layer.enter().append("g").attr("class", "layer-streetside-images").style("display", enabled ? "block" : "none");
52003       layerEnter.append("g").attr("class", "sequences");
52004       layerEnter.append("g").attr("class", "markers");
52005       layer = layerEnter.merge(layer);
52006       if (enabled) {
52007         if (service && ~~context.map().zoom() >= minZoom4) {
52008           editOn();
52009           update();
52010           service.loadBubbles(projection2);
52011         } else {
52012           editOff();
52013         }
52014       }
52015     }
52016     drawImages.enabled = function(_2) {
52017       if (!arguments.length)
52018         return svgStreetside.enabled;
52019       svgStreetside.enabled = _2;
52020       if (svgStreetside.enabled) {
52021         showLayer();
52022         context.photos().on("change.streetside", update);
52023       } else {
52024         hideLayer();
52025         context.photos().on("change.streetside", null);
52026       }
52027       dispatch14.call("change");
52028       return this;
52029     };
52030     drawImages.supported = function() {
52031       return !!getService();
52032     };
52033     drawImages.rendered = function(zoom) {
52034       return zoom >= minZoom4;
52035     };
52036     init2();
52037     return drawImages;
52038   }
52039
52040   // modules/svg/vegbilder.js
52041   function svgVegbilder(projection2, context, dispatch14) {
52042     const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
52043     const minZoom4 = 14;
52044     const minMarkerZoom = 16;
52045     const minViewfieldZoom2 = 18;
52046     let layer = select_default2(null);
52047     let _viewerYaw = 0;
52048     let _vegbilder;
52049     function init2() {
52050       if (svgVegbilder.initialized)
52051         return;
52052       svgVegbilder.enabled = false;
52053       svgVegbilder.initialized = true;
52054     }
52055     function getService() {
52056       if (services.vegbilder && !_vegbilder) {
52057         _vegbilder = services.vegbilder;
52058         _vegbilder.event.on("viewerChanged.svgVegbilder", viewerChanged).on("loadedImages.svgVegbilder", throttledRedraw);
52059       } else if (!services.vegbilder && _vegbilder) {
52060         _vegbilder = null;
52061       }
52062       return _vegbilder;
52063     }
52064     function showLayer() {
52065       const service = getService();
52066       if (!service)
52067         return;
52068       editOn();
52069       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", () => dispatch14.call("change"));
52070     }
52071     function hideLayer() {
52072       throttledRedraw.cancel();
52073       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
52074     }
52075     function editOn() {
52076       layer.style("display", "block");
52077     }
52078     function editOff() {
52079       layer.selectAll(".viewfield-group").remove();
52080       layer.style("display", "none");
52081     }
52082     function click(d3_event, d2) {
52083       const service = getService();
52084       if (!service)
52085         return;
52086       service.ensureViewerLoaded(context).then(() => {
52087         service.selectImage(context, d2.key).showViewer(context);
52088       });
52089       context.map().centerEase(d2.loc);
52090     }
52091     function mouseover(d3_event, d2) {
52092       const service = getService();
52093       if (service)
52094         service.setStyles(context, d2);
52095     }
52096     function mouseout() {
52097       const service = getService();
52098       if (service)
52099         service.setStyles(context, null);
52100     }
52101     function transform2(d2, selected) {
52102       let t2 = svgPointTransform(projection2)(d2);
52103       let rot = d2.ca;
52104       if (d2 === selected) {
52105         rot += _viewerYaw;
52106       }
52107       if (rot) {
52108         t2 += " rotate(" + Math.floor(rot) + ",0,0)";
52109       }
52110       return t2;
52111     }
52112     function viewerChanged() {
52113       const service = getService();
52114       if (!service)
52115         return;
52116       const frame2 = service.photoFrame();
52117       _viewerYaw = frame2.getYaw();
52118       if (context.map().isTransformed())
52119         return;
52120       layer.selectAll(".viewfield-group.currentView").attr("transform", (d2) => transform2(d2, d2));
52121     }
52122     function filterImages(images) {
52123       const photoContext = context.photos();
52124       const fromDateString = photoContext.fromDate();
52125       const toDateString = photoContext.toDate();
52126       const showsFlat = photoContext.showsFlat();
52127       const showsPano = photoContext.showsPanoramic();
52128       if (fromDateString) {
52129         const fromDate = new Date(fromDateString);
52130         images = images.filter((image) => image.captured_at.getTime() >= fromDate.getTime());
52131       }
52132       if (toDateString) {
52133         const toDate = new Date(toDateString);
52134         images = images.filter((image) => image.captured_at.getTime() <= toDate.getTime());
52135       }
52136       if (!showsPano) {
52137         images = images.filter((image) => !image.is_sphere);
52138       }
52139       if (!showsFlat) {
52140         images = images.filter((image) => image.is_sphere);
52141       }
52142       return images;
52143     }
52144     function filterSequences(sequences) {
52145       const photoContext = context.photos();
52146       const fromDateString = photoContext.fromDate();
52147       const toDateString = photoContext.toDate();
52148       const showsFlat = photoContext.showsFlat();
52149       const showsPano = photoContext.showsPanoramic();
52150       if (fromDateString) {
52151         const fromDate = new Date(fromDateString);
52152         sequences = sequences.filter(({ images }) => images[0].captured_at.getTime() >= fromDate.getTime());
52153       }
52154       if (toDateString) {
52155         const toDate = new Date(toDateString);
52156         sequences = sequences.filter(({ images }) => images[images.length - 1].captured_at.getTime() <= toDate.getTime());
52157       }
52158       if (!showsPano) {
52159         sequences = sequences.filter(({ images }) => !images[0].is_sphere);
52160       }
52161       if (!showsFlat) {
52162         sequences = sequences.filter(({ images }) => images[0].is_sphere);
52163       }
52164       return sequences;
52165     }
52166     function update() {
52167       const viewer = context.container().select(".photoviewer");
52168       const selected = viewer.empty() ? void 0 : viewer.datum();
52169       const z2 = ~~context.map().zoom();
52170       const showMarkers = z2 >= minMarkerZoom;
52171       const showViewfields = z2 >= minViewfieldZoom2;
52172       const service = getService();
52173       let sequences = [];
52174       let images = [];
52175       if (service) {
52176         service.loadImages(context);
52177         sequences = service.sequences(projection2);
52178         images = showMarkers ? service.images(projection2) : [];
52179         images = filterImages(images);
52180         sequences = filterSequences(sequences);
52181       }
52182       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, (d2) => d2.key);
52183       traces.exit().remove();
52184       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
52185       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, (d2) => d2.key);
52186       groups.exit().remove();
52187       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
52188       groupsEnter.append("g").attr("class", "viewfield-scale");
52189       const markers = groups.merge(groupsEnter).sort((a2, b2) => {
52190         return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
52191       }).attr("transform", (d2) => transform2(d2, selected)).select(".viewfield-scale");
52192       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
52193       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
52194       viewfields.exit().remove();
52195       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
52196       function viewfieldPath() {
52197         const d2 = this.parentNode.__data__;
52198         if (d2.is_sphere) {
52199           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
52200         } else {
52201           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
52202         }
52203       }
52204     }
52205     function drawImages(selection2) {
52206       const enabled = svgVegbilder.enabled;
52207       const service = getService();
52208       layer = selection2.selectAll(".layer-vegbilder").data(service ? [0] : []);
52209       layer.exit().remove();
52210       const layerEnter = layer.enter().append("g").attr("class", "layer-vegbilder").style("display", enabled ? "block" : "none");
52211       layerEnter.append("g").attr("class", "sequences");
52212       layerEnter.append("g").attr("class", "markers");
52213       layer = layerEnter.merge(layer);
52214       if (enabled) {
52215         if (service && ~~context.map().zoom() >= minZoom4) {
52216           editOn();
52217           update();
52218           service.loadImages(context);
52219         } else {
52220           editOff();
52221         }
52222       }
52223     }
52224     drawImages.enabled = function(_2) {
52225       if (!arguments.length)
52226         return svgVegbilder.enabled;
52227       svgVegbilder.enabled = _2;
52228       if (svgVegbilder.enabled) {
52229         showLayer();
52230         context.photos().on("change.vegbilder", update);
52231       } else {
52232         hideLayer();
52233         context.photos().on("change.vegbilder", null);
52234       }
52235       dispatch14.call("change");
52236       return this;
52237     };
52238     drawImages.supported = function() {
52239       return !!getService();
52240     };
52241     drawImages.rendered = function(zoom) {
52242       return zoom >= minZoom4;
52243     };
52244     drawImages.validHere = function(extent, zoom) {
52245       return zoom >= minZoom4 - 2 && getService().validHere(extent);
52246     };
52247     init2();
52248     return drawImages;
52249   }
52250
52251   // modules/svg/mapillary_images.js
52252   function svgMapillaryImages(projection2, context, dispatch14) {
52253     const throttledRedraw = throttle_default(function() {
52254       dispatch14.call("change");
52255     }, 1e3);
52256     const minZoom4 = 12;
52257     const minMarkerZoom = 16;
52258     const minViewfieldZoom2 = 18;
52259     let layer = select_default2(null);
52260     let _mapillary;
52261     function init2() {
52262       if (svgMapillaryImages.initialized)
52263         return;
52264       svgMapillaryImages.enabled = false;
52265       svgMapillaryImages.initialized = true;
52266     }
52267     function getService() {
52268       if (services.mapillary && !_mapillary) {
52269         _mapillary = services.mapillary;
52270         _mapillary.event.on("loadedImages", throttledRedraw);
52271       } else if (!services.mapillary && _mapillary) {
52272         _mapillary = null;
52273       }
52274       return _mapillary;
52275     }
52276     function showLayer() {
52277       const service = getService();
52278       if (!service)
52279         return;
52280       editOn();
52281       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
52282         dispatch14.call("change");
52283       });
52284     }
52285     function hideLayer() {
52286       throttledRedraw.cancel();
52287       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
52288     }
52289     function editOn() {
52290       layer.style("display", "block");
52291     }
52292     function editOff() {
52293       layer.selectAll(".viewfield-group").remove();
52294       layer.style("display", "none");
52295     }
52296     function click(d3_event, image) {
52297       const service = getService();
52298       if (!service)
52299         return;
52300       service.ensureViewerLoaded(context).then(function() {
52301         service.selectImage(context, image.id).showViewer(context);
52302       });
52303       context.map().centerEase(image.loc);
52304     }
52305     function mouseover(d3_event, image) {
52306       const service = getService();
52307       if (service)
52308         service.setStyles(context, image);
52309     }
52310     function mouseout() {
52311       const service = getService();
52312       if (service)
52313         service.setStyles(context, null);
52314     }
52315     function transform2(d2) {
52316       let t2 = svgPointTransform(projection2)(d2);
52317       if (d2.ca) {
52318         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
52319       }
52320       return t2;
52321     }
52322     function filterImages(images) {
52323       const showsPano = context.photos().showsPanoramic();
52324       const showsFlat = context.photos().showsFlat();
52325       const fromDate = context.photos().fromDate();
52326       const toDate = context.photos().toDate();
52327       if (!showsPano || !showsFlat) {
52328         images = images.filter(function(image) {
52329           if (image.is_pano)
52330             return showsPano;
52331           return showsFlat;
52332         });
52333       }
52334       if (fromDate) {
52335         images = images.filter(function(image) {
52336           return new Date(image.captured_at).getTime() >= new Date(fromDate).getTime();
52337         });
52338       }
52339       if (toDate) {
52340         images = images.filter(function(image) {
52341           return new Date(image.captured_at).getTime() <= new Date(toDate).getTime();
52342         });
52343       }
52344       return images;
52345     }
52346     function filterSequences(sequences) {
52347       const showsPano = context.photos().showsPanoramic();
52348       const showsFlat = context.photos().showsFlat();
52349       const fromDate = context.photos().fromDate();
52350       const toDate = context.photos().toDate();
52351       if (!showsPano || !showsFlat) {
52352         sequences = sequences.filter(function(sequence) {
52353           if (sequence.properties.hasOwnProperty("is_pano")) {
52354             if (sequence.properties.is_pano)
52355               return showsPano;
52356             return showsFlat;
52357           }
52358           return false;
52359         });
52360       }
52361       if (fromDate) {
52362         sequences = sequences.filter(function(sequence) {
52363           return new Date(sequence.properties.captured_at).getTime() >= new Date(fromDate).getTime().toString();
52364         });
52365       }
52366       if (toDate) {
52367         sequences = sequences.filter(function(sequence) {
52368           return new Date(sequence.properties.captured_at).getTime() <= new Date(toDate).getTime().toString();
52369         });
52370       }
52371       return sequences;
52372     }
52373     function update() {
52374       const z2 = ~~context.map().zoom();
52375       const showMarkers = z2 >= minMarkerZoom;
52376       const showViewfields = z2 >= minViewfieldZoom2;
52377       const service = getService();
52378       let sequences = service ? service.sequences(projection2) : [];
52379       let images = service && showMarkers ? service.images(projection2) : [];
52380       images = filterImages(images);
52381       sequences = filterSequences(sequences, service);
52382       service.filterViewer(context);
52383       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
52384         return d2.properties.id;
52385       });
52386       traces.exit().remove();
52387       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
52388       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
52389         return d2.id;
52390       });
52391       groups.exit().remove();
52392       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
52393       groupsEnter.append("g").attr("class", "viewfield-scale");
52394       const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
52395         return b2.loc[1] - a2.loc[1];
52396       }).attr("transform", transform2).select(".viewfield-scale");
52397       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
52398       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
52399       viewfields.exit().remove();
52400       viewfields.enter().insert("path", "circle").attr("class", "viewfield").classed("pano", function() {
52401         return this.parentNode.__data__.is_pano;
52402       }).attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
52403       function viewfieldPath() {
52404         if (this.parentNode.__data__.is_pano) {
52405           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
52406         } else {
52407           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
52408         }
52409       }
52410     }
52411     function drawImages(selection2) {
52412       const enabled = svgMapillaryImages.enabled;
52413       const service = getService();
52414       layer = selection2.selectAll(".layer-mapillary").data(service ? [0] : []);
52415       layer.exit().remove();
52416       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary").style("display", enabled ? "block" : "none");
52417       layerEnter.append("g").attr("class", "sequences");
52418       layerEnter.append("g").attr("class", "markers");
52419       layer = layerEnter.merge(layer);
52420       if (enabled) {
52421         if (service && ~~context.map().zoom() >= minZoom4) {
52422           editOn();
52423           update();
52424           service.loadImages(projection2);
52425         } else {
52426           editOff();
52427         }
52428       }
52429     }
52430     drawImages.enabled = function(_2) {
52431       if (!arguments.length)
52432         return svgMapillaryImages.enabled;
52433       svgMapillaryImages.enabled = _2;
52434       if (svgMapillaryImages.enabled) {
52435         showLayer();
52436         context.photos().on("change.mapillary_images", update);
52437       } else {
52438         hideLayer();
52439         context.photos().on("change.mapillary_images", null);
52440       }
52441       dispatch14.call("change");
52442       return this;
52443     };
52444     drawImages.supported = function() {
52445       return !!getService();
52446     };
52447     drawImages.rendered = function(zoom) {
52448       return zoom >= minZoom4;
52449     };
52450     init2();
52451     return drawImages;
52452   }
52453
52454   // modules/svg/mapillary_position.js
52455   function svgMapillaryPosition(projection2, context) {
52456     const throttledRedraw = throttle_default(function() {
52457       update();
52458     }, 1e3);
52459     const minZoom4 = 12;
52460     const minViewfieldZoom2 = 18;
52461     let layer = select_default2(null);
52462     let _mapillary;
52463     let viewerCompassAngle;
52464     function init2() {
52465       if (svgMapillaryPosition.initialized)
52466         return;
52467       svgMapillaryPosition.initialized = true;
52468     }
52469     function getService() {
52470       if (services.mapillary && !_mapillary) {
52471         _mapillary = services.mapillary;
52472         _mapillary.event.on("imageChanged", throttledRedraw);
52473         _mapillary.event.on("bearingChanged", function(e3) {
52474           viewerCompassAngle = e3.bearing;
52475           if (context.map().isTransformed())
52476             return;
52477           layer.selectAll(".viewfield-group.currentView").filter(function(d2) {
52478             return d2.is_pano;
52479           }).attr("transform", transform2);
52480         });
52481       } else if (!services.mapillary && _mapillary) {
52482         _mapillary = null;
52483       }
52484       return _mapillary;
52485     }
52486     function editOn() {
52487       layer.style("display", "block");
52488     }
52489     function editOff() {
52490       layer.selectAll(".viewfield-group").remove();
52491       layer.style("display", "none");
52492     }
52493     function transform2(d2) {
52494       let t2 = svgPointTransform(projection2)(d2);
52495       if (d2.is_pano && viewerCompassAngle !== null && isFinite(viewerCompassAngle)) {
52496         t2 += " rotate(" + Math.floor(viewerCompassAngle) + ",0,0)";
52497       } else if (d2.ca) {
52498         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
52499       }
52500       return t2;
52501     }
52502     function update() {
52503       const z2 = ~~context.map().zoom();
52504       const showViewfields = z2 >= minViewfieldZoom2;
52505       const service = getService();
52506       const image = service && service.getActiveImage();
52507       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(image ? [image] : [], function(d2) {
52508         return d2.id;
52509       });
52510       groups.exit().remove();
52511       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group currentView highlighted");
52512       groupsEnter.append("g").attr("class", "viewfield-scale");
52513       const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
52514       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
52515       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
52516       viewfields.exit().remove();
52517       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");
52518     }
52519     function drawImages(selection2) {
52520       const service = getService();
52521       layer = selection2.selectAll(".layer-mapillary-position").data(service ? [0] : []);
52522       layer.exit().remove();
52523       const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary-position");
52524       layerEnter.append("g").attr("class", "markers");
52525       layer = layerEnter.merge(layer);
52526       if (service && ~~context.map().zoom() >= minZoom4) {
52527         editOn();
52528         update();
52529       } else {
52530         editOff();
52531       }
52532     }
52533     drawImages.enabled = function() {
52534       update();
52535       return this;
52536     };
52537     drawImages.supported = function() {
52538       return !!getService();
52539     };
52540     drawImages.rendered = function(zoom) {
52541       return zoom >= minZoom4;
52542     };
52543     init2();
52544     return drawImages;
52545   }
52546
52547   // modules/svg/mapillary_signs.js
52548   function svgMapillarySigns(projection2, context, dispatch14) {
52549     const throttledRedraw = throttle_default(function() {
52550       dispatch14.call("change");
52551     }, 1e3);
52552     const minZoom4 = 12;
52553     let layer = select_default2(null);
52554     let _mapillary;
52555     function init2() {
52556       if (svgMapillarySigns.initialized)
52557         return;
52558       svgMapillarySigns.enabled = false;
52559       svgMapillarySigns.initialized = true;
52560     }
52561     function getService() {
52562       if (services.mapillary && !_mapillary) {
52563         _mapillary = services.mapillary;
52564         _mapillary.event.on("loadedSigns", throttledRedraw);
52565       } else if (!services.mapillary && _mapillary) {
52566         _mapillary = null;
52567       }
52568       return _mapillary;
52569     }
52570     function showLayer() {
52571       const service = getService();
52572       if (!service)
52573         return;
52574       service.loadSignResources(context);
52575       editOn();
52576     }
52577     function hideLayer() {
52578       throttledRedraw.cancel();
52579       editOff();
52580     }
52581     function editOn() {
52582       layer.style("display", "block");
52583     }
52584     function editOff() {
52585       layer.selectAll(".icon-sign").remove();
52586       layer.style("display", "none");
52587     }
52588     function click(d3_event, d2) {
52589       const service = getService();
52590       if (!service)
52591         return;
52592       context.map().centerEase(d2.loc);
52593       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
52594       service.getDetections(d2.id).then((detections) => {
52595         if (detections.length) {
52596           const imageId = detections[0].image.id;
52597           if (imageId === selectedImageId) {
52598             service.highlightDetection(detections[0]).selectImage(context, imageId);
52599           } else {
52600             service.ensureViewerLoaded(context).then(function() {
52601               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
52602             });
52603           }
52604         }
52605       });
52606     }
52607     function filterData(detectedFeatures) {
52608       var fromDate = context.photos().fromDate();
52609       var toDate = context.photos().toDate();
52610       if (fromDate) {
52611         var fromTimestamp = new Date(fromDate).getTime();
52612         detectedFeatures = detectedFeatures.filter(function(feature3) {
52613           return new Date(feature3.last_seen_at).getTime() >= fromTimestamp;
52614         });
52615       }
52616       if (toDate) {
52617         var toTimestamp = new Date(toDate).getTime();
52618         detectedFeatures = detectedFeatures.filter(function(feature3) {
52619           return new Date(feature3.first_seen_at).getTime() <= toTimestamp;
52620         });
52621       }
52622       return detectedFeatures;
52623     }
52624     function update() {
52625       const service = getService();
52626       let data = service ? service.signs(projection2) : [];
52627       data = filterData(data);
52628       const transform2 = svgPointTransform(projection2);
52629       const signs = layer.selectAll(".icon-sign").data(data, function(d2) {
52630         return d2.id;
52631       });
52632       signs.exit().remove();
52633       const enter = signs.enter().append("g").attr("class", "icon-sign icon-detected").on("click", click);
52634       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
52635         return "#" + d2.value;
52636       });
52637       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
52638       signs.merge(enter).attr("transform", transform2);
52639     }
52640     function drawSigns(selection2) {
52641       const enabled = svgMapillarySigns.enabled;
52642       const service = getService();
52643       layer = selection2.selectAll(".layer-mapillary-signs").data(service ? [0] : []);
52644       layer.exit().remove();
52645       layer = layer.enter().append("g").attr("class", "layer-mapillary-signs layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
52646       if (enabled) {
52647         if (service && ~~context.map().zoom() >= minZoom4) {
52648           editOn();
52649           update();
52650           service.loadSigns(projection2);
52651           service.showSignDetections(true);
52652         } else {
52653           editOff();
52654         }
52655       } else if (service) {
52656         service.showSignDetections(false);
52657       }
52658     }
52659     drawSigns.enabled = function(_2) {
52660       if (!arguments.length)
52661         return svgMapillarySigns.enabled;
52662       svgMapillarySigns.enabled = _2;
52663       if (svgMapillarySigns.enabled) {
52664         showLayer();
52665         context.photos().on("change.mapillary_signs", update);
52666       } else {
52667         hideLayer();
52668         context.photos().on("change.mapillary_signs", null);
52669       }
52670       dispatch14.call("change");
52671       return this;
52672     };
52673     drawSigns.supported = function() {
52674       return !!getService();
52675     };
52676     drawSigns.rendered = function(zoom) {
52677       return zoom >= minZoom4;
52678     };
52679     init2();
52680     return drawSigns;
52681   }
52682
52683   // modules/svg/mapillary_map_features.js
52684   function svgMapillaryMapFeatures(projection2, context, dispatch14) {
52685     const throttledRedraw = throttle_default(function() {
52686       dispatch14.call("change");
52687     }, 1e3);
52688     const minZoom4 = 12;
52689     let layer = select_default2(null);
52690     let _mapillary;
52691     function init2() {
52692       if (svgMapillaryMapFeatures.initialized)
52693         return;
52694       svgMapillaryMapFeatures.enabled = false;
52695       svgMapillaryMapFeatures.initialized = true;
52696     }
52697     function getService() {
52698       if (services.mapillary && !_mapillary) {
52699         _mapillary = services.mapillary;
52700         _mapillary.event.on("loadedMapFeatures", throttledRedraw);
52701       } else if (!services.mapillary && _mapillary) {
52702         _mapillary = null;
52703       }
52704       return _mapillary;
52705     }
52706     function showLayer() {
52707       const service = getService();
52708       if (!service)
52709         return;
52710       service.loadObjectResources(context);
52711       editOn();
52712     }
52713     function hideLayer() {
52714       throttledRedraw.cancel();
52715       editOff();
52716     }
52717     function editOn() {
52718       layer.style("display", "block");
52719     }
52720     function editOff() {
52721       layer.selectAll(".icon-map-feature").remove();
52722       layer.style("display", "none");
52723     }
52724     function click(d3_event, d2) {
52725       const service = getService();
52726       if (!service)
52727         return;
52728       context.map().centerEase(d2.loc);
52729       const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
52730       service.getDetections(d2.id).then((detections) => {
52731         if (detections.length) {
52732           const imageId = detections[0].image.id;
52733           if (imageId === selectedImageId) {
52734             service.highlightDetection(detections[0]).selectImage(context, imageId);
52735           } else {
52736             service.ensureViewerLoaded(context).then(function() {
52737               service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
52738             });
52739           }
52740         }
52741       });
52742     }
52743     function filterData(detectedFeatures) {
52744       const fromDate = context.photos().fromDate();
52745       const toDate = context.photos().toDate();
52746       if (fromDate) {
52747         detectedFeatures = detectedFeatures.filter(function(feature3) {
52748           return new Date(feature3.last_seen_at).getTime() >= new Date(fromDate).getTime();
52749         });
52750       }
52751       if (toDate) {
52752         detectedFeatures = detectedFeatures.filter(function(feature3) {
52753           return new Date(feature3.first_seen_at).getTime() <= new Date(toDate).getTime();
52754         });
52755       }
52756       return detectedFeatures;
52757     }
52758     function update() {
52759       const service = getService();
52760       let data = service ? service.mapFeatures(projection2) : [];
52761       data = filterData(data);
52762       const transform2 = svgPointTransform(projection2);
52763       const mapFeatures = layer.selectAll(".icon-map-feature").data(data, function(d2) {
52764         return d2.id;
52765       });
52766       mapFeatures.exit().remove();
52767       const enter = mapFeatures.enter().append("g").attr("class", "icon-map-feature icon-detected").on("click", click);
52768       enter.append("title").text(function(d2) {
52769         var id2 = d2.value.replace(/--/g, ".").replace(/-/g, "_");
52770         return _t("mapillary_map_features." + id2);
52771       });
52772       enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
52773         if (d2.value === "object--billboard") {
52774           return "#object--sign--advertisement";
52775         }
52776         return "#" + d2.value;
52777       });
52778       enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
52779       mapFeatures.merge(enter).attr("transform", transform2);
52780     }
52781     function drawMapFeatures(selection2) {
52782       const enabled = svgMapillaryMapFeatures.enabled;
52783       const service = getService();
52784       layer = selection2.selectAll(".layer-mapillary-map-features").data(service ? [0] : []);
52785       layer.exit().remove();
52786       layer = layer.enter().append("g").attr("class", "layer-mapillary-map-features layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
52787       if (enabled) {
52788         if (service && ~~context.map().zoom() >= minZoom4) {
52789           editOn();
52790           update();
52791           service.loadMapFeatures(projection2);
52792           service.showFeatureDetections(true);
52793         } else {
52794           editOff();
52795         }
52796       } else if (service) {
52797         service.showFeatureDetections(false);
52798       }
52799     }
52800     drawMapFeatures.enabled = function(_2) {
52801       if (!arguments.length)
52802         return svgMapillaryMapFeatures.enabled;
52803       svgMapillaryMapFeatures.enabled = _2;
52804       if (svgMapillaryMapFeatures.enabled) {
52805         showLayer();
52806         context.photos().on("change.mapillary_map_features", update);
52807       } else {
52808         hideLayer();
52809         context.photos().on("change.mapillary_map_features", null);
52810       }
52811       dispatch14.call("change");
52812       return this;
52813     };
52814     drawMapFeatures.supported = function() {
52815       return !!getService();
52816     };
52817     drawMapFeatures.rendered = function(zoom) {
52818       return zoom >= minZoom4;
52819     };
52820     init2();
52821     return drawMapFeatures;
52822   }
52823
52824   // modules/svg/kartaview_images.js
52825   function svgKartaviewImages(projection2, context, dispatch14) {
52826     var throttledRedraw = throttle_default(function() {
52827       dispatch14.call("change");
52828     }, 1e3);
52829     var minZoom4 = 12;
52830     var minMarkerZoom = 16;
52831     var minViewfieldZoom2 = 18;
52832     var layer = select_default2(null);
52833     var _kartaview;
52834     function init2() {
52835       if (svgKartaviewImages.initialized)
52836         return;
52837       svgKartaviewImages.enabled = false;
52838       svgKartaviewImages.initialized = true;
52839     }
52840     function getService() {
52841       if (services.kartaview && !_kartaview) {
52842         _kartaview = services.kartaview;
52843         _kartaview.event.on("loadedImages", throttledRedraw);
52844       } else if (!services.kartaview && _kartaview) {
52845         _kartaview = null;
52846       }
52847       return _kartaview;
52848     }
52849     function showLayer() {
52850       var service = getService();
52851       if (!service)
52852         return;
52853       editOn();
52854       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
52855         dispatch14.call("change");
52856       });
52857     }
52858     function hideLayer() {
52859       throttledRedraw.cancel();
52860       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
52861     }
52862     function editOn() {
52863       layer.style("display", "block");
52864     }
52865     function editOff() {
52866       layer.selectAll(".viewfield-group").remove();
52867       layer.style("display", "none");
52868     }
52869     function click(d3_event, d2) {
52870       var service = getService();
52871       if (!service)
52872         return;
52873       service.ensureViewerLoaded(context).then(function() {
52874         service.selectImage(context, d2.key).showViewer(context);
52875       });
52876       context.map().centerEase(d2.loc);
52877     }
52878     function mouseover(d3_event, d2) {
52879       var service = getService();
52880       if (service)
52881         service.setStyles(context, d2);
52882     }
52883     function mouseout() {
52884       var service = getService();
52885       if (service)
52886         service.setStyles(context, null);
52887     }
52888     function transform2(d2) {
52889       var t2 = svgPointTransform(projection2)(d2);
52890       if (d2.ca) {
52891         t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
52892       }
52893       return t2;
52894     }
52895     function filterImages(images) {
52896       var fromDate = context.photos().fromDate();
52897       var toDate = context.photos().toDate();
52898       var usernames = context.photos().usernames();
52899       if (fromDate) {
52900         var fromTimestamp = new Date(fromDate).getTime();
52901         images = images.filter(function(item) {
52902           return new Date(item.captured_at).getTime() >= fromTimestamp;
52903         });
52904       }
52905       if (toDate) {
52906         var toTimestamp = new Date(toDate).getTime();
52907         images = images.filter(function(item) {
52908           return new Date(item.captured_at).getTime() <= toTimestamp;
52909         });
52910       }
52911       if (usernames) {
52912         images = images.filter(function(item) {
52913           return usernames.indexOf(item.captured_by) !== -1;
52914         });
52915       }
52916       return images;
52917     }
52918     function filterSequences(sequences) {
52919       var fromDate = context.photos().fromDate();
52920       var toDate = context.photos().toDate();
52921       var usernames = context.photos().usernames();
52922       if (fromDate) {
52923         var fromTimestamp = new Date(fromDate).getTime();
52924         sequences = sequences.filter(function(image) {
52925           return new Date(image.properties.captured_at).getTime() >= fromTimestamp;
52926         });
52927       }
52928       if (toDate) {
52929         var toTimestamp = new Date(toDate).getTime();
52930         sequences = sequences.filter(function(image) {
52931           return new Date(image.properties.captured_at).getTime() <= toTimestamp;
52932         });
52933       }
52934       if (usernames) {
52935         sequences = sequences.filter(function(image) {
52936           return usernames.indexOf(image.properties.captured_by) !== -1;
52937         });
52938       }
52939       return sequences;
52940     }
52941     function update() {
52942       var viewer = context.container().select(".photoviewer");
52943       var selected = viewer.empty() ? void 0 : viewer.datum();
52944       var z2 = ~~context.map().zoom();
52945       var showMarkers = z2 >= minMarkerZoom;
52946       var showViewfields = z2 >= minViewfieldZoom2;
52947       var service = getService();
52948       var sequences = [];
52949       var images = [];
52950       if (context.photos().showsFlat()) {
52951         sequences = service ? service.sequences(projection2) : [];
52952         images = service && showMarkers ? service.images(projection2) : [];
52953         sequences = filterSequences(sequences);
52954         images = filterImages(images);
52955       }
52956       var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
52957         return d2.properties.key;
52958       });
52959       traces.exit().remove();
52960       traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
52961       var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
52962         return d2.key;
52963       });
52964       groups.exit().remove();
52965       var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
52966       groupsEnter.append("g").attr("class", "viewfield-scale");
52967       var markers = groups.merge(groupsEnter).sort(function(a2, b2) {
52968         return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
52969       }).attr("transform", transform2).select(".viewfield-scale");
52970       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
52971       var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
52972       viewfields.exit().remove();
52973       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");
52974     }
52975     function drawImages(selection2) {
52976       var enabled = svgKartaviewImages.enabled, service = getService();
52977       layer = selection2.selectAll(".layer-kartaview").data(service ? [0] : []);
52978       layer.exit().remove();
52979       var layerEnter = layer.enter().append("g").attr("class", "layer-kartaview").style("display", enabled ? "block" : "none");
52980       layerEnter.append("g").attr("class", "sequences");
52981       layerEnter.append("g").attr("class", "markers");
52982       layer = layerEnter.merge(layer);
52983       if (enabled) {
52984         if (service && ~~context.map().zoom() >= minZoom4) {
52985           editOn();
52986           update();
52987           service.loadImages(projection2);
52988         } else {
52989           editOff();
52990         }
52991       }
52992     }
52993     drawImages.enabled = function(_2) {
52994       if (!arguments.length)
52995         return svgKartaviewImages.enabled;
52996       svgKartaviewImages.enabled = _2;
52997       if (svgKartaviewImages.enabled) {
52998         showLayer();
52999         context.photos().on("change.kartaview_images", update);
53000       } else {
53001         hideLayer();
53002         context.photos().on("change.kartaview_images", null);
53003       }
53004       dispatch14.call("change");
53005       return this;
53006     };
53007     drawImages.supported = function() {
53008       return !!getService();
53009     };
53010     drawImages.rendered = function(zoom) {
53011       return zoom >= minZoom4;
53012     };
53013     init2();
53014     return drawImages;
53015   }
53016
53017   // modules/svg/mapilio_images.js
53018   function svgMapilioImages(projection2, context, dispatch14) {
53019     const throttledRedraw = throttle_default(function() {
53020       dispatch14.call("change");
53021     }, 1e3);
53022     const minZoom4 = 12;
53023     let layer = select_default2(null);
53024     let _mapilio;
53025     const viewFieldZoomLevel = 18;
53026     function init2() {
53027       if (svgMapilioImages.initialized)
53028         return;
53029       svgMapilioImages.enabled = false;
53030       svgMapilioImages.initialized = true;
53031     }
53032     function getService() {
53033       if (services.mapilio && !_mapilio) {
53034         _mapilio = services.mapilio;
53035         _mapilio.event.on("loadedImages", throttledRedraw);
53036       } else if (!services.mapilio && _mapilio) {
53037         _mapilio = null;
53038       }
53039       return _mapilio;
53040     }
53041     function showLayer() {
53042       const service = getService();
53043       if (!service)
53044         return;
53045       editOn();
53046       layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
53047         dispatch14.call("change");
53048       });
53049     }
53050     function hideLayer() {
53051       throttledRedraw.cancel();
53052       layer.transition().duration(250).style("opacity", 0).on("end", editOff);
53053     }
53054     function transform2(d2) {
53055       let t2 = svgPointTransform(projection2)(d2);
53056       if (d2.heading) {
53057         t2 += " rotate(" + Math.floor(d2.heading) + ",0,0)";
53058       }
53059       return t2;
53060     }
53061     function editOn() {
53062       layer.style("display", "block");
53063     }
53064     function editOff() {
53065       layer.selectAll(".viewfield-group").remove();
53066       layer.style("display", "none");
53067     }
53068     function click(d3_event, image) {
53069       const service = getService();
53070       if (!service)
53071         return;
53072       service.ensureViewerLoaded(context, image.id).then(function() {
53073         service.selectImage(context, image.id).showViewer(context);
53074       });
53075       context.map().centerEase(image.loc);
53076     }
53077     function mouseover(d3_event, image) {
53078       const service = getService();
53079       if (service)
53080         service.setStyles(context, image);
53081     }
53082     function mouseout() {
53083       const service = getService();
53084       if (service)
53085         service.setStyles(context, null);
53086     }
53087     function update() {
53088       const z2 = ~~context.map().zoom();
53089       const showViewfields = z2 >= viewFieldZoomLevel;
53090       const service = getService();
53091       let sequences = service ? service.sequences(projection2) : [];
53092       let images = service ? service.images(projection2) : [];
53093       let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
53094         return d2.properties.id;
53095       });
53096       traces.exit().remove();
53097       traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
53098       const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
53099         return d2.id;
53100       });
53101       groups.exit().remove();
53102       const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
53103       groupsEnter.append("g").attr("class", "viewfield-scale");
53104       const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
53105         return b2.loc[1] - a2.loc[1];
53106       }).attr("transform", transform2).select(".viewfield-scale");
53107       markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
53108       const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
53109       viewfields.exit().remove();
53110       viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
53111       function viewfieldPath() {
53112         if (this.parentNode.__data__.isPano) {
53113           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
53114         } else {
53115           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
53116         }
53117       }
53118     }
53119     function drawImages(selection2) {
53120       const enabled = svgMapilioImages.enabled;
53121       const service = getService();
53122       layer = selection2.selectAll(".layer-mapilio").data(service ? [0] : []);
53123       layer.exit().remove();
53124       const layerEnter = layer.enter().append("g").attr("class", "layer-mapilio").style("display", enabled ? "block" : "none");
53125       layerEnter.append("g").attr("class", "sequences");
53126       layerEnter.append("g").attr("class", "markers");
53127       layer = layerEnter.merge(layer);
53128       if (enabled) {
53129         if (service && ~~context.map().zoom() >= minZoom4) {
53130           editOn();
53131           update();
53132           service.loadImages(projection2);
53133           service.loadLines(projection2);
53134         } else {
53135           editOff();
53136         }
53137       }
53138     }
53139     drawImages.enabled = function(_2) {
53140       if (!arguments.length)
53141         return svgMapilioImages.enabled;
53142       svgMapilioImages.enabled = _2;
53143       if (svgMapilioImages.enabled) {
53144         showLayer();
53145         context.photos().on("change.mapilio_images", null);
53146       } else {
53147         hideLayer();
53148         context.photos().on("change.mapilio_images", null);
53149       }
53150       dispatch14.call("change");
53151       return this;
53152     };
53153     drawImages.supported = function() {
53154       return !!getService();
53155     };
53156     drawImages.rendered = function(zoom) {
53157       return zoom >= minZoom4;
53158     };
53159     init2();
53160     return drawImages;
53161   }
53162
53163   // modules/svg/osm.js
53164   function svgOsm(projection2, context, dispatch14) {
53165     var enabled = true;
53166     function drawOsm(selection2) {
53167       selection2.selectAll(".layer-osm").data(["covered", "areas", "lines", "points", "labels"]).enter().append("g").attr("class", function(d2) {
53168         return "layer-osm " + d2;
53169       });
53170       selection2.selectAll(".layer-osm.points").selectAll(".points-group").data(["points", "midpoints", "vertices", "turns"]).enter().append("g").attr("class", function(d2) {
53171         return "points-group " + d2;
53172       });
53173     }
53174     function showLayer() {
53175       var layer = context.surface().selectAll(".data-layer.osm");
53176       layer.interrupt();
53177       layer.classed("disabled", false).style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
53178         dispatch14.call("change");
53179       });
53180     }
53181     function hideLayer() {
53182       var layer = context.surface().selectAll(".data-layer.osm");
53183       layer.interrupt();
53184       layer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
53185         layer.classed("disabled", true);
53186         dispatch14.call("change");
53187       });
53188     }
53189     drawOsm.enabled = function(val) {
53190       if (!arguments.length)
53191         return enabled;
53192       enabled = val;
53193       if (enabled) {
53194         showLayer();
53195       } else {
53196         hideLayer();
53197       }
53198       dispatch14.call("change");
53199       return this;
53200     };
53201     return drawOsm;
53202   }
53203
53204   // modules/svg/notes.js
53205   var _notesEnabled = false;
53206   var _osmService;
53207   function svgNotes(projection2, context, dispatch14) {
53208     if (!dispatch14) {
53209       dispatch14 = dispatch_default("change");
53210     }
53211     var throttledRedraw = throttle_default(function() {
53212       dispatch14.call("change");
53213     }, 1e3);
53214     var minZoom4 = 12;
53215     var touchLayer = select_default2(null);
53216     var drawLayer = select_default2(null);
53217     var _notesVisible = false;
53218     function markerPath(selection2, klass) {
53219       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");
53220     }
53221     function getService() {
53222       if (services.osm && !_osmService) {
53223         _osmService = services.osm;
53224         _osmService.on("loadedNotes", throttledRedraw);
53225       } else if (!services.osm && _osmService) {
53226         _osmService = null;
53227       }
53228       return _osmService;
53229     }
53230     function editOn() {
53231       if (!_notesVisible) {
53232         _notesVisible = true;
53233         drawLayer.style("display", "block");
53234       }
53235     }
53236     function editOff() {
53237       if (_notesVisible) {
53238         _notesVisible = false;
53239         drawLayer.style("display", "none");
53240         drawLayer.selectAll(".note").remove();
53241         touchLayer.selectAll(".note").remove();
53242       }
53243     }
53244     function layerOn() {
53245       editOn();
53246       drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
53247         dispatch14.call("change");
53248       });
53249     }
53250     function layerOff() {
53251       throttledRedraw.cancel();
53252       drawLayer.interrupt();
53253       touchLayer.selectAll(".note").remove();
53254       drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
53255         editOff();
53256         dispatch14.call("change");
53257       });
53258     }
53259     function updateMarkers() {
53260       if (!_notesVisible || !_notesEnabled)
53261         return;
53262       var service = getService();
53263       var selectedID = context.selectedNoteID();
53264       var data = service ? service.notes(projection2) : [];
53265       var getTransform = svgPointTransform(projection2);
53266       var notes = drawLayer.selectAll(".note").data(data, function(d2) {
53267         return d2.status + d2.id;
53268       });
53269       notes.exit().remove();
53270       var notesEnter = notes.enter().append("g").attr("class", function(d2) {
53271         return "note note-" + d2.id + " " + d2.status;
53272       }).classed("new", function(d2) {
53273         return d2.id < 0;
53274       });
53275       notesEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
53276       notesEnter.append("path").call(markerPath, "shadow");
53277       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");
53278       notesEnter.selectAll(".icon-annotation").data(function(d2) {
53279         return [d2];
53280       }).enter().append("use").attr("class", "icon-annotation").attr("width", "10px").attr("height", "10px").attr("x", "-3px").attr("y", "-19px").attr("xlink:href", function(d2) {
53281         if (d2.id < 0)
53282           return "#iD-icon-plus";
53283         if (d2.status === "open")
53284           return "#iD-icon-close";
53285         return "#iD-icon-apply";
53286       });
53287       notes.merge(notesEnter).sort(sortY).classed("selected", function(d2) {
53288         var mode = context.mode();
53289         var isMoving = mode && mode.id === "drag-note";
53290         return !isMoving && d2.id === selectedID;
53291       }).attr("transform", getTransform);
53292       if (touchLayer.empty())
53293         return;
53294       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
53295       var targets = touchLayer.selectAll(".note").data(data, function(d2) {
53296         return d2.id;
53297       });
53298       targets.exit().remove();
53299       targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", function(d2) {
53300         var newClass = d2.id < 0 ? "new" : "";
53301         return "note target note-" + d2.id + " " + fillClass + newClass;
53302       }).attr("transform", getTransform);
53303       function sortY(a2, b2) {
53304         if (a2.id === selectedID)
53305           return 1;
53306         if (b2.id === selectedID)
53307           return -1;
53308         return b2.loc[1] - a2.loc[1];
53309       }
53310     }
53311     function drawNotes(selection2) {
53312       var service = getService();
53313       var surface = context.surface();
53314       if (surface && !surface.empty()) {
53315         touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
53316       }
53317       drawLayer = selection2.selectAll(".layer-notes").data(service ? [0] : []);
53318       drawLayer.exit().remove();
53319       drawLayer = drawLayer.enter().append("g").attr("class", "layer-notes").style("display", _notesEnabled ? "block" : "none").merge(drawLayer);
53320       if (_notesEnabled) {
53321         if (service && ~~context.map().zoom() >= minZoom4) {
53322           editOn();
53323           service.loadNotes(projection2);
53324           updateMarkers();
53325         } else {
53326           editOff();
53327         }
53328       }
53329     }
53330     drawNotes.enabled = function(val) {
53331       if (!arguments.length)
53332         return _notesEnabled;
53333       _notesEnabled = val;
53334       if (_notesEnabled) {
53335         layerOn();
53336       } else {
53337         layerOff();
53338         if (context.selectedNoteID()) {
53339           context.enter(modeBrowse(context));
53340         }
53341       }
53342       dispatch14.call("change");
53343       return this;
53344     };
53345     return drawNotes;
53346   }
53347
53348   // modules/svg/touch.js
53349   function svgTouch() {
53350     function drawTouch(selection2) {
53351       selection2.selectAll(".layer-touch").data(["areas", "lines", "points", "turns", "markers"]).enter().append("g").attr("class", function(d2) {
53352         return "layer-touch " + d2;
53353       });
53354     }
53355     return drawTouch;
53356   }
53357
53358   // modules/util/dimensions.js
53359   function refresh(selection2, node) {
53360     var cr = node.getBoundingClientRect();
53361     var prop = [cr.width, cr.height];
53362     selection2.property("__dimensions__", prop);
53363     return prop;
53364   }
53365   function utilGetDimensions(selection2, force) {
53366     if (!selection2 || selection2.empty()) {
53367       return [0, 0];
53368     }
53369     var node = selection2.node(), cached = selection2.property("__dimensions__");
53370     return !cached || force ? refresh(selection2, node) : cached;
53371   }
53372   function utilSetDimensions(selection2, dimensions) {
53373     if (!selection2 || selection2.empty()) {
53374       return selection2;
53375     }
53376     var node = selection2.node();
53377     if (dimensions === null) {
53378       refresh(selection2, node);
53379       return selection2;
53380     }
53381     return selection2.property("__dimensions__", [dimensions[0], dimensions[1]]).attr("width", dimensions[0]).attr("height", dimensions[1]);
53382   }
53383
53384   // modules/svg/layers.js
53385   function svgLayers(projection2, context) {
53386     var dispatch14 = dispatch_default("change");
53387     var svg2 = select_default2(null);
53388     var _layers = [
53389       { id: "osm", layer: svgOsm(projection2, context, dispatch14) },
53390       { id: "notes", layer: svgNotes(projection2, context, dispatch14) },
53391       { id: "data", layer: svgData(projection2, context, dispatch14) },
53392       { id: "keepRight", layer: svgKeepRight(projection2, context, dispatch14) },
53393       { id: "improveOSM", layer: svgImproveOSM(projection2, context, dispatch14) },
53394       { id: "osmose", layer: svgOsmose(projection2, context, dispatch14) },
53395       { id: "streetside", layer: svgStreetside(projection2, context, dispatch14) },
53396       { id: "mapillary", layer: svgMapillaryImages(projection2, context, dispatch14) },
53397       { id: "mapillary-position", layer: svgMapillaryPosition(projection2, context, dispatch14) },
53398       { id: "mapillary-map-features", layer: svgMapillaryMapFeatures(projection2, context, dispatch14) },
53399       { id: "mapillary-signs", layer: svgMapillarySigns(projection2, context, dispatch14) },
53400       { id: "kartaview", layer: svgKartaviewImages(projection2, context, dispatch14) },
53401       { id: "mapilio", layer: svgMapilioImages(projection2, context, dispatch14) },
53402       { id: "vegbilder", layer: svgVegbilder(projection2, context, dispatch14) },
53403       { id: "local-photos", layer: svgLocalPhotos(projection2, context, dispatch14) },
53404       { id: "debug", layer: svgDebug(projection2, context, dispatch14) },
53405       { id: "geolocate", layer: svgGeolocate(projection2, context, dispatch14) },
53406       { id: "touch", layer: svgTouch(projection2, context, dispatch14) }
53407     ];
53408     function drawLayers(selection2) {
53409       svg2 = selection2.selectAll(".surface").data([0]);
53410       svg2 = svg2.enter().append("svg").attr("class", "surface").merge(svg2);
53411       var defs = svg2.selectAll(".surface-defs").data([0]);
53412       defs.enter().append("defs").attr("class", "surface-defs");
53413       var groups = svg2.selectAll(".data-layer").data(_layers);
53414       groups.exit().remove();
53415       groups.enter().append("g").attr("class", function(d2) {
53416         return "data-layer " + d2.id;
53417       }).merge(groups).each(function(d2) {
53418         select_default2(this).call(d2.layer);
53419       });
53420     }
53421     drawLayers.all = function() {
53422       return _layers;
53423     };
53424     drawLayers.layer = function(id2) {
53425       var obj = _layers.find(function(o2) {
53426         return o2.id === id2;
53427       });
53428       return obj && obj.layer;
53429     };
53430     drawLayers.only = function(what) {
53431       var arr = [].concat(what);
53432       var all = _layers.map(function(layer) {
53433         return layer.id;
53434       });
53435       return drawLayers.remove(utilArrayDifference(all, arr));
53436     };
53437     drawLayers.remove = function(what) {
53438       var arr = [].concat(what);
53439       arr.forEach(function(id2) {
53440         _layers = _layers.filter(function(o2) {
53441           return o2.id !== id2;
53442         });
53443       });
53444       dispatch14.call("change");
53445       return this;
53446     };
53447     drawLayers.add = function(what) {
53448       var arr = [].concat(what);
53449       arr.forEach(function(obj) {
53450         if ("id" in obj && "layer" in obj) {
53451           _layers.push(obj);
53452         }
53453       });
53454       dispatch14.call("change");
53455       return this;
53456     };
53457     drawLayers.dimensions = function(val) {
53458       if (!arguments.length)
53459         return utilGetDimensions(svg2);
53460       utilSetDimensions(svg2, val);
53461       return this;
53462     };
53463     return utilRebind(drawLayers, dispatch14, "on");
53464   }
53465
53466   // modules/svg/lines.js
53467   var import_fast_deep_equal6 = __toESM(require_fast_deep_equal());
53468   function svgLines(projection2, context) {
53469     var detected = utilDetect();
53470     var highway_stack = {
53471       motorway: 0,
53472       motorway_link: 1,
53473       trunk: 2,
53474       trunk_link: 3,
53475       primary: 4,
53476       primary_link: 5,
53477       secondary: 6,
53478       tertiary: 7,
53479       unclassified: 8,
53480       residential: 9,
53481       service: 10,
53482       footway: 11
53483     };
53484     function drawTargets(selection2, graph, entities, filter2) {
53485       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
53486       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
53487       var getPath = svgPath(projection2).geojson;
53488       var activeID = context.activeID();
53489       var base = context.history().base();
53490       var data = { targets: [], nopes: [] };
53491       entities.forEach(function(way) {
53492         var features = svgSegmentWay(way, graph, activeID);
53493         data.targets.push.apply(data.targets, features.passive);
53494         data.nopes.push.apply(data.nopes, features.active);
53495       });
53496       var targetData = data.targets.filter(getPath);
53497       var targets = selection2.selectAll(".line.target-allowed").filter(function(d2) {
53498         return filter2(d2.properties.entity);
53499       }).data(targetData, function key(d2) {
53500         return d2.id;
53501       });
53502       targets.exit().remove();
53503       var segmentWasEdited = function(d2) {
53504         var wayID = d2.properties.entity.id;
53505         if (!base.entities[wayID] || !(0, import_fast_deep_equal6.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
53506           return false;
53507         }
53508         return d2.properties.nodes.some(function(n3) {
53509           return !base.entities[n3.id] || !(0, import_fast_deep_equal6.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
53510         });
53511       };
53512       targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
53513         return "way line target target-allowed " + targetClass + d2.id;
53514       }).classed("segment-edited", segmentWasEdited);
53515       var nopeData = data.nopes.filter(getPath);
53516       var nopes = selection2.selectAll(".line.target-nope").filter(function(d2) {
53517         return filter2(d2.properties.entity);
53518       }).data(nopeData, function key(d2) {
53519         return d2.id;
53520       });
53521       nopes.exit().remove();
53522       nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
53523         return "way line target target-nope " + nopeClass + d2.id;
53524       }).classed("segment-edited", segmentWasEdited);
53525     }
53526     function drawLines(selection2, graph, entities, filter2) {
53527       var base = context.history().base();
53528       function waystack(a2, b2) {
53529         var selected = context.selectedIDs();
53530         var scoreA = selected.indexOf(a2.id) !== -1 ? 20 : 0;
53531         var scoreB = selected.indexOf(b2.id) !== -1 ? 20 : 0;
53532         if (a2.tags.highway) {
53533           scoreA -= highway_stack[a2.tags.highway];
53534         }
53535         if (b2.tags.highway) {
53536           scoreB -= highway_stack[b2.tags.highway];
53537         }
53538         return scoreA - scoreB;
53539       }
53540       function drawLineGroup(selection3, klass, isSelected) {
53541         var mode = context.mode();
53542         var isDrawing = mode && /^draw/.test(mode.id);
53543         var selectedClass = !isDrawing && isSelected ? "selected " : "";
53544         var lines = selection3.selectAll("path").filter(filter2).data(getPathData(isSelected), osmEntity.key);
53545         lines.exit().remove();
53546         lines.enter().append("path").attr("class", function(d2) {
53547           var prefix = "way line";
53548           if (!d2.hasInterestingTags()) {
53549             var parentRelations = graph.parentRelations(d2);
53550             var parentMultipolygons = parentRelations.filter(function(relation) {
53551               return relation.isMultipolygon();
53552             });
53553             if (parentMultipolygons.length > 0 && // and only multipolygon relations
53554             parentRelations.length === parentMultipolygons.length) {
53555               prefix = "relation area";
53556             }
53557           }
53558           var oldMPClass = oldMultiPolygonOuters[d2.id] ? "old-multipolygon " : "";
53559           return prefix + " " + klass + " " + selectedClass + oldMPClass + d2.id;
53560         }).classed("added", function(d2) {
53561           return !base.entities[d2.id];
53562         }).classed("geometry-edited", function(d2) {
53563           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);
53564         }).classed("retagged", function(d2) {
53565           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);
53566         }).call(svgTagClasses()).merge(lines).sort(waystack).attr("d", getPath).call(svgTagClasses().tags(svgRelationMemberTags(graph)));
53567         return selection3;
53568       }
53569       function getPathData(isSelected) {
53570         return function() {
53571           var layer = this.parentNode.__data__;
53572           var data = pathdata[layer] || [];
53573           return data.filter(function(d2) {
53574             if (isSelected) {
53575               return context.selectedIDs().indexOf(d2.id) !== -1;
53576             } else {
53577               return context.selectedIDs().indexOf(d2.id) === -1;
53578             }
53579           });
53580         };
53581       }
53582       function addMarkers(layergroup, pathclass, groupclass, groupdata, marker) {
53583         var markergroup = layergroup.selectAll("g." + groupclass).data([pathclass]);
53584         markergroup = markergroup.enter().append("g").attr("class", groupclass).merge(markergroup);
53585         var markers = markergroup.selectAll("path").filter(filter2).data(
53586           function data() {
53587             return groupdata[this.parentNode.__data__] || [];
53588           },
53589           function key(d2) {
53590             return [d2.id, d2.index];
53591           }
53592         );
53593         markers.exit().remove();
53594         markers = markers.enter().append("path").attr("class", pathclass).merge(markers).attr("marker-mid", marker).attr("d", function(d2) {
53595           return d2.d;
53596         });
53597         if (detected.ie) {
53598           markers.each(function() {
53599             this.parentNode.insertBefore(this, this);
53600           });
53601         }
53602       }
53603       var getPath = svgPath(projection2, graph);
53604       var ways = [];
53605       var onewaydata = {};
53606       var sideddata = {};
53607       var oldMultiPolygonOuters = {};
53608       for (var i3 = 0; i3 < entities.length; i3++) {
53609         var entity = entities[i3];
53610         var outer = osmOldMultipolygonOuterMember(entity, graph);
53611         if (outer) {
53612           ways.push(entity.mergeTags(outer.tags));
53613           oldMultiPolygonOuters[outer.id] = true;
53614         } else if (entity.geometry(graph) === "line" || entity.geometry(graph) === "area" && entity.sidednessIdentifier && entity.sidednessIdentifier() === "coastline") {
53615           ways.push(entity);
53616         }
53617       }
53618       ways = ways.filter(getPath);
53619       var pathdata = utilArrayGroupBy(ways, function(way) {
53620         return way.layer();
53621       });
53622       Object.keys(pathdata).forEach(function(k2) {
53623         var v2 = pathdata[k2];
53624         var onewayArr = v2.filter(function(d2) {
53625           return d2.isOneWay();
53626         });
53627         var onewaySegments = svgMarkerSegments(
53628           projection2,
53629           graph,
53630           35,
53631           function shouldReverse(entity2) {
53632             return entity2.tags.oneway === "-1";
53633           },
53634           function bothDirections(entity2) {
53635             return entity2.tags.oneway === "reversible" || entity2.tags.oneway === "alternating";
53636           }
53637         );
53638         onewaydata[k2] = utilArrayFlatten(onewayArr.map(onewaySegments));
53639         var sidedArr = v2.filter(function(d2) {
53640           return d2.isSided();
53641         });
53642         var sidedSegments = svgMarkerSegments(
53643           projection2,
53644           graph,
53645           30,
53646           function shouldReverse() {
53647             return false;
53648           },
53649           function bothDirections() {
53650             return false;
53651           }
53652         );
53653         sideddata[k2] = utilArrayFlatten(sidedArr.map(sidedSegments));
53654       });
53655       var covered = selection2.selectAll(".layer-osm.covered");
53656       var uncovered = selection2.selectAll(".layer-osm.lines");
53657       var touchLayer = selection2.selectAll(".layer-touch.lines");
53658       [covered, uncovered].forEach(function(selection3) {
53659         var range3 = selection3 === covered ? range(-10, 0) : range(0, 11);
53660         var layergroup = selection3.selectAll("g.layergroup").data(range3);
53661         layergroup = layergroup.enter().append("g").attr("class", function(d2) {
53662           return "layergroup layer" + String(d2);
53663         }).merge(layergroup);
53664         layergroup.selectAll("g.linegroup").data(["shadow", "casing", "stroke", "shadow-highlighted", "casing-highlighted", "stroke-highlighted"]).enter().append("g").attr("class", function(d2) {
53665           return "linegroup line-" + d2;
53666         });
53667         layergroup.selectAll("g.line-shadow").call(drawLineGroup, "shadow", false);
53668         layergroup.selectAll("g.line-casing").call(drawLineGroup, "casing", false);
53669         layergroup.selectAll("g.line-stroke").call(drawLineGroup, "stroke", false);
53670         layergroup.selectAll("g.line-shadow-highlighted").call(drawLineGroup, "shadow", true);
53671         layergroup.selectAll("g.line-casing-highlighted").call(drawLineGroup, "casing", true);
53672         layergroup.selectAll("g.line-stroke-highlighted").call(drawLineGroup, "stroke", true);
53673         addMarkers(layergroup, "oneway", "onewaygroup", onewaydata, "url(#ideditor-oneway-marker)");
53674         addMarkers(
53675           layergroup,
53676           "sided",
53677           "sidedgroup",
53678           sideddata,
53679           function marker(d2) {
53680             var category = graph.entity(d2.id).sidednessIdentifier();
53681             return "url(#ideditor-sided-marker-" + category + ")";
53682           }
53683         );
53684       });
53685       touchLayer.call(drawTargets, graph, ways, filter2);
53686     }
53687     return drawLines;
53688   }
53689
53690   // modules/svg/midpoints.js
53691   function svgMidpoints(projection2, context) {
53692     var targetRadius = 8;
53693     function drawTargets(selection2, graph, entities, filter2) {
53694       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
53695       var getTransform = svgPointTransform(projection2).geojson;
53696       var data = entities.map(function(midpoint) {
53697         return {
53698           type: "Feature",
53699           id: midpoint.id,
53700           properties: {
53701             target: true,
53702             entity: midpoint
53703           },
53704           geometry: {
53705             type: "Point",
53706             coordinates: midpoint.loc
53707           }
53708         };
53709       });
53710       var targets = selection2.selectAll(".midpoint.target").filter(function(d2) {
53711         return filter2(d2.properties.entity);
53712       }).data(data, function key(d2) {
53713         return d2.id;
53714       });
53715       targets.exit().remove();
53716       targets.enter().append("circle").attr("r", targetRadius).merge(targets).attr("class", function(d2) {
53717         return "node midpoint target " + fillClass + d2.id;
53718       }).attr("transform", getTransform);
53719     }
53720     function drawMidpoints(selection2, graph, entities, filter2, extent) {
53721       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.midpoints");
53722       var touchLayer = selection2.selectAll(".layer-touch.points");
53723       var mode = context.mode();
53724       if (mode && mode.id !== "select" || !context.map().withinEditableZoom()) {
53725         drawLayer.selectAll(".midpoint").remove();
53726         touchLayer.selectAll(".midpoint.target").remove();
53727         return;
53728       }
53729       var poly = extent.polygon();
53730       var midpoints = {};
53731       for (var i3 = 0; i3 < entities.length; i3++) {
53732         var entity = entities[i3];
53733         if (entity.type !== "way")
53734           continue;
53735         if (!filter2(entity))
53736           continue;
53737         if (context.selectedIDs().indexOf(entity.id) < 0)
53738           continue;
53739         var nodes = graph.childNodes(entity);
53740         for (var j3 = 0; j3 < nodes.length - 1; j3++) {
53741           var a2 = nodes[j3];
53742           var b2 = nodes[j3 + 1];
53743           var id2 = [a2.id, b2.id].sort().join("-");
53744           if (midpoints[id2]) {
53745             midpoints[id2].parents.push(entity);
53746           } else if (geoVecLength(projection2(a2.loc), projection2(b2.loc)) > 40) {
53747             var point2 = geoVecInterp(a2.loc, b2.loc, 0.5);
53748             var loc = null;
53749             if (extent.intersects(point2)) {
53750               loc = point2;
53751             } else {
53752               for (var k2 = 0; k2 < 4; k2++) {
53753                 point2 = geoLineIntersection([a2.loc, b2.loc], [poly[k2], poly[k2 + 1]]);
53754                 if (point2 && geoVecLength(projection2(a2.loc), projection2(point2)) > 20 && geoVecLength(projection2(b2.loc), projection2(point2)) > 20) {
53755                   loc = point2;
53756                   break;
53757                 }
53758               }
53759             }
53760             if (loc) {
53761               midpoints[id2] = {
53762                 type: "midpoint",
53763                 id: id2,
53764                 loc,
53765                 edge: [a2.id, b2.id],
53766                 parents: [entity]
53767               };
53768             }
53769           }
53770         }
53771       }
53772       function midpointFilter(d2) {
53773         if (midpoints[d2.id])
53774           return true;
53775         for (var i4 = 0; i4 < d2.parents.length; i4++) {
53776           if (filter2(d2.parents[i4])) {
53777             return true;
53778           }
53779         }
53780         return false;
53781       }
53782       var groups = drawLayer.selectAll(".midpoint").filter(midpointFilter).data(Object.values(midpoints), function(d2) {
53783         return d2.id;
53784       });
53785       groups.exit().remove();
53786       var enter = groups.enter().insert("g", ":first-child").attr("class", "midpoint");
53787       enter.append("polygon").attr("points", "-6,8 10,0 -6,-8").attr("class", "shadow");
53788       enter.append("polygon").attr("points", "-3,4 5,0 -3,-4").attr("class", "fill");
53789       groups = groups.merge(enter).attr("transform", function(d2) {
53790         var translate = svgPointTransform(projection2);
53791         var a3 = graph.entity(d2.edge[0]);
53792         var b3 = graph.entity(d2.edge[1]);
53793         var angle2 = geoAngle(a3, b3, projection2) * (180 / Math.PI);
53794         return translate(d2) + " rotate(" + angle2 + ")";
53795       }).call(svgTagClasses().tags(
53796         function(d2) {
53797           return d2.parents[0].tags;
53798         }
53799       ));
53800       groups.select("polygon.shadow");
53801       groups.select("polygon.fill");
53802       touchLayer.call(drawTargets, graph, Object.values(midpoints), midpointFilter);
53803     }
53804     return drawMidpoints;
53805   }
53806
53807   // modules/svg/points.js
53808   var import_fast_deep_equal7 = __toESM(require_fast_deep_equal());
53809   function svgPoints(projection2, context) {
53810     function markerPath(selection2, klass) {
53811       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");
53812     }
53813     function sortY(a2, b2) {
53814       return b2.loc[1] - a2.loc[1];
53815     }
53816     function fastEntityKey(d2) {
53817       var mode = context.mode();
53818       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
53819       return isMoving ? d2.id : osmEntity.key(d2);
53820     }
53821     function drawTargets(selection2, graph, entities, filter2) {
53822       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
53823       var getTransform = svgPointTransform(projection2).geojson;
53824       var activeID = context.activeID();
53825       var data = [];
53826       entities.forEach(function(node) {
53827         if (activeID === node.id)
53828           return;
53829         data.push({
53830           type: "Feature",
53831           id: node.id,
53832           properties: {
53833             target: true,
53834             entity: node
53835           },
53836           geometry: node.asGeoJSON()
53837         });
53838       });
53839       var targets = selection2.selectAll(".point.target").filter(function(d2) {
53840         return filter2(d2.properties.entity);
53841       }).data(data, function key(d2) {
53842         return d2.id;
53843       });
53844       targets.exit().remove();
53845       targets.enter().append("rect").attr("x", -10).attr("y", -26).attr("width", 20).attr("height", 30).merge(targets).attr("class", function(d2) {
53846         return "node point target " + fillClass + d2.id;
53847       }).attr("transform", getTransform);
53848     }
53849     function drawPoints(selection2, graph, entities, filter2) {
53850       var wireframe = context.surface().classed("fill-wireframe");
53851       var zoom = geoScaleToZoom(projection2.scale());
53852       var base = context.history().base();
53853       function renderAsPoint(entity) {
53854         return entity.geometry(graph) === "point" && !(zoom >= 18 && entity.directions(graph, projection2).length);
53855       }
53856       var points = wireframe ? [] : entities.filter(renderAsPoint);
53857       points.sort(sortY);
53858       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.points");
53859       var touchLayer = selection2.selectAll(".layer-touch.points");
53860       var groups = drawLayer.selectAll("g.point").filter(filter2).data(points, fastEntityKey);
53861       groups.exit().remove();
53862       var enter = groups.enter().append("g").attr("class", function(d2) {
53863         return "node point " + d2.id;
53864       }).order();
53865       enter.append("path").call(markerPath, "shadow");
53866       enter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
53867       enter.append("path").call(markerPath, "stroke");
53868       enter.append("use").attr("transform", "translate(-5.5, -20)").attr("class", "icon").attr("width", "12px").attr("height", "12px");
53869       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("added", function(d2) {
53870         return !base.entities[d2.id];
53871       }).classed("moved", function(d2) {
53872         return base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
53873       }).classed("retagged", function(d2) {
53874         return base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
53875       }).call(svgTagClasses());
53876       groups.select(".shadow");
53877       groups.select(".stroke");
53878       groups.select(".icon").attr("xlink:href", function(entity) {
53879         var preset = _mainPresetIndex.match(entity, graph);
53880         var picon = preset && preset.icon;
53881         return picon ? "#" + picon : "";
53882       });
53883       touchLayer.call(drawTargets, graph, points, filter2);
53884     }
53885     return drawPoints;
53886   }
53887
53888   // modules/svg/turns.js
53889   function svgTurns(projection2, context) {
53890     function icon2(turn) {
53891       var u2 = turn.u ? "-u" : "";
53892       if (turn.no)
53893         return "#iD-turn-no" + u2;
53894       if (turn.only)
53895         return "#iD-turn-only" + u2;
53896       return "#iD-turn-yes" + u2;
53897     }
53898     function drawTurns(selection2, graph, turns) {
53899       function turnTransform(d2) {
53900         var pxRadius = 50;
53901         var toWay = graph.entity(d2.to.way);
53902         var toPoints = graph.childNodes(toWay).map(function(n3) {
53903           return n3.loc;
53904         }).map(projection2);
53905         var toLength = geoPathLength(toPoints);
53906         var mid = toLength / 2;
53907         var toNode = graph.entity(d2.to.node);
53908         var toVertex = graph.entity(d2.to.vertex);
53909         var a2 = geoAngle(toVertex, toNode, projection2);
53910         var o2 = projection2(toVertex.loc);
53911         var r2 = d2.u ? 0 : !toWay.__via ? pxRadius : Math.min(mid, pxRadius);
53912         return "translate(" + (r2 * Math.cos(a2) + o2[0]) + "," + (r2 * Math.sin(a2) + o2[1]) + ") rotate(" + a2 * 180 / Math.PI + ")";
53913       }
53914       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.turns");
53915       var touchLayer = selection2.selectAll(".layer-touch.turns");
53916       var groups = drawLayer.selectAll("g.turn").data(turns, function(d2) {
53917         return d2.key;
53918       });
53919       groups.exit().remove();
53920       var groupsEnter = groups.enter().append("g").attr("class", function(d2) {
53921         return "turn " + d2.key;
53922       });
53923       var turnsEnter = groupsEnter.filter(function(d2) {
53924         return !d2.u;
53925       });
53926       turnsEnter.append("rect").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
53927       turnsEnter.append("use").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
53928       var uEnter = groupsEnter.filter(function(d2) {
53929         return d2.u;
53930       });
53931       uEnter.append("circle").attr("r", "16");
53932       uEnter.append("use").attr("transform", "translate(-16, -16)").attr("width", "32").attr("height", "32");
53933       groups = groups.merge(groupsEnter).attr("opacity", function(d2) {
53934         return d2.direct === false ? "0.7" : null;
53935       }).attr("transform", turnTransform);
53936       groups.select("use").attr("xlink:href", icon2);
53937       groups.select("rect");
53938       groups.select("circle");
53939       var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
53940       groups = touchLayer.selectAll("g.turn").data(turns, function(d2) {
53941         return d2.key;
53942       });
53943       groups.exit().remove();
53944       groupsEnter = groups.enter().append("g").attr("class", function(d2) {
53945         return "turn " + d2.key;
53946       });
53947       turnsEnter = groupsEnter.filter(function(d2) {
53948         return !d2.u;
53949       });
53950       turnsEnter.append("rect").attr("class", "target " + fillClass).attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
53951       uEnter = groupsEnter.filter(function(d2) {
53952         return d2.u;
53953       });
53954       uEnter.append("circle").attr("class", "target " + fillClass).attr("r", "16");
53955       groups = groups.merge(groupsEnter).attr("transform", turnTransform);
53956       groups.select("rect");
53957       groups.select("circle");
53958       return this;
53959     }
53960     return drawTurns;
53961   }
53962
53963   // modules/svg/vertices.js
53964   var import_fast_deep_equal8 = __toESM(require_fast_deep_equal());
53965   function svgVertices(projection2, context) {
53966     var radiuses = {
53967       //       z16-, z17,   z18+,  w/icon
53968       shadow: [6, 7.5, 7.5, 12],
53969       stroke: [2.5, 3.5, 3.5, 8],
53970       fill: [1, 1.5, 1.5, 1.5]
53971     };
53972     var _currHoverTarget;
53973     var _currPersistent = {};
53974     var _currHover = {};
53975     var _prevHover = {};
53976     var _currSelected = {};
53977     var _prevSelected = {};
53978     var _radii = {};
53979     function sortY(a2, b2) {
53980       return b2.loc[1] - a2.loc[1];
53981     }
53982     function fastEntityKey(d2) {
53983       var mode = context.mode();
53984       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
53985       return isMoving ? d2.id : osmEntity.key(d2);
53986     }
53987     function draw(selection2, graph, vertices, sets2, filter2) {
53988       sets2 = sets2 || { selected: {}, important: {}, hovered: {} };
53989       var icons = {};
53990       var directions = {};
53991       var wireframe = context.surface().classed("fill-wireframe");
53992       var zoom = geoScaleToZoom(projection2.scale());
53993       var z2 = zoom < 17 ? 0 : zoom < 18 ? 1 : 2;
53994       var activeID = context.activeID();
53995       var base = context.history().base();
53996       function getIcon(d2) {
53997         var entity = graph.entity(d2.id);
53998         if (entity.id in icons)
53999           return icons[entity.id];
54000         icons[entity.id] = entity.hasInterestingTags() && _mainPresetIndex.match(entity, graph).icon;
54001         return icons[entity.id];
54002       }
54003       function getDirections(entity) {
54004         if (entity.id in directions)
54005           return directions[entity.id];
54006         var angles = entity.directions(graph, projection2);
54007         directions[entity.id] = angles.length ? angles : false;
54008         return angles;
54009       }
54010       function updateAttributes(selection3) {
54011         ["shadow", "stroke", "fill"].forEach(function(klass) {
54012           var rads = radiuses[klass];
54013           selection3.selectAll("." + klass).each(function(entity) {
54014             var i3 = z2 && getIcon(entity);
54015             var r2 = rads[i3 ? 3 : z2];
54016             if (entity.id !== activeID && entity.isEndpoint(graph) && !entity.isConnected(graph)) {
54017               r2 += 1.5;
54018             }
54019             if (klass === "shadow") {
54020               _radii[entity.id] = r2;
54021             }
54022             select_default2(this).attr("r", r2).attr("visibility", i3 && klass === "fill" ? "hidden" : null);
54023           });
54024         });
54025       }
54026       vertices.sort(sortY);
54027       var groups = selection2.selectAll("g.vertex").filter(filter2).data(vertices, fastEntityKey);
54028       groups.exit().remove();
54029       var enter = groups.enter().append("g").attr("class", function(d2) {
54030         return "node vertex " + d2.id;
54031       }).order();
54032       enter.append("circle").attr("class", "shadow");
54033       enter.append("circle").attr("class", "stroke");
54034       enter.filter(function(d2) {
54035         return d2.hasInterestingTags();
54036       }).append("circle").attr("class", "fill");
54037       groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("sibling", function(d2) {
54038         return d2.id in sets2.selected;
54039       }).classed("shared", function(d2) {
54040         return graph.isShared(d2);
54041       }).classed("endpoint", function(d2) {
54042         return d2.isEndpoint(graph);
54043       }).classed("added", function(d2) {
54044         return !base.entities[d2.id];
54045       }).classed("moved", function(d2) {
54046         return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
54047       }).classed("retagged", function(d2) {
54048         return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
54049       }).call(updateAttributes);
54050       var iconUse = groups.selectAll(".icon").data(function data(d2) {
54051         return zoom >= 17 && getIcon(d2) ? [d2] : [];
54052       }, fastEntityKey);
54053       iconUse.exit().remove();
54054       iconUse.enter().append("use").attr("class", "icon").attr("width", "12px").attr("height", "12px").attr("transform", "translate(-6, -6)").attr("xlink:href", function(d2) {
54055         var picon = getIcon(d2);
54056         return picon ? "#" + picon : "";
54057       });
54058       var dgroups = groups.selectAll(".viewfieldgroup").data(function data(d2) {
54059         return zoom >= 18 && getDirections(d2) ? [d2] : [];
54060       }, fastEntityKey);
54061       dgroups.exit().remove();
54062       dgroups = dgroups.enter().insert("g", ".shadow").attr("class", "viewfieldgroup").merge(dgroups);
54063       var viewfields = dgroups.selectAll(".viewfield").data(getDirections, function key(d2) {
54064         return osmEntity.key(d2);
54065       });
54066       viewfields.exit().remove();
54067       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) {
54068         return "rotate(" + d2 + ")";
54069       });
54070     }
54071     function drawTargets(selection2, graph, entities, filter2) {
54072       var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
54073       var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
54074       var getTransform = svgPointTransform(projection2).geojson;
54075       var activeID = context.activeID();
54076       var data = { targets: [], nopes: [] };
54077       entities.forEach(function(node) {
54078         if (activeID === node.id)
54079           return;
54080         var vertexType = svgPassiveVertex(node, graph, activeID);
54081         if (vertexType !== 0) {
54082           data.targets.push({
54083             type: "Feature",
54084             id: node.id,
54085             properties: {
54086               target: true,
54087               entity: node
54088             },
54089             geometry: node.asGeoJSON()
54090           });
54091         } else {
54092           data.nopes.push({
54093             type: "Feature",
54094             id: node.id + "-nope",
54095             properties: {
54096               nope: true,
54097               target: true,
54098               entity: node
54099             },
54100             geometry: node.asGeoJSON()
54101           });
54102         }
54103       });
54104       var targets = selection2.selectAll(".vertex.target-allowed").filter(function(d2) {
54105         return filter2(d2.properties.entity);
54106       }).data(data.targets, function key(d2) {
54107         return d2.id;
54108       });
54109       targets.exit().remove();
54110       targets.enter().append("circle").attr("r", function(d2) {
54111         return _radii[d2.id] || radiuses.shadow[3];
54112       }).merge(targets).attr("class", function(d2) {
54113         return "node vertex target target-allowed " + targetClass + d2.id;
54114       }).attr("transform", getTransform);
54115       var nopes = selection2.selectAll(".vertex.target-nope").filter(function(d2) {
54116         return filter2(d2.properties.entity);
54117       }).data(data.nopes, function key(d2) {
54118         return d2.id;
54119       });
54120       nopes.exit().remove();
54121       nopes.enter().append("circle").attr("r", function(d2) {
54122         return _radii[d2.properties.entity.id] || radiuses.shadow[3];
54123       }).merge(nopes).attr("class", function(d2) {
54124         return "node vertex target target-nope " + nopeClass + d2.id;
54125       }).attr("transform", getTransform);
54126     }
54127     function renderAsVertex(entity, graph, wireframe, zoom) {
54128       var geometry = entity.geometry(graph);
54129       return geometry === "vertex" || geometry === "point" && (wireframe || zoom >= 18 && entity.directions(graph, projection2).length);
54130     }
54131     function isEditedNode(node, base, head) {
54132       var baseNode = base.entities[node.id];
54133       var headNode = head.entities[node.id];
54134       return !headNode || !baseNode || !(0, import_fast_deep_equal8.default)(headNode.tags, baseNode.tags) || !(0, import_fast_deep_equal8.default)(headNode.loc, baseNode.loc);
54135     }
54136     function getSiblingAndChildVertices(ids, graph, wireframe, zoom) {
54137       var results = {};
54138       var seenIds = {};
54139       function addChildVertices(entity) {
54140         if (seenIds[entity.id])
54141           return;
54142         seenIds[entity.id] = true;
54143         var geometry = entity.geometry(graph);
54144         if (!context.features().isHiddenFeature(entity, graph, geometry)) {
54145           var i3;
54146           if (entity.type === "way") {
54147             for (i3 = 0; i3 < entity.nodes.length; i3++) {
54148               var child = graph.hasEntity(entity.nodes[i3]);
54149               if (child) {
54150                 addChildVertices(child);
54151               }
54152             }
54153           } else if (entity.type === "relation") {
54154             for (i3 = 0; i3 < entity.members.length; i3++) {
54155               var member = graph.hasEntity(entity.members[i3].id);
54156               if (member) {
54157                 addChildVertices(member);
54158               }
54159             }
54160           } else if (renderAsVertex(entity, graph, wireframe, zoom)) {
54161             results[entity.id] = entity;
54162           }
54163         }
54164       }
54165       ids.forEach(function(id2) {
54166         var entity = graph.hasEntity(id2);
54167         if (!entity)
54168           return;
54169         if (entity.type === "node") {
54170           if (renderAsVertex(entity, graph, wireframe, zoom)) {
54171             results[entity.id] = entity;
54172             graph.parentWays(entity).forEach(function(entity2) {
54173               addChildVertices(entity2);
54174             });
54175           }
54176         } else {
54177           addChildVertices(entity);
54178         }
54179       });
54180       return results;
54181     }
54182     function drawVertices(selection2, graph, entities, filter2, extent, fullRedraw) {
54183       var wireframe = context.surface().classed("fill-wireframe");
54184       var visualDiff = context.surface().classed("highlight-edited");
54185       var zoom = geoScaleToZoom(projection2.scale());
54186       var mode = context.mode();
54187       var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
54188       var base = context.history().base();
54189       var drawLayer = selection2.selectAll(".layer-osm.points .points-group.vertices");
54190       var touchLayer = selection2.selectAll(".layer-touch.points");
54191       if (fullRedraw) {
54192         _currPersistent = {};
54193         _radii = {};
54194       }
54195       for (var i3 = 0; i3 < entities.length; i3++) {
54196         var entity = entities[i3];
54197         var geometry = entity.geometry(graph);
54198         var keep = false;
54199         if (geometry === "point" && renderAsVertex(entity, graph, wireframe, zoom)) {
54200           _currPersistent[entity.id] = entity;
54201           keep = true;
54202         } else if (geometry === "vertex" && (entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph) || visualDiff && isEditedNode(entity, base, graph))) {
54203           _currPersistent[entity.id] = entity;
54204           keep = true;
54205         }
54206         if (!keep && !fullRedraw) {
54207           delete _currPersistent[entity.id];
54208         }
54209       }
54210       var sets2 = {
54211         persistent: _currPersistent,
54212         // persistent = important vertices (render always)
54213         selected: _currSelected,
54214         // selected + siblings of selected (render always)
54215         hovered: _currHover
54216         // hovered + siblings of hovered (render only in draw modes)
54217       };
54218       var all = Object.assign({}, isMoving ? _currHover : {}, _currSelected, _currPersistent);
54219       var filterRendered = function(d2) {
54220         return d2.id in _currPersistent || d2.id in _currSelected || d2.id in _currHover || filter2(d2);
54221       };
54222       drawLayer.call(draw, graph, currentVisible(all), sets2, filterRendered);
54223       var filterTouch = function(d2) {
54224         return isMoving ? true : filterRendered(d2);
54225       };
54226       touchLayer.call(drawTargets, graph, currentVisible(all), filterTouch);
54227       function currentVisible(which) {
54228         return Object.keys(which).map(graph.hasEntity, graph).filter(function(entity2) {
54229           return entity2 && entity2.intersects(extent, graph);
54230         });
54231       }
54232     }
54233     drawVertices.drawSelected = function(selection2, graph, extent) {
54234       var wireframe = context.surface().classed("fill-wireframe");
54235       var zoom = geoScaleToZoom(projection2.scale());
54236       _prevSelected = _currSelected || {};
54237       if (context.map().isInWideSelection()) {
54238         _currSelected = {};
54239         context.selectedIDs().forEach(function(id2) {
54240           var entity = graph.hasEntity(id2);
54241           if (!entity)
54242             return;
54243           if (entity.type === "node") {
54244             if (renderAsVertex(entity, graph, wireframe, zoom)) {
54245               _currSelected[entity.id] = entity;
54246             }
54247           }
54248         });
54249       } else {
54250         _currSelected = getSiblingAndChildVertices(context.selectedIDs(), graph, wireframe, zoom);
54251       }
54252       var filter2 = function(d2) {
54253         return d2.id in _prevSelected;
54254       };
54255       drawVertices(selection2, graph, Object.values(_prevSelected), filter2, extent, false);
54256     };
54257     drawVertices.drawHover = function(selection2, graph, target, extent) {
54258       if (target === _currHoverTarget)
54259         return;
54260       var wireframe = context.surface().classed("fill-wireframe");
54261       var zoom = geoScaleToZoom(projection2.scale());
54262       _prevHover = _currHover || {};
54263       _currHoverTarget = target;
54264       var entity = target && target.properties && target.properties.entity;
54265       if (entity) {
54266         _currHover = getSiblingAndChildVertices([entity.id], graph, wireframe, zoom);
54267       } else {
54268         _currHover = {};
54269       }
54270       var filter2 = function(d2) {
54271         return d2.id in _prevHover;
54272       };
54273       drawVertices(selection2, graph, Object.values(_prevHover), filter2, extent, false);
54274     };
54275     return drawVertices;
54276   }
54277
54278   // modules/util/bind_once.js
54279   function utilBindOnce(target, type2, listener, capture) {
54280     var typeOnce = type2 + ".once";
54281     function one2() {
54282       target.on(typeOnce, null);
54283       listener.apply(this, arguments);
54284     }
54285     target.on(typeOnce, one2, capture);
54286     return this;
54287   }
54288
54289   // modules/util/zoom_pan.js
54290   function defaultFilter3(d3_event) {
54291     return !d3_event.ctrlKey && !d3_event.button;
54292   }
54293   function defaultExtent2() {
54294     var e3 = this;
54295     if (e3 instanceof SVGElement) {
54296       e3 = e3.ownerSVGElement || e3;
54297       if (e3.hasAttribute("viewBox")) {
54298         e3 = e3.viewBox.baseVal;
54299         return [[e3.x, e3.y], [e3.x + e3.width, e3.y + e3.height]];
54300       }
54301       return [[0, 0], [e3.width.baseVal.value, e3.height.baseVal.value]];
54302     }
54303     return [[0, 0], [e3.clientWidth, e3.clientHeight]];
54304   }
54305   function defaultWheelDelta2(d3_event) {
54306     return -d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.05 : d3_event.deltaMode ? 1 : 2e-3);
54307   }
54308   function defaultConstrain2(transform2, extent, translateExtent) {
54309     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];
54310     return transform2.translate(
54311       dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
54312       dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
54313     );
54314   }
54315   function utilZoomPan() {
54316     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;
54317     function zoom(selection2) {
54318       selection2.on("pointerdown.zoom", pointerdown).on("wheel.zoom", wheeled).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
54319       select_default2(window).on("pointermove.zoompan", pointermove).on("pointerup.zoompan pointercancel.zoompan", pointerup);
54320     }
54321     zoom.transform = function(collection, transform2, point2) {
54322       var selection2 = collection.selection ? collection.selection() : collection;
54323       if (collection !== selection2) {
54324         schedule(collection, transform2, point2);
54325       } else {
54326         selection2.interrupt().each(function() {
54327           gesture(this, arguments).start(null).zoom(null, null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(null);
54328         });
54329       }
54330     };
54331     zoom.scaleBy = function(selection2, k2, p2) {
54332       zoom.scaleTo(selection2, function() {
54333         var k0 = _transform.k, k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
54334         return k0 * k1;
54335       }, p2);
54336     };
54337     zoom.scaleTo = function(selection2, k2, p2) {
54338       zoom.transform(selection2, function() {
54339         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;
54340         return constrain(translate(scale(t0, k1), p02, p1), e3, translateExtent);
54341       }, p2);
54342     };
54343     zoom.translateBy = function(selection2, x2, y2) {
54344       zoom.transform(selection2, function() {
54345         return constrain(_transform.translate(
54346           typeof x2 === "function" ? x2.apply(this, arguments) : x2,
54347           typeof y2 === "function" ? y2.apply(this, arguments) : y2
54348         ), extent.apply(this, arguments), translateExtent);
54349       });
54350     };
54351     zoom.translateTo = function(selection2, x2, y2, p2) {
54352       zoom.transform(selection2, function() {
54353         var e3 = extent.apply(this, arguments), t2 = _transform, p02 = !p2 ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
54354         return constrain(identity2.translate(p02[0], p02[1]).scale(t2.k).translate(
54355           typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
54356           typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
54357         ), e3, translateExtent);
54358       }, p2);
54359     };
54360     function scale(transform2, k2) {
54361       k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2));
54362       return k2 === transform2.k ? transform2 : new Transform(k2, transform2.x, transform2.y);
54363     }
54364     function translate(transform2, p02, p1) {
54365       var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k;
54366       return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
54367     }
54368     function centroid(extent2) {
54369       return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
54370     }
54371     function schedule(transition2, transform2, point2) {
54372       transition2.on("start.zoom", function() {
54373         gesture(this, arguments).start(null);
54374       }).on("interrupt.zoom end.zoom", function() {
54375         gesture(this, arguments).end(null);
54376       }).tween("zoom", function() {
54377         var that = this, args = arguments, g3 = gesture(that, args), e3 = extent.apply(that, args), p2 = !point2 ? centroid(e3) : typeof point2 === "function" ? point2.apply(that, args) : point2, w2 = Math.max(e3[1][0] - e3[0][0], e3[1][1] - e3[0][1]), a2 = _transform, b2 = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i3 = interpolate(a2.invert(p2).concat(w2 / a2.k), b2.invert(p2).concat(w2 / b2.k));
54378         return function(t2) {
54379           if (t2 === 1) {
54380             t2 = b2;
54381           } else {
54382             var l2 = i3(t2);
54383             var k2 = w2 / l2[2];
54384             t2 = new Transform(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
54385           }
54386           g3.zoom(null, null, t2);
54387         };
54388       });
54389     }
54390     function gesture(that, args, clean2) {
54391       return !clean2 && _activeGesture || new Gesture(that, args);
54392     }
54393     function Gesture(that, args) {
54394       this.that = that;
54395       this.args = args;
54396       this.active = 0;
54397       this.extent = extent.apply(that, args);
54398     }
54399     Gesture.prototype = {
54400       start: function(d3_event) {
54401         if (++this.active === 1) {
54402           _activeGesture = this;
54403           dispatch14.call("start", this, d3_event);
54404         }
54405         return this;
54406       },
54407       zoom: function(d3_event, key, transform2) {
54408         if (this.mouse && key !== "mouse")
54409           this.mouse[1] = transform2.invert(this.mouse[0]);
54410         if (this.pointer0 && key !== "touch")
54411           this.pointer0[1] = transform2.invert(this.pointer0[0]);
54412         if (this.pointer1 && key !== "touch")
54413           this.pointer1[1] = transform2.invert(this.pointer1[0]);
54414         _transform = transform2;
54415         dispatch14.call("zoom", this, d3_event, key, transform2);
54416         return this;
54417       },
54418       end: function(d3_event) {
54419         if (--this.active === 0) {
54420           _activeGesture = null;
54421           dispatch14.call("end", this, d3_event);
54422         }
54423         return this;
54424       }
54425     };
54426     function wheeled(d3_event) {
54427       if (!filter2.apply(this, arguments))
54428         return;
54429       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);
54430       if (g3.wheel) {
54431         if (g3.mouse[0][0] !== p2[0] || g3.mouse[0][1] !== p2[1]) {
54432           g3.mouse[1] = t2.invert(g3.mouse[0] = p2);
54433         }
54434         clearTimeout(g3.wheel);
54435       } else {
54436         g3.mouse = [p2, t2.invert(p2)];
54437         interrupt_default(this);
54438         g3.start(d3_event);
54439       }
54440       d3_event.preventDefault();
54441       d3_event.stopImmediatePropagation();
54442       g3.wheel = setTimeout(wheelidled, _wheelDelay);
54443       g3.zoom(d3_event, "mouse", constrain(translate(scale(t2, k2), g3.mouse[0], g3.mouse[1]), g3.extent, translateExtent));
54444       function wheelidled() {
54445         g3.wheel = null;
54446         g3.end(d3_event);
54447       }
54448     }
54449     var _downPointerIDs = /* @__PURE__ */ new Set();
54450     var _pointerLocGetter;
54451     function pointerdown(d3_event) {
54452       _downPointerIDs.add(d3_event.pointerId);
54453       if (!filter2.apply(this, arguments))
54454         return;
54455       var g3 = gesture(this, arguments, _downPointerIDs.size === 1);
54456       var started;
54457       d3_event.stopImmediatePropagation();
54458       _pointerLocGetter = utilFastMouse(this);
54459       var loc = _pointerLocGetter(d3_event);
54460       var p2 = [loc, _transform.invert(loc), d3_event.pointerId];
54461       if (!g3.pointer0) {
54462         g3.pointer0 = p2;
54463         started = true;
54464       } else if (!g3.pointer1 && g3.pointer0[2] !== p2[2]) {
54465         g3.pointer1 = p2;
54466       }
54467       if (started) {
54468         interrupt_default(this);
54469         g3.start(d3_event);
54470       }
54471     }
54472     function pointermove(d3_event) {
54473       if (!_downPointerIDs.has(d3_event.pointerId))
54474         return;
54475       if (!_activeGesture || !_pointerLocGetter)
54476         return;
54477       var g3 = gesture(this, arguments);
54478       var isPointer0 = g3.pointer0 && g3.pointer0[2] === d3_event.pointerId;
54479       var isPointer1 = !isPointer0 && g3.pointer1 && g3.pointer1[2] === d3_event.pointerId;
54480       if ((isPointer0 || isPointer1) && "buttons" in d3_event && !d3_event.buttons) {
54481         if (g3.pointer0)
54482           _downPointerIDs.delete(g3.pointer0[2]);
54483         if (g3.pointer1)
54484           _downPointerIDs.delete(g3.pointer1[2]);
54485         g3.end(d3_event);
54486         return;
54487       }
54488       d3_event.preventDefault();
54489       d3_event.stopImmediatePropagation();
54490       var loc = _pointerLocGetter(d3_event);
54491       var t2, p2, l2;
54492       if (isPointer0)
54493         g3.pointer0[0] = loc;
54494       else if (isPointer1)
54495         g3.pointer1[0] = loc;
54496       t2 = _transform;
54497       if (g3.pointer1) {
54498         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;
54499         t2 = scale(t2, Math.sqrt(dp / dl));
54500         p2 = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
54501         l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
54502       } else if (g3.pointer0) {
54503         p2 = g3.pointer0[0];
54504         l2 = g3.pointer0[1];
54505       } else {
54506         return;
54507       }
54508       g3.zoom(d3_event, "touch", constrain(translate(t2, p2, l2), g3.extent, translateExtent));
54509     }
54510     function pointerup(d3_event) {
54511       if (!_downPointerIDs.has(d3_event.pointerId))
54512         return;
54513       _downPointerIDs.delete(d3_event.pointerId);
54514       if (!_activeGesture)
54515         return;
54516       var g3 = gesture(this, arguments);
54517       d3_event.stopImmediatePropagation();
54518       if (g3.pointer0 && g3.pointer0[2] === d3_event.pointerId)
54519         delete g3.pointer0;
54520       else if (g3.pointer1 && g3.pointer1[2] === d3_event.pointerId)
54521         delete g3.pointer1;
54522       if (g3.pointer1 && !g3.pointer0) {
54523         g3.pointer0 = g3.pointer1;
54524         delete g3.pointer1;
54525       }
54526       if (g3.pointer0) {
54527         g3.pointer0[1] = _transform.invert(g3.pointer0[0]);
54528       } else {
54529         g3.end(d3_event);
54530       }
54531     }
54532     zoom.wheelDelta = function(_2) {
54533       return arguments.length ? (wheelDelta = utilFunctor(+_2), zoom) : wheelDelta;
54534     };
54535     zoom.filter = function(_2) {
54536       return arguments.length ? (filter2 = utilFunctor(!!_2), zoom) : filter2;
54537     };
54538     zoom.extent = function(_2) {
54539       return arguments.length ? (extent = utilFunctor([[+_2[0][0], +_2[0][1]], [+_2[1][0], +_2[1][1]]]), zoom) : extent;
54540     };
54541     zoom.scaleExtent = function(_2) {
54542       return arguments.length ? (scaleExtent[0] = +_2[0], scaleExtent[1] = +_2[1], zoom) : [scaleExtent[0], scaleExtent[1]];
54543     };
54544     zoom.translateExtent = function(_2) {
54545       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]]];
54546     };
54547     zoom.constrain = function(_2) {
54548       return arguments.length ? (constrain = _2, zoom) : constrain;
54549     };
54550     zoom.interpolate = function(_2) {
54551       return arguments.length ? (interpolate = _2, zoom) : interpolate;
54552     };
54553     zoom._transform = function(_2) {
54554       return arguments.length ? (_transform = _2, zoom) : _transform;
54555     };
54556     return utilRebind(zoom, dispatch14, "on");
54557   }
54558
54559   // modules/util/double_up.js
54560   function utilDoubleUp() {
54561     var dispatch14 = dispatch_default("doubleUp");
54562     var _maxTimespan = 500;
54563     var _maxDistance = 20;
54564     var _pointer;
54565     function pointerIsValidFor(loc) {
54566       return (/* @__PURE__ */ new Date()).getTime() - _pointer.startTime <= _maxTimespan && // all pointer events must occur within a small distance of the first pointerdown
54567       geoVecLength(_pointer.startLoc, loc) <= _maxDistance;
54568     }
54569     function pointerdown(d3_event) {
54570       if (d3_event.ctrlKey || d3_event.button === 2)
54571         return;
54572       var loc = [d3_event.clientX, d3_event.clientY];
54573       if (_pointer && !pointerIsValidFor(loc)) {
54574         _pointer = void 0;
54575       }
54576       if (!_pointer) {
54577         _pointer = {
54578           startLoc: loc,
54579           startTime: (/* @__PURE__ */ new Date()).getTime(),
54580           upCount: 0,
54581           pointerId: d3_event.pointerId
54582         };
54583       } else {
54584         _pointer.pointerId = d3_event.pointerId;
54585       }
54586     }
54587     function pointerup(d3_event) {
54588       if (d3_event.ctrlKey || d3_event.button === 2)
54589         return;
54590       if (!_pointer || _pointer.pointerId !== d3_event.pointerId)
54591         return;
54592       _pointer.upCount += 1;
54593       if (_pointer.upCount === 2) {
54594         var loc = [d3_event.clientX, d3_event.clientY];
54595         if (pointerIsValidFor(loc)) {
54596           var locInThis = utilFastMouse(this)(d3_event);
54597           dispatch14.call("doubleUp", this, d3_event, locInThis);
54598         }
54599         _pointer = void 0;
54600       }
54601     }
54602     function doubleUp(selection2) {
54603       if ("PointerEvent" in window) {
54604         selection2.on("pointerdown.doubleUp", pointerdown).on("pointerup.doubleUp", pointerup);
54605       } else {
54606         selection2.on("dblclick.doubleUp", function(d3_event) {
54607           dispatch14.call("doubleUp", this, d3_event, utilFastMouse(this)(d3_event));
54608         });
54609       }
54610     }
54611     doubleUp.off = function(selection2) {
54612       selection2.on("pointerdown.doubleUp", null).on("pointerup.doubleUp", null).on("dblclick.doubleUp", null);
54613     };
54614     return utilRebind(doubleUp, dispatch14, "on");
54615   }
54616
54617   // modules/renderer/map.js
54618   var TILESIZE = 256;
54619   var minZoom2 = 2;
54620   var maxZoom = 24;
54621   var kMin = geoZoomToScale(minZoom2, TILESIZE);
54622   var kMax = geoZoomToScale(maxZoom, TILESIZE);
54623   function clamp(num, min3, max3) {
54624     return Math.max(min3, Math.min(num, max3));
54625   }
54626   function rendererMap(context) {
54627     var dispatch14 = dispatch_default(
54628       "move",
54629       "drawn",
54630       "crossEditableZoom",
54631       "hitMinZoom",
54632       "changeHighlighting",
54633       "changeAreaFill"
54634     );
54635     var projection2 = context.projection;
54636     var curtainProjection = context.curtainProjection;
54637     var drawLayers;
54638     var drawPoints;
54639     var drawVertices;
54640     var drawLines;
54641     var drawAreas;
54642     var drawMidpoints;
54643     var drawLabels;
54644     var _selection = select_default2(null);
54645     var supersurface = select_default2(null);
54646     var wrapper = select_default2(null);
54647     var surface = select_default2(null);
54648     var _dimensions = [1, 1];
54649     var _dblClickZoomEnabled = true;
54650     var _redrawEnabled = true;
54651     var _gestureTransformStart;
54652     var _transformStart = projection2.transform();
54653     var _transformLast;
54654     var _isTransformed = false;
54655     var _minzoom = 0;
54656     var _getMouseCoords;
54657     var _lastPointerEvent;
54658     var _lastWithinEditableZoom;
54659     var _pointerDown = false;
54660     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
54661     var _zoomerPannerFunction = "PointerEvent" in window ? utilZoomPan : zoom_default2;
54662     var _zoomerPanner = _zoomerPannerFunction().scaleExtent([kMin, kMax]).interpolate(value_default).filter(zoomEventFilter).on("zoom.map", zoomPan2).on("start.map", function(d3_event) {
54663       _pointerDown = d3_event && (d3_event.type === "pointerdown" || d3_event.sourceEvent && d3_event.sourceEvent.type === "pointerdown");
54664     }).on("end.map", function() {
54665       _pointerDown = false;
54666     });
54667     var _doubleUpHandler = utilDoubleUp();
54668     var scheduleRedraw = throttle_default(redraw, 750);
54669     function cancelPendingRedraw() {
54670       scheduleRedraw.cancel();
54671     }
54672     function map2(selection2) {
54673       _selection = selection2;
54674       context.on("change.map", immediateRedraw);
54675       var osm = context.connection();
54676       if (osm) {
54677         osm.on("change.map", immediateRedraw);
54678       }
54679       function didUndoOrRedo(targetTransform) {
54680         var mode = context.mode().id;
54681         if (mode !== "browse" && mode !== "select")
54682           return;
54683         if (targetTransform) {
54684           map2.transformEase(targetTransform);
54685         }
54686       }
54687       context.history().on("merge.map", function() {
54688         scheduleRedraw();
54689       }).on("change.map", immediateRedraw).on("undone.map", function(stack, fromStack) {
54690         didUndoOrRedo(fromStack.transform);
54691       }).on("redone.map", function(stack) {
54692         didUndoOrRedo(stack.transform);
54693       });
54694       context.background().on("change.map", immediateRedraw);
54695       context.features().on("redraw.map", immediateRedraw);
54696       drawLayers.on("change.map", function() {
54697         context.background().updateImagery();
54698         immediateRedraw();
54699       });
54700       selection2.on("wheel.map mousewheel.map", function(d3_event) {
54701         d3_event.preventDefault();
54702       }).call(_zoomerPanner).call(_zoomerPanner.transform, projection2.transform()).on("dblclick.zoom", null);
54703       map2.supersurface = supersurface = selection2.append("div").attr("class", "supersurface").call(utilSetTransform, 0, 0);
54704       wrapper = supersurface.append("div").attr("class", "layer layer-data");
54705       map2.surface = surface = wrapper.call(drawLayers).selectAll(".surface");
54706       surface.call(drawLabels.observe).call(_doubleUpHandler).on(_pointerPrefix + "down.zoom", function(d3_event) {
54707         _lastPointerEvent = d3_event;
54708         if (d3_event.button === 2) {
54709           d3_event.stopPropagation();
54710         }
54711       }, true).on(_pointerPrefix + "up.zoom", function(d3_event) {
54712         _lastPointerEvent = d3_event;
54713         if (resetTransform()) {
54714           immediateRedraw();
54715         }
54716       }).on(_pointerPrefix + "move.map", function(d3_event) {
54717         _lastPointerEvent = d3_event;
54718       }).on(_pointerPrefix + "over.vertices", function(d3_event) {
54719         if (map2.editableDataEnabled() && !_isTransformed) {
54720           var hover = d3_event.target.__data__;
54721           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
54722           dispatch14.call("drawn", this, { full: false });
54723         }
54724       }).on(_pointerPrefix + "out.vertices", function(d3_event) {
54725         if (map2.editableDataEnabled() && !_isTransformed) {
54726           var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
54727           surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
54728           dispatch14.call("drawn", this, { full: false });
54729         }
54730       });
54731       var detected = utilDetect();
54732       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
54733       // but we only need to do this on desktop Safari anyway. – #7694
54734       !detected.isMobileWebKit) {
54735         surface.on("gesturestart.surface", function(d3_event) {
54736           d3_event.preventDefault();
54737           _gestureTransformStart = projection2.transform();
54738         }).on("gesturechange.surface", gestureChange);
54739       }
54740       updateAreaFill();
54741       _doubleUpHandler.on("doubleUp.map", function(d3_event, p02) {
54742         if (!_dblClickZoomEnabled)
54743           return;
54744         if (typeof d3_event.target.__data__ === "object" && // or area fills
54745         !select_default2(d3_event.target).classed("fill"))
54746           return;
54747         var zoomOut2 = d3_event.shiftKey;
54748         var t2 = projection2.transform();
54749         var p1 = t2.invert(p02);
54750         t2 = t2.scale(zoomOut2 ? 0.5 : 2);
54751         t2.x = p02[0] - p1[0] * t2.k;
54752         t2.y = p02[1] - p1[1] * t2.k;
54753         map2.transformEase(t2);
54754       });
54755       context.on("enter.map", function() {
54756         if (!map2.editableDataEnabled(
54757           true
54758           /* skip zoom check */
54759         ))
54760           return;
54761         if (_isTransformed)
54762           return;
54763         var graph = context.graph();
54764         var selectedAndParents = {};
54765         context.selectedIDs().forEach(function(id2) {
54766           var entity = graph.hasEntity(id2);
54767           if (entity) {
54768             selectedAndParents[entity.id] = entity;
54769             if (entity.type === "node") {
54770               graph.parentWays(entity).forEach(function(parent) {
54771                 selectedAndParents[parent.id] = parent;
54772               });
54773             }
54774           }
54775         });
54776         var data = Object.values(selectedAndParents);
54777         var filter2 = function(d2) {
54778           return d2.id in selectedAndParents;
54779         };
54780         data = context.features().filter(data, graph);
54781         surface.call(drawVertices.drawSelected, graph, map2.extent()).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent());
54782         dispatch14.call("drawn", this, { full: false });
54783         scheduleRedraw();
54784       });
54785       map2.dimensions(utilGetDimensions(selection2));
54786     }
54787     function zoomEventFilter(d3_event) {
54788       if (d3_event.type === "mousedown") {
54789         var hasOrphan = false;
54790         var listeners = window.__on;
54791         for (var i3 = 0; i3 < listeners.length; i3++) {
54792           var listener = listeners[i3];
54793           if (listener.name === "zoom" && listener.type === "mouseup") {
54794             hasOrphan = true;
54795             break;
54796           }
54797         }
54798         if (hasOrphan) {
54799           var event = window.CustomEvent;
54800           if (event) {
54801             event = new event("mouseup");
54802           } else {
54803             event = window.document.createEvent("Event");
54804             event.initEvent("mouseup", false, false);
54805           }
54806           event.view = window;
54807           window.dispatchEvent(event);
54808         }
54809       }
54810       return d3_event.button !== 2;
54811     }
54812     function pxCenter() {
54813       return [_dimensions[0] / 2, _dimensions[1] / 2];
54814     }
54815     function drawEditable(difference, extent) {
54816       var mode = context.mode();
54817       var graph = context.graph();
54818       var features = context.features();
54819       var all = context.history().intersects(map2.extent());
54820       var fullRedraw = false;
54821       var data;
54822       var set3;
54823       var filter2;
54824       var applyFeatureLayerFilters = true;
54825       if (map2.isInWideSelection()) {
54826         data = [];
54827         utilEntityAndDeepMemberIDs(mode.selectedIDs(), context.graph()).forEach(function(id2) {
54828           var entity = context.hasEntity(id2);
54829           if (entity)
54830             data.push(entity);
54831         });
54832         fullRedraw = true;
54833         filter2 = utilFunctor(true);
54834         applyFeatureLayerFilters = false;
54835       } else if (difference) {
54836         var complete = difference.complete(map2.extent());
54837         data = Object.values(complete).filter(Boolean);
54838         set3 = new Set(Object.keys(complete));
54839         filter2 = function(d2) {
54840           return set3.has(d2.id);
54841         };
54842         features.clear(data);
54843       } else {
54844         if (features.gatherStats(all, graph, _dimensions)) {
54845           extent = void 0;
54846         }
54847         if (extent) {
54848           data = context.history().intersects(map2.extent().intersection(extent));
54849           set3 = new Set(data.map(function(entity) {
54850             return entity.id;
54851           }));
54852           filter2 = function(d2) {
54853             return set3.has(d2.id);
54854           };
54855         } else {
54856           data = all;
54857           fullRedraw = true;
54858           filter2 = utilFunctor(true);
54859         }
54860       }
54861       if (applyFeatureLayerFilters) {
54862         data = features.filter(data, graph);
54863       } else {
54864         context.features().resetStats();
54865       }
54866       if (mode && mode.id === "select") {
54867         surface.call(drawVertices.drawSelected, graph, map2.extent());
54868       }
54869       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);
54870       dispatch14.call("drawn", this, { full: true });
54871     }
54872     map2.init = function() {
54873       drawLayers = svgLayers(projection2, context);
54874       drawPoints = svgPoints(projection2, context);
54875       drawVertices = svgVertices(projection2, context);
54876       drawLines = svgLines(projection2, context);
54877       drawAreas = svgAreas(projection2, context);
54878       drawMidpoints = svgMidpoints(projection2, context);
54879       drawLabels = svgLabels(projection2, context);
54880     };
54881     function editOff() {
54882       context.features().resetStats();
54883       surface.selectAll(".layer-osm *").remove();
54884       surface.selectAll(".layer-touch:not(.markers) *").remove();
54885       var allowed = {
54886         "browse": true,
54887         "save": true,
54888         "select-note": true,
54889         "select-data": true,
54890         "select-error": true
54891       };
54892       var mode = context.mode();
54893       if (mode && !allowed[mode.id]) {
54894         context.enter(modeBrowse(context));
54895       }
54896       dispatch14.call("drawn", this, { full: true });
54897     }
54898     function gestureChange(d3_event) {
54899       var e3 = d3_event;
54900       e3.preventDefault();
54901       var props = {
54902         deltaMode: 0,
54903         // dummy values to ignore in zoomPan
54904         deltaY: 1,
54905         // dummy values to ignore in zoomPan
54906         clientX: e3.clientX,
54907         clientY: e3.clientY,
54908         screenX: e3.screenX,
54909         screenY: e3.screenY,
54910         x: e3.x,
54911         y: e3.y
54912       };
54913       var e22 = new WheelEvent("wheel", props);
54914       e22._scale = e3.scale;
54915       e22._rotation = e3.rotation;
54916       _selection.node().dispatchEvent(e22);
54917     }
54918     function zoomPan2(event, key, transform2) {
54919       var source = event && event.sourceEvent || event;
54920       var eventTransform = transform2 || event && event.transform;
54921       var x2 = eventTransform.x;
54922       var y2 = eventTransform.y;
54923       var k2 = eventTransform.k;
54924       if (source && source.type === "wheel") {
54925         if (_pointerDown)
54926           return;
54927         var detected = utilDetect();
54928         var dX = source.deltaX;
54929         var dY = source.deltaY;
54930         var x22 = x2;
54931         var y22 = y2;
54932         var k22 = k2;
54933         var t0, p02, p1;
54934         if (source.deltaMode === 1) {
54935           var lines = Math.abs(source.deltaY);
54936           var sign2 = source.deltaY > 0 ? 1 : -1;
54937           dY = sign2 * clamp(
54938             Math.exp((lines - 1) * 0.75) * 4.000244140625,
54939             4.000244140625,
54940             // min
54941             350.000244140625
54942             // max
54943           );
54944           if (detected.os !== "mac") {
54945             dY *= 5;
54946           }
54947           t0 = _isTransformed ? _transformLast : _transformStart;
54948           p02 = _getMouseCoords(source);
54949           p1 = t0.invert(p02);
54950           k22 = t0.k * Math.pow(2, -dY / 500);
54951           k22 = clamp(k22, kMin, kMax);
54952           x22 = p02[0] - p1[0] * k22;
54953           y22 = p02[1] - p1[1] * k22;
54954         } else if (source._scale) {
54955           t0 = _gestureTransformStart;
54956           p02 = _getMouseCoords(source);
54957           p1 = t0.invert(p02);
54958           k22 = t0.k * source._scale;
54959           k22 = clamp(k22, kMin, kMax);
54960           x22 = p02[0] - p1[0] * k22;
54961           y22 = p02[1] - p1[1] * k22;
54962         } else if (source.ctrlKey && !isInteger(dY)) {
54963           dY *= 6;
54964           t0 = _isTransformed ? _transformLast : _transformStart;
54965           p02 = _getMouseCoords(source);
54966           p1 = t0.invert(p02);
54967           k22 = t0.k * Math.pow(2, -dY / 500);
54968           k22 = clamp(k22, kMin, kMax);
54969           x22 = p02[0] - p1[0] * k22;
54970           y22 = p02[1] - p1[1] * k22;
54971         } else if ((source.altKey || source.shiftKey) && isInteger(dY)) {
54972           t0 = _isTransformed ? _transformLast : _transformStart;
54973           p02 = _getMouseCoords(source);
54974           p1 = t0.invert(p02);
54975           k22 = t0.k * Math.pow(2, -dY / 500);
54976           k22 = clamp(k22, kMin, kMax);
54977           x22 = p02[0] - p1[0] * k22;
54978           y22 = p02[1] - p1[1] * k22;
54979         } else if (detected.os === "mac" && detected.browser !== "Firefox" && !source.ctrlKey && isInteger(dX) && isInteger(dY)) {
54980           p1 = projection2.translate();
54981           x22 = p1[0] - dX;
54982           y22 = p1[1] - dY;
54983           k22 = projection2.scale();
54984           k22 = clamp(k22, kMin, kMax);
54985         }
54986         if (x22 !== x2 || y22 !== y2 || k22 !== k2) {
54987           x2 = x22;
54988           y2 = y22;
54989           k2 = k22;
54990           eventTransform = identity2.translate(x22, y22).scale(k22);
54991           if (_zoomerPanner._transform) {
54992             _zoomerPanner._transform(eventTransform);
54993           } else {
54994             _selection.node().__zoom = eventTransform;
54995           }
54996         }
54997       }
54998       if (_transformStart.x === x2 && _transformStart.y === y2 && _transformStart.k === k2) {
54999         return;
55000       }
55001       if (geoScaleToZoom(k2, TILESIZE) < _minzoom) {
55002         surface.interrupt();
55003         dispatch14.call("hitMinZoom", this, map2);
55004         setCenterZoom(map2.center(), context.minEditableZoom(), 0, true);
55005         scheduleRedraw();
55006         dispatch14.call("move", this, map2);
55007         return;
55008       }
55009       projection2.transform(eventTransform);
55010       var withinEditableZoom = map2.withinEditableZoom();
55011       if (_lastWithinEditableZoom !== withinEditableZoom) {
55012         if (_lastWithinEditableZoom !== void 0) {
55013           dispatch14.call("crossEditableZoom", this, withinEditableZoom);
55014         }
55015         _lastWithinEditableZoom = withinEditableZoom;
55016       }
55017       var scale = k2 / _transformStart.k;
55018       var tX = (x2 / scale - _transformStart.x) * scale;
55019       var tY = (y2 / scale - _transformStart.y) * scale;
55020       if (context.inIntro()) {
55021         curtainProjection.transform({
55022           x: x2 - tX,
55023           y: y2 - tY,
55024           k: k2
55025         });
55026       }
55027       if (source) {
55028         _lastPointerEvent = event;
55029       }
55030       _isTransformed = true;
55031       _transformLast = eventTransform;
55032       utilSetTransform(supersurface, tX, tY, scale);
55033       scheduleRedraw();
55034       dispatch14.call("move", this, map2);
55035       function isInteger(val) {
55036         return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
55037       }
55038     }
55039     function resetTransform() {
55040       if (!_isTransformed)
55041         return false;
55042       utilSetTransform(supersurface, 0, 0);
55043       _isTransformed = false;
55044       if (context.inIntro()) {
55045         curtainProjection.transform(projection2.transform());
55046       }
55047       return true;
55048     }
55049     function redraw(difference, extent) {
55050       if (surface.empty() || !_redrawEnabled)
55051         return;
55052       if (resetTransform()) {
55053         difference = extent = void 0;
55054       }
55055       var zoom = map2.zoom();
55056       var z2 = String(~~zoom);
55057       if (surface.attr("data-zoom") !== z2) {
55058         surface.attr("data-zoom", z2);
55059       }
55060       var lat = map2.center()[1];
55061       var lowzoom = linear3().domain([-60, 0, 60]).range([17, 18.5, 17]).clamp(true);
55062       surface.classed("low-zoom", zoom <= lowzoom(lat));
55063       if (!difference) {
55064         supersurface.call(context.background());
55065         wrapper.call(drawLayers);
55066       }
55067       if (map2.editableDataEnabled() || map2.isInWideSelection()) {
55068         context.loadTiles(projection2);
55069         drawEditable(difference, extent);
55070       } else {
55071         editOff();
55072       }
55073       _transformStart = projection2.transform();
55074       return map2;
55075     }
55076     var immediateRedraw = function(difference, extent) {
55077       if (!difference && !extent)
55078         cancelPendingRedraw();
55079       redraw(difference, extent);
55080     };
55081     map2.lastPointerEvent = function() {
55082       return _lastPointerEvent;
55083     };
55084     map2.mouse = function(d3_event) {
55085       var event = d3_event || _lastPointerEvent;
55086       if (event) {
55087         var s2;
55088         while (s2 = event.sourceEvent) {
55089           event = s2;
55090         }
55091         return _getMouseCoords(event);
55092       }
55093       return null;
55094     };
55095     map2.mouseCoordinates = function() {
55096       var coord2 = map2.mouse() || pxCenter();
55097       return projection2.invert(coord2);
55098     };
55099     map2.dblclickZoomEnable = function(val) {
55100       if (!arguments.length)
55101         return _dblClickZoomEnabled;
55102       _dblClickZoomEnabled = val;
55103       return map2;
55104     };
55105     map2.redrawEnable = function(val) {
55106       if (!arguments.length)
55107         return _redrawEnabled;
55108       _redrawEnabled = val;
55109       return map2;
55110     };
55111     map2.isTransformed = function() {
55112       return _isTransformed;
55113     };
55114     function setTransform(t2, duration, force) {
55115       var t3 = projection2.transform();
55116       if (!force && t2.k === t3.k && t2.x === t3.x && t2.y === t3.y)
55117         return false;
55118       if (duration) {
55119         _selection.transition().duration(duration).on("start", function() {
55120           map2.startEase();
55121         }).call(_zoomerPanner.transform, identity2.translate(t2.x, t2.y).scale(t2.k));
55122       } else {
55123         projection2.transform(t2);
55124         _transformStart = t2;
55125         _selection.call(_zoomerPanner.transform, _transformStart);
55126       }
55127       return true;
55128     }
55129     function setCenterZoom(loc2, z2, duration, force) {
55130       var c2 = map2.center();
55131       var z3 = map2.zoom();
55132       if (loc2[0] === c2[0] && loc2[1] === c2[1] && z2 === z3 && !force)
55133         return false;
55134       var proj = geoRawMercator().transform(projection2.transform());
55135       var k2 = clamp(geoZoomToScale(z2, TILESIZE), kMin, kMax);
55136       proj.scale(k2);
55137       var t2 = proj.translate();
55138       var point2 = proj(loc2);
55139       var center = pxCenter();
55140       t2[0] += center[0] - point2[0];
55141       t2[1] += center[1] - point2[1];
55142       return setTransform(identity2.translate(t2[0], t2[1]).scale(k2), duration, force);
55143     }
55144     map2.pan = function(delta, duration) {
55145       var t2 = projection2.translate();
55146       var k2 = projection2.scale();
55147       t2[0] += delta[0];
55148       t2[1] += delta[1];
55149       if (duration) {
55150         _selection.transition().duration(duration).on("start", function() {
55151           map2.startEase();
55152         }).call(_zoomerPanner.transform, identity2.translate(t2[0], t2[1]).scale(k2));
55153       } else {
55154         projection2.translate(t2);
55155         _transformStart = projection2.transform();
55156         _selection.call(_zoomerPanner.transform, _transformStart);
55157         dispatch14.call("move", this, map2);
55158         immediateRedraw();
55159       }
55160       return map2;
55161     };
55162     map2.dimensions = function(val) {
55163       if (!arguments.length)
55164         return _dimensions;
55165       _dimensions = val;
55166       drawLayers.dimensions(_dimensions);
55167       context.background().dimensions(_dimensions);
55168       projection2.clipExtent([[0, 0], _dimensions]);
55169       _getMouseCoords = utilFastMouse(supersurface.node());
55170       scheduleRedraw();
55171       return map2;
55172     };
55173     function zoomIn(delta) {
55174       setCenterZoom(map2.center(), ~~map2.zoom() + delta, 250, true);
55175     }
55176     function zoomOut(delta) {
55177       setCenterZoom(map2.center(), ~~map2.zoom() - delta, 250, true);
55178     }
55179     map2.zoomIn = function() {
55180       zoomIn(1);
55181     };
55182     map2.zoomInFurther = function() {
55183       zoomIn(4);
55184     };
55185     map2.canZoomIn = function() {
55186       return map2.zoom() < maxZoom;
55187     };
55188     map2.zoomOut = function() {
55189       zoomOut(1);
55190     };
55191     map2.zoomOutFurther = function() {
55192       zoomOut(4);
55193     };
55194     map2.canZoomOut = function() {
55195       return map2.zoom() > minZoom2;
55196     };
55197     map2.center = function(loc2) {
55198       if (!arguments.length) {
55199         return projection2.invert(pxCenter());
55200       }
55201       if (setCenterZoom(loc2, map2.zoom())) {
55202         dispatch14.call("move", this, map2);
55203       }
55204       scheduleRedraw();
55205       return map2;
55206     };
55207     map2.unobscuredCenterZoomEase = function(loc, zoom) {
55208       var offset = map2.unobscuredOffsetPx();
55209       var proj = geoRawMercator().transform(projection2.transform());
55210       proj.scale(geoZoomToScale(zoom, TILESIZE));
55211       var locPx = proj(loc);
55212       var offsetLocPx = [locPx[0] + offset[0], locPx[1] + offset[1]];
55213       var offsetLoc = proj.invert(offsetLocPx);
55214       map2.centerZoomEase(offsetLoc, zoom);
55215     };
55216     map2.unobscuredOffsetPx = function() {
55217       var openPane = context.container().select(".map-panes .map-pane.shown");
55218       if (!openPane.empty()) {
55219         return [openPane.node().offsetWidth / 2, 0];
55220       }
55221       return [0, 0];
55222     };
55223     map2.zoom = function(z2) {
55224       if (!arguments.length) {
55225         return Math.max(geoScaleToZoom(projection2.scale(), TILESIZE), 0);
55226       }
55227       if (z2 < _minzoom) {
55228         surface.interrupt();
55229         dispatch14.call("hitMinZoom", this, map2);
55230         z2 = context.minEditableZoom();
55231       }
55232       if (setCenterZoom(map2.center(), z2)) {
55233         dispatch14.call("move", this, map2);
55234       }
55235       scheduleRedraw();
55236       return map2;
55237     };
55238     map2.centerZoom = function(loc2, z2) {
55239       if (setCenterZoom(loc2, z2)) {
55240         dispatch14.call("move", this, map2);
55241       }
55242       scheduleRedraw();
55243       return map2;
55244     };
55245     map2.zoomTo = function(entity) {
55246       var extent = entity.extent(context.graph());
55247       if (!isFinite(extent.area()))
55248         return map2;
55249       var z2 = clamp(map2.trimmedExtentZoom(extent), 0, 20);
55250       return map2.centerZoom(extent.center(), z2);
55251     };
55252     map2.centerEase = function(loc2, duration) {
55253       duration = duration || 250;
55254       setCenterZoom(loc2, map2.zoom(), duration);
55255       return map2;
55256     };
55257     map2.zoomEase = function(z2, duration) {
55258       duration = duration || 250;
55259       setCenterZoom(map2.center(), z2, duration, false);
55260       return map2;
55261     };
55262     map2.centerZoomEase = function(loc2, z2, duration) {
55263       duration = duration || 250;
55264       setCenterZoom(loc2, z2, duration, false);
55265       return map2;
55266     };
55267     map2.transformEase = function(t2, duration) {
55268       duration = duration || 250;
55269       setTransform(
55270         t2,
55271         duration,
55272         false
55273         /* don't force */
55274       );
55275       return map2;
55276     };
55277     map2.zoomToEase = function(obj, duration) {
55278       var extent;
55279       if (Array.isArray(obj)) {
55280         obj.forEach(function(entity) {
55281           var entityExtent = entity.extent(context.graph());
55282           if (!extent) {
55283             extent = entityExtent;
55284           } else {
55285             extent = extent.extend(entityExtent);
55286           }
55287         });
55288       } else {
55289         extent = obj.extent(context.graph());
55290       }
55291       if (!isFinite(extent.area()))
55292         return map2;
55293       var z2 = clamp(map2.trimmedExtentZoom(extent), 0, 20);
55294       return map2.centerZoomEase(extent.center(), z2, duration);
55295     };
55296     map2.startEase = function() {
55297       utilBindOnce(surface, _pointerPrefix + "down.ease", function() {
55298         map2.cancelEase();
55299       });
55300       return map2;
55301     };
55302     map2.cancelEase = function() {
55303       _selection.interrupt();
55304       return map2;
55305     };
55306     map2.extent = function(val) {
55307       if (!arguments.length) {
55308         return new geoExtent(
55309           projection2.invert([0, _dimensions[1]]),
55310           projection2.invert([_dimensions[0], 0])
55311         );
55312       } else {
55313         var extent = geoExtent(val);
55314         map2.centerZoom(extent.center(), map2.extentZoom(extent));
55315       }
55316     };
55317     map2.trimmedExtent = function(val) {
55318       if (!arguments.length) {
55319         var headerY = 71;
55320         var footerY = 30;
55321         var pad2 = 10;
55322         return new geoExtent(
55323           projection2.invert([pad2, _dimensions[1] - footerY - pad2]),
55324           projection2.invert([_dimensions[0] - pad2, headerY + pad2])
55325         );
55326       } else {
55327         var extent = geoExtent(val);
55328         map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
55329       }
55330     };
55331     function calcExtentZoom(extent, dim) {
55332       var tl = projection2([extent[0][0], extent[1][1]]);
55333       var br = projection2([extent[1][0], extent[0][1]]);
55334       var hFactor = (br[0] - tl[0]) / dim[0];
55335       var vFactor = (br[1] - tl[1]) / dim[1];
55336       var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
55337       var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
55338       var newZoom = map2.zoom() - Math.max(hZoomDiff, vZoomDiff);
55339       return newZoom;
55340     }
55341     map2.extentZoom = function(val) {
55342       return calcExtentZoom(geoExtent(val), _dimensions);
55343     };
55344     map2.trimmedExtentZoom = function(val) {
55345       var trimY = 120;
55346       var trimX = 40;
55347       var trimmed = [_dimensions[0] - trimX, _dimensions[1] - trimY];
55348       return calcExtentZoom(geoExtent(val), trimmed);
55349     };
55350     map2.withinEditableZoom = function() {
55351       return map2.zoom() >= context.minEditableZoom();
55352     };
55353     map2.isInWideSelection = function() {
55354       return !map2.withinEditableZoom() && context.selectedIDs().length;
55355     };
55356     map2.editableDataEnabled = function(skipZoomCheck) {
55357       var layer = context.layers().layer("osm");
55358       if (!layer || !layer.enabled())
55359         return false;
55360       return skipZoomCheck || map2.withinEditableZoom();
55361     };
55362     map2.notesEditable = function() {
55363       var layer = context.layers().layer("notes");
55364       if (!layer || !layer.enabled())
55365         return false;
55366       return map2.withinEditableZoom();
55367     };
55368     map2.minzoom = function(val) {
55369       if (!arguments.length)
55370         return _minzoom;
55371       _minzoom = val;
55372       return map2;
55373     };
55374     map2.toggleHighlightEdited = function() {
55375       surface.classed("highlight-edited", !surface.classed("highlight-edited"));
55376       map2.pan([0, 0]);
55377       dispatch14.call("changeHighlighting", this);
55378     };
55379     map2.areaFillOptions = ["wireframe", "partial", "full"];
55380     map2.activeAreaFill = function(val) {
55381       if (!arguments.length)
55382         return corePreferences("area-fill") || "partial";
55383       corePreferences("area-fill", val);
55384       if (val !== "wireframe") {
55385         corePreferences("area-fill-toggle", val);
55386       }
55387       updateAreaFill();
55388       map2.pan([0, 0]);
55389       dispatch14.call("changeAreaFill", this);
55390       return map2;
55391     };
55392     map2.toggleWireframe = function() {
55393       var activeFill = map2.activeAreaFill();
55394       if (activeFill === "wireframe") {
55395         activeFill = corePreferences("area-fill-toggle") || "partial";
55396       } else {
55397         activeFill = "wireframe";
55398       }
55399       map2.activeAreaFill(activeFill);
55400     };
55401     function updateAreaFill() {
55402       var activeFill = map2.activeAreaFill();
55403       map2.areaFillOptions.forEach(function(opt) {
55404         surface.classed("fill-" + opt, Boolean(opt === activeFill));
55405       });
55406     }
55407     map2.layers = () => drawLayers;
55408     map2.doubleUpHandler = function() {
55409       return _doubleUpHandler;
55410     };
55411     return utilRebind(map2, dispatch14, "on");
55412   }
55413
55414   // modules/renderer/photos.js
55415   function rendererPhotos(context) {
55416     var dispatch14 = dispatch_default("change");
55417     var _layerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview", "mapilio", "vegbilder"];
55418     var _allPhotoTypes = ["flat", "panoramic"];
55419     var _shownPhotoTypes = _allPhotoTypes.slice();
55420     var _dateFilters = ["fromDate", "toDate"];
55421     var _fromDate;
55422     var _toDate;
55423     var _usernames;
55424     function photos() {
55425     }
55426     function updateStorage() {
55427       if (window.mocha)
55428         return;
55429       var hash = utilStringQs(window.location.hash);
55430       var enabled = context.layers().all().filter(function(d2) {
55431         return _layerIDs.indexOf(d2.id) !== -1 && d2.layer && d2.layer.supported() && d2.layer.enabled();
55432       }).map(function(d2) {
55433         return d2.id;
55434       });
55435       if (enabled.length) {
55436         hash.photo_overlay = enabled.join(",");
55437       } else {
55438         delete hash.photo_overlay;
55439       }
55440       window.location.replace("#" + utilQsString(hash, true));
55441     }
55442     photos.overlayLayerIDs = function() {
55443       return _layerIDs;
55444     };
55445     photos.allPhotoTypes = function() {
55446       return _allPhotoTypes;
55447     };
55448     photos.dateFilters = function() {
55449       return _dateFilters;
55450     };
55451     photos.dateFilterValue = function(val) {
55452       return val === _dateFilters[0] ? _fromDate : _toDate;
55453     };
55454     photos.setDateFilter = function(type2, val, updateUrl) {
55455       var date = val && new Date(val);
55456       if (date && !isNaN(date)) {
55457         val = date.toISOString().slice(0, 10);
55458       } else {
55459         val = null;
55460       }
55461       if (type2 === _dateFilters[0]) {
55462         _fromDate = val;
55463         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
55464           _toDate = _fromDate;
55465         }
55466       }
55467       if (type2 === _dateFilters[1]) {
55468         _toDate = val;
55469         if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
55470           _fromDate = _toDate;
55471         }
55472       }
55473       dispatch14.call("change", this);
55474       if (updateUrl) {
55475         var rangeString;
55476         if (_fromDate || _toDate) {
55477           rangeString = (_fromDate || "") + "_" + (_toDate || "");
55478         }
55479         setUrlFilterValue("photo_dates", rangeString);
55480       }
55481     };
55482     photos.setUsernameFilter = function(val, updateUrl) {
55483       if (val && typeof val === "string")
55484         val = val.replace(/;/g, ",").split(",");
55485       if (val) {
55486         val = val.map((d2) => d2.trim()).filter(Boolean);
55487         if (!val.length) {
55488           val = null;
55489         }
55490       }
55491       _usernames = val;
55492       dispatch14.call("change", this);
55493       if (updateUrl) {
55494         var hashString;
55495         if (_usernames) {
55496           hashString = _usernames.join(",");
55497         }
55498         setUrlFilterValue("photo_username", hashString);
55499       }
55500     };
55501     function setUrlFilterValue(property, val) {
55502       if (!window.mocha) {
55503         var hash = utilStringQs(window.location.hash);
55504         if (val) {
55505           if (hash[property] === val)
55506             return;
55507           hash[property] = val;
55508         } else {
55509           if (!(property in hash))
55510             return;
55511           delete hash[property];
55512         }
55513         window.location.replace("#" + utilQsString(hash, true));
55514       }
55515     }
55516     function showsLayer(id2) {
55517       var layer = context.layers().layer(id2);
55518       return layer && layer.supported() && layer.enabled();
55519     }
55520     photos.shouldFilterByDate = function() {
55521       return showsLayer("mapillary") || showsLayer("kartaview") || showsLayer("streetside") || showsLayer("vegbilder");
55522     };
55523     photos.shouldFilterByPhotoType = function() {
55524       return showsLayer("mapillary") || showsLayer("streetside") && showsLayer("kartaview") || showsLayer("vegbilder");
55525     };
55526     photos.shouldFilterByUsername = function() {
55527       return !showsLayer("mapillary") && showsLayer("kartaview") && !showsLayer("streetside");
55528     };
55529     photos.showsPhotoType = function(val) {
55530       if (!photos.shouldFilterByPhotoType())
55531         return true;
55532       return _shownPhotoTypes.indexOf(val) !== -1;
55533     };
55534     photos.showsFlat = function() {
55535       return photos.showsPhotoType("flat");
55536     };
55537     photos.showsPanoramic = function() {
55538       return photos.showsPhotoType("panoramic");
55539     };
55540     photos.fromDate = function() {
55541       return _fromDate;
55542     };
55543     photos.toDate = function() {
55544       return _toDate;
55545     };
55546     photos.togglePhotoType = function(val) {
55547       var index = _shownPhotoTypes.indexOf(val);
55548       if (index !== -1) {
55549         _shownPhotoTypes.splice(index, 1);
55550       } else {
55551         _shownPhotoTypes.push(val);
55552       }
55553       dispatch14.call("change", this);
55554       return photos;
55555     };
55556     photos.usernames = function() {
55557       return _usernames;
55558     };
55559     photos.init = function() {
55560       var hash = utilStringQs(window.location.hash);
55561       if (hash.photo_dates) {
55562         var parts = /^(.*)[–_](.*)$/g.exec(hash.photo_dates.trim());
55563         this.setDateFilter("fromDate", parts && parts.length >= 2 && parts[1], false);
55564         this.setDateFilter("toDate", parts && parts.length >= 3 && parts[2], false);
55565       }
55566       if (hash.photo_username) {
55567         this.setUsernameFilter(hash.photo_username, false);
55568       }
55569       if (hash.photo_overlay) {
55570         var hashOverlayIDs = hash.photo_overlay.replace(/;/g, ",").split(",");
55571         hashOverlayIDs.forEach(function(id2) {
55572           if (id2 === "openstreetcam")
55573             id2 = "kartaview";
55574           var layer2 = _layerIDs.indexOf(id2) !== -1 && context.layers().layer(id2);
55575           if (layer2 && !layer2.enabled())
55576             layer2.enabled(true);
55577         });
55578       }
55579       if (hash.photo) {
55580         var photoIds = hash.photo.replace(/;/g, ",").split(",");
55581         var photoId = photoIds.length && photoIds[0].trim();
55582         var results = /(.*)\/(.*)/g.exec(photoId);
55583         if (results && results.length >= 3) {
55584           var serviceId = results[1];
55585           if (serviceId === "openstreetcam")
55586             serviceId = "kartaview";
55587           var photoKey = results[2];
55588           var service = services[serviceId];
55589           if (service && service.ensureViewerLoaded) {
55590             var layer = _layerIDs.indexOf(serviceId) !== -1 && context.layers().layer(serviceId);
55591             if (layer && !layer.enabled())
55592               layer.enabled(true);
55593             var baselineTime = Date.now();
55594             service.on("loadedImages.rendererPhotos", function() {
55595               if (Date.now() - baselineTime > 45e3) {
55596                 service.on("loadedImages.rendererPhotos", null);
55597                 return;
55598               }
55599               if (!service.cachedImage(photoKey))
55600                 return;
55601               service.on("loadedImages.rendererPhotos", null);
55602               service.ensureViewerLoaded(context).then(function() {
55603                 service.selectImage(context, photoKey).showViewer(context);
55604               });
55605             });
55606           }
55607         }
55608       }
55609       context.layers().on("change.rendererPhotos", updateStorage);
55610     };
55611     return utilRebind(photos, dispatch14, "on");
55612   }
55613
55614   // modules/ui/account.js
55615   function uiAccount(context) {
55616     const osm = context.connection();
55617     function updateUserDetails(selection2) {
55618       if (!osm)
55619         return;
55620       if (!osm.authenticated()) {
55621         render(selection2, null);
55622       } else {
55623         osm.userDetails((err, user) => render(selection2, user));
55624       }
55625     }
55626     function render(selection2, user) {
55627       let userInfo = selection2.select(".userInfo");
55628       let loginLogout = selection2.select(".loginLogout");
55629       if (user) {
55630         userInfo.html("").classed("hide", false);
55631         let userLink = userInfo.append("a").attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
55632         if (user.image_url) {
55633           userLink.append("img").attr("class", "icon pre-text user-icon").attr("src", user.image_url);
55634         } else {
55635           userLink.call(svgIcon("#iD-icon-avatar", "pre-text light"));
55636         }
55637         userLink.append("span").attr("class", "label").text(user.display_name);
55638         loginLogout.classed("hide", false).select("a").text(_t("logout")).on("click", (e3) => {
55639           e3.preventDefault();
55640           osm.logout();
55641           tryLogout();
55642         });
55643       } else {
55644         userInfo.html("").classed("hide", true);
55645         loginLogout.classed("hide", false).select("a").text(_t("login")).on("click", (e3) => {
55646           e3.preventDefault();
55647           osm.authenticate();
55648         });
55649       }
55650     }
55651     function tryLogout() {
55652       if (!osm)
55653         return;
55654       const url = osm.getUrlRoot() + "/logout?referer=%2Flogin";
55655       const w2 = 600;
55656       const h2 = 550;
55657       const settings = [
55658         ["width", w2],
55659         ["height", h2],
55660         ["left", window.screen.width / 2 - w2 / 2],
55661         ["top", window.screen.height / 2 - h2 / 2]
55662       ].map((x2) => x2.join("=")).join(",");
55663       window.open(url, "_blank", settings);
55664     }
55665     return function(selection2) {
55666       if (!osm)
55667         return;
55668       selection2.append("li").attr("class", "userInfo").classed("hide", true);
55669       selection2.append("li").attr("class", "loginLogout").classed("hide", true).append("a").attr("href", "#");
55670       osm.on("change.account", () => updateUserDetails(selection2));
55671       updateUserDetails(selection2);
55672     };
55673   }
55674
55675   // modules/ui/attribution.js
55676   function uiAttribution(context) {
55677     let _selection = select_default2(null);
55678     function render(selection2, data, klass) {
55679       let div = selection2.selectAll(".".concat(klass)).data([0]);
55680       div = div.enter().append("div").attr("class", klass).merge(div);
55681       let attributions = div.selectAll(".attribution").data(data, (d2) => d2.id);
55682       attributions.exit().remove();
55683       attributions = attributions.enter().append("span").attr("class", "attribution").each((d2, i3, nodes) => {
55684         let attribution = select_default2(nodes[i3]);
55685         if (d2.terms_html) {
55686           attribution.html(d2.terms_html);
55687           return;
55688         }
55689         if (d2.terms_url) {
55690           attribution = attribution.append("a").attr("href", d2.terms_url).attr("target", "_blank");
55691         }
55692         const sourceID = d2.id.replace(/\./g, "<TX_DOT>");
55693         const terms_text = _t(
55694           "imagery.".concat(sourceID, ".attribution.text"),
55695           { default: d2.terms_text || d2.id || d2.name() }
55696         );
55697         if (d2.icon && !d2.overlay) {
55698           attribution.append("img").attr("class", "source-image").attr("src", d2.icon);
55699         }
55700         attribution.append("span").attr("class", "attribution-text").text(terms_text);
55701       }).merge(attributions);
55702       let copyright = attributions.selectAll(".copyright-notice").data((d2) => {
55703         let notice = d2.copyrightNotices(context.map().zoom(), context.map().extent());
55704         return notice ? [notice] : [];
55705       });
55706       copyright.exit().remove();
55707       copyright = copyright.enter().append("span").attr("class", "copyright-notice").merge(copyright);
55708       copyright.text(String);
55709     }
55710     function update() {
55711       let baselayer = context.background().baseLayerSource();
55712       _selection.call(render, baselayer ? [baselayer] : [], "base-layer-attribution");
55713       const z2 = context.map().zoom();
55714       let overlays = context.background().overlayLayerSources() || [];
55715       _selection.call(render, overlays.filter((s2) => s2.validZoom(z2)), "overlay-layer-attribution");
55716     }
55717     return function(selection2) {
55718       _selection = selection2;
55719       context.background().on("change.attribution", update);
55720       context.map().on("move.attribution", throttle_default(update, 400, { leading: false }));
55721       update();
55722     };
55723   }
55724
55725   // modules/ui/contributors.js
55726   function uiContributors(context) {
55727     var osm = context.connection(), debouncedUpdate = debounce_default(function() {
55728       update();
55729     }, 1e3), limit = 4, hidden = false, wrap2 = select_default2(null);
55730     function update() {
55731       if (!osm)
55732         return;
55733       var users = {}, entities = context.history().intersects(context.map().extent());
55734       entities.forEach(function(entity) {
55735         if (entity && entity.user)
55736           users[entity.user] = true;
55737       });
55738       var u2 = Object.keys(users), subset = u2.slice(0, u2.length > limit ? limit - 1 : limit);
55739       wrap2.html("").call(svgIcon("#iD-icon-nearby", "pre-text light"));
55740       var userList = select_default2(document.createElement("span"));
55741       userList.selectAll().data(subset).enter().append("a").attr("class", "user-link").attr("href", function(d2) {
55742         return osm.userURL(d2);
55743       }).attr("target", "_blank").text(String);
55744       if (u2.length > limit) {
55745         var count = select_default2(document.createElement("span"));
55746         var othersNum = u2.length - limit + 1;
55747         count.append("a").attr("target", "_blank").attr("href", function() {
55748           return osm.changesetsURL(context.map().center(), context.map().zoom());
55749         }).text(othersNum);
55750         wrap2.append("span").html(_t.html("contributors.truncated_list", { n: othersNum, users: { html: userList.html() }, count: { html: count.html() } }));
55751       } else {
55752         wrap2.append("span").html(_t.html("contributors.list", { users: { html: userList.html() } }));
55753       }
55754       if (!u2.length) {
55755         hidden = true;
55756         wrap2.transition().style("opacity", 0);
55757       } else if (hidden) {
55758         wrap2.transition().style("opacity", 1);
55759       }
55760     }
55761     return function(selection2) {
55762       if (!osm)
55763         return;
55764       wrap2 = selection2;
55765       update();
55766       osm.on("loaded.contributors", debouncedUpdate);
55767       context.map().on("move.contributors", debouncedUpdate);
55768     };
55769   }
55770
55771   // modules/ui/popover.js
55772   var _popoverID = 0;
55773   function uiPopover(klass) {
55774     var _id = _popoverID++;
55775     var _anchorSelection = select_default2(null);
55776     var popover = function(selection2) {
55777       _anchorSelection = selection2;
55778       selection2.each(setup);
55779     };
55780     var _animation = utilFunctor(false);
55781     var _placement = utilFunctor("top");
55782     var _alignment = utilFunctor("center");
55783     var _scrollContainer = utilFunctor(select_default2(null));
55784     var _content;
55785     var _displayType = utilFunctor("");
55786     var _hasArrow = utilFunctor(true);
55787     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
55788     popover.displayType = function(val) {
55789       if (arguments.length) {
55790         _displayType = utilFunctor(val);
55791         return popover;
55792       } else {
55793         return _displayType;
55794       }
55795     };
55796     popover.hasArrow = function(val) {
55797       if (arguments.length) {
55798         _hasArrow = utilFunctor(val);
55799         return popover;
55800       } else {
55801         return _hasArrow;
55802       }
55803     };
55804     popover.placement = function(val) {
55805       if (arguments.length) {
55806         _placement = utilFunctor(val);
55807         return popover;
55808       } else {
55809         return _placement;
55810       }
55811     };
55812     popover.alignment = function(val) {
55813       if (arguments.length) {
55814         _alignment = utilFunctor(val);
55815         return popover;
55816       } else {
55817         return _alignment;
55818       }
55819     };
55820     popover.scrollContainer = function(val) {
55821       if (arguments.length) {
55822         _scrollContainer = utilFunctor(val);
55823         return popover;
55824       } else {
55825         return _scrollContainer;
55826       }
55827     };
55828     popover.content = function(val) {
55829       if (arguments.length) {
55830         _content = val;
55831         return popover;
55832       } else {
55833         return _content;
55834       }
55835     };
55836     popover.isShown = function() {
55837       var popoverSelection = _anchorSelection.select(".popover-" + _id);
55838       return !popoverSelection.empty() && popoverSelection.classed("in");
55839     };
55840     popover.show = function() {
55841       _anchorSelection.each(show);
55842     };
55843     popover.updateContent = function() {
55844       _anchorSelection.each(updateContent);
55845     };
55846     popover.hide = function() {
55847       _anchorSelection.each(hide);
55848     };
55849     popover.toggle = function() {
55850       _anchorSelection.each(toggle);
55851     };
55852     popover.destroy = function(selection2, selector) {
55853       selector = selector || ".popover-" + _id;
55854       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() {
55855         return this.getAttribute("data-original-title") || this.getAttribute("title");
55856       }).attr("data-original-title", null).selectAll(selector).remove();
55857     };
55858     popover.destroyAny = function(selection2) {
55859       selection2.call(popover.destroy, ".popover");
55860     };
55861     function setup() {
55862       var anchor = select_default2(this);
55863       var animate = _animation.apply(this, arguments);
55864       var popoverSelection = anchor.selectAll(".popover-" + _id).data([0]);
55865       var enter = popoverSelection.enter().append("div").attr("class", "popover popover-" + _id + " " + (klass ? klass : "")).classed("arrowed", _hasArrow.apply(this, arguments));
55866       enter.append("div").attr("class", "popover-arrow");
55867       enter.append("div").attr("class", "popover-inner");
55868       popoverSelection = enter.merge(popoverSelection);
55869       if (animate) {
55870         popoverSelection.classed("fade", true);
55871       }
55872       var display = _displayType.apply(this, arguments);
55873       if (display === "hover") {
55874         var _lastNonMouseEnterTime;
55875         anchor.on(_pointerPrefix + "enter.popover", function(d3_event) {
55876           if (d3_event.pointerType) {
55877             if (d3_event.pointerType !== "mouse") {
55878               _lastNonMouseEnterTime = d3_event.timeStamp;
55879               return;
55880             } else if (_lastNonMouseEnterTime && d3_event.timeStamp - _lastNonMouseEnterTime < 1500) {
55881               return;
55882             }
55883           }
55884           if (d3_event.buttons !== 0)
55885             return;
55886           show.apply(this, arguments);
55887         }).on(_pointerPrefix + "leave.popover", function() {
55888           hide.apply(this, arguments);
55889         }).on("focus.popover", function() {
55890           show.apply(this, arguments);
55891         }).on("blur.popover", function() {
55892           hide.apply(this, arguments);
55893         });
55894       } else if (display === "clickFocus") {
55895         anchor.on(_pointerPrefix + "down.popover", function(d3_event) {
55896           d3_event.preventDefault();
55897           d3_event.stopPropagation();
55898         }).on(_pointerPrefix + "up.popover", function(d3_event) {
55899           d3_event.preventDefault();
55900           d3_event.stopPropagation();
55901         }).on("click.popover", toggle);
55902         popoverSelection.attr("tabindex", 0).on("blur.popover", function() {
55903           anchor.each(function() {
55904             hide.apply(this, arguments);
55905           });
55906         });
55907       }
55908     }
55909     function show() {
55910       var anchor = select_default2(this);
55911       var popoverSelection = anchor.selectAll(".popover-" + _id);
55912       if (popoverSelection.empty()) {
55913         anchor.call(popover.destroy);
55914         anchor.each(setup);
55915         popoverSelection = anchor.selectAll(".popover-" + _id);
55916       }
55917       popoverSelection.classed("in", true);
55918       var displayType = _displayType.apply(this, arguments);
55919       if (displayType === "clickFocus") {
55920         anchor.classed("active", true);
55921         popoverSelection.node().focus();
55922       }
55923       anchor.each(updateContent);
55924     }
55925     function updateContent() {
55926       var anchor = select_default2(this);
55927       if (_content) {
55928         anchor.selectAll(".popover-" + _id + " > .popover-inner").call(_content.apply(this, arguments));
55929       }
55930       updatePosition.apply(this, arguments);
55931       updatePosition.apply(this, arguments);
55932       updatePosition.apply(this, arguments);
55933     }
55934     function updatePosition() {
55935       var anchor = select_default2(this);
55936       var popoverSelection = anchor.selectAll(".popover-" + _id);
55937       var scrollContainer = _scrollContainer && _scrollContainer.apply(this, arguments);
55938       var scrollNode = scrollContainer && !scrollContainer.empty() && scrollContainer.node();
55939       var scrollLeft = scrollNode ? scrollNode.scrollLeft : 0;
55940       var scrollTop = scrollNode ? scrollNode.scrollTop : 0;
55941       var placement = _placement.apply(this, arguments);
55942       popoverSelection.classed("left", false).classed("right", false).classed("top", false).classed("bottom", false).classed(placement, true);
55943       var alignment = _alignment.apply(this, arguments);
55944       var alignFactor = 0.5;
55945       if (alignment === "leading") {
55946         alignFactor = 0;
55947       } else if (alignment === "trailing") {
55948         alignFactor = 1;
55949       }
55950       var anchorFrame = getFrame(anchor.node());
55951       var popoverFrame = getFrame(popoverSelection.node());
55952       var position;
55953       switch (placement) {
55954         case "top":
55955           position = {
55956             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
55957             y: anchorFrame.y - popoverFrame.h
55958           };
55959           break;
55960         case "bottom":
55961           position = {
55962             x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
55963             y: anchorFrame.y + anchorFrame.h
55964           };
55965           break;
55966         case "left":
55967           position = {
55968             x: anchorFrame.x - popoverFrame.w,
55969             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
55970           };
55971           break;
55972         case "right":
55973           position = {
55974             x: anchorFrame.x + anchorFrame.w,
55975             y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
55976           };
55977           break;
55978       }
55979       if (position) {
55980         if (scrollNode && (placement === "top" || placement === "bottom")) {
55981           var initialPosX = position.x;
55982           if (position.x + popoverFrame.w > scrollNode.offsetWidth - 10) {
55983             position.x = scrollNode.offsetWidth - 10 - popoverFrame.w;
55984           } else if (position.x < 10) {
55985             position.x = 10;
55986           }
55987           var arrow = anchor.selectAll(".popover-" + _id + " > .popover-arrow");
55988           var arrowPosX = Math.min(Math.max(popoverFrame.w / 2 - (position.x - initialPosX), 10), popoverFrame.w - 10);
55989           arrow.style("left", ~~arrowPosX + "px");
55990         }
55991         popoverSelection.style("left", ~~position.x + "px").style("top", ~~position.y + "px");
55992       } else {
55993         popoverSelection.style("left", null).style("top", null);
55994       }
55995       function getFrame(node) {
55996         var positionStyle = select_default2(node).style("position");
55997         if (positionStyle === "absolute" || positionStyle === "static") {
55998           return {
55999             x: node.offsetLeft - scrollLeft,
56000             y: node.offsetTop - scrollTop,
56001             w: node.offsetWidth,
56002             h: node.offsetHeight
56003           };
56004         } else {
56005           return {
56006             x: 0,
56007             y: 0,
56008             w: node.offsetWidth,
56009             h: node.offsetHeight
56010           };
56011         }
56012       }
56013     }
56014     function hide() {
56015       var anchor = select_default2(this);
56016       if (_displayType.apply(this, arguments) === "clickFocus") {
56017         anchor.classed("active", false);
56018       }
56019       anchor.selectAll(".popover-" + _id).classed("in", false);
56020     }
56021     function toggle() {
56022       if (select_default2(this).select(".popover-" + _id).classed("in")) {
56023         hide.apply(this, arguments);
56024       } else {
56025         show.apply(this, arguments);
56026       }
56027     }
56028     return popover;
56029   }
56030
56031   // modules/ui/tooltip.js
56032   function uiTooltip(klass) {
56033     var tooltip = uiPopover((klass || "") + " tooltip").displayType("hover");
56034     var _title = function() {
56035       var title = this.getAttribute("data-original-title");
56036       if (title) {
56037         return title;
56038       } else {
56039         title = this.getAttribute("title");
56040         this.removeAttribute("title");
56041         this.setAttribute("data-original-title", title);
56042       }
56043       return title;
56044     };
56045     var _heading = utilFunctor(null);
56046     var _keys = utilFunctor(null);
56047     tooltip.title = function(val) {
56048       if (!arguments.length)
56049         return _title;
56050       _title = utilFunctor(val);
56051       return tooltip;
56052     };
56053     tooltip.heading = function(val) {
56054       if (!arguments.length)
56055         return _heading;
56056       _heading = utilFunctor(val);
56057       return tooltip;
56058     };
56059     tooltip.keys = function(val) {
56060       if (!arguments.length)
56061         return _keys;
56062       _keys = utilFunctor(val);
56063       return tooltip;
56064     };
56065     tooltip.content(function() {
56066       var heading = _heading.apply(this, arguments);
56067       var text2 = _title.apply(this, arguments);
56068       var keys2 = _keys.apply(this, arguments);
56069       var headingCallback = typeof heading === "function" ? heading : (s2) => s2.text(heading);
56070       var textCallback = typeof text2 === "function" ? text2 : (s2) => s2.text(text2);
56071       return function(selection2) {
56072         var headingSelect = selection2.selectAll(".tooltip-heading").data(heading ? [heading] : []);
56073         headingSelect.exit().remove();
56074         headingSelect.enter().append("div").attr("class", "tooltip-heading").merge(headingSelect).text("").call(headingCallback);
56075         var textSelect = selection2.selectAll(".tooltip-text").data(text2 ? [text2] : []);
56076         textSelect.exit().remove();
56077         textSelect.enter().append("div").attr("class", "tooltip-text").merge(textSelect).text("").call(textCallback);
56078         var keyhintWrap = selection2.selectAll(".keyhint-wrap").data(keys2 && keys2.length ? [0] : []);
56079         keyhintWrap.exit().remove();
56080         var keyhintWrapEnter = keyhintWrap.enter().append("div").attr("class", "keyhint-wrap");
56081         keyhintWrapEnter.append("span").call(_t.append("tooltip_keyhint"));
56082         keyhintWrap = keyhintWrapEnter.merge(keyhintWrap);
56083         keyhintWrap.selectAll("kbd.shortcut").data(keys2 && keys2.length ? keys2 : []).enter().append("kbd").attr("class", "shortcut").text(function(d2) {
56084           return d2;
56085         });
56086       };
56087     });
56088     return tooltip;
56089   }
56090
56091   // modules/ui/edit_menu.js
56092   function uiEditMenu(context) {
56093     var dispatch14 = dispatch_default("toggled");
56094     var _menu = select_default2(null);
56095     var _operations = [];
56096     var _anchorLoc = [0, 0];
56097     var _anchorLocLonLat = [0, 0];
56098     var _triggerType = "";
56099     var _vpTopMargin = 85;
56100     var _vpBottomMargin = 45;
56101     var _vpSideMargin = 35;
56102     var _menuTop = false;
56103     var _menuHeight;
56104     var _menuWidth;
56105     var _verticalPadding = 4;
56106     var _tooltipWidth = 210;
56107     var _menuSideMargin = 10;
56108     var _tooltips = [];
56109     var editMenu = function(selection2) {
56110       var isTouchMenu = _triggerType.includes("touch") || _triggerType.includes("pen");
56111       var ops = _operations.filter(function(op) {
56112         return !isTouchMenu || !op.mouseOnly;
56113       });
56114       if (!ops.length)
56115         return;
56116       _tooltips = [];
56117       _menuTop = isTouchMenu;
56118       var showLabels = isTouchMenu;
56119       var buttonHeight = showLabels ? 32 : 34;
56120       if (showLabels) {
56121         _menuWidth = 52 + Math.min(120, 6 * Math.max.apply(Math, ops.map(function(op) {
56122           return op.title.length;
56123         })));
56124       } else {
56125         _menuWidth = 44;
56126       }
56127       _menuHeight = _verticalPadding * 2 + ops.length * buttonHeight;
56128       _menu = selection2.append("div").attr("class", "edit-menu").classed("touch-menu", isTouchMenu).style("padding", _verticalPadding + "px 0");
56129       var buttons = _menu.selectAll(".edit-menu-item").data(ops);
56130       var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
56131         return "edit-menu-item edit-menu-item-" + d2.id;
56132       }).style("height", buttonHeight + "px").on("click", click).on("pointerup", pointerup).on("pointerdown mousedown", function pointerdown(d3_event) {
56133         d3_event.stopPropagation();
56134       }).on("mouseenter.highlight", function(d3_event, d2) {
56135         if (!d2.relatedEntityIds || select_default2(this).classed("disabled"))
56136           return;
56137         utilHighlightEntities(d2.relatedEntityIds(), true, context);
56138       }).on("mouseleave.highlight", function(d3_event, d2) {
56139         if (!d2.relatedEntityIds)
56140           return;
56141         utilHighlightEntities(d2.relatedEntityIds(), false, context);
56142       });
56143       buttonsEnter.each(function(d2) {
56144         var tooltip = uiTooltip().heading(() => d2.title).title(d2.tooltip).keys([d2.keys[0]]);
56145         _tooltips.push(tooltip);
56146         select_default2(this).call(tooltip).append("div").attr("class", "icon-wrap").call(svgIcon(d2.icon && d2.icon() || "#iD-operation-" + d2.id, "operation"));
56147       });
56148       if (showLabels) {
56149         buttonsEnter.append("span").attr("class", "label").each(function(d2) {
56150           select_default2(this).call(d2.title);
56151         });
56152       }
56153       buttonsEnter.merge(buttons).classed("disabled", function(d2) {
56154         return d2.disabled();
56155       });
56156       updatePosition();
56157       var initialScale = context.projection.scale();
56158       context.map().on("move.edit-menu", function() {
56159         if (initialScale !== context.projection.scale()) {
56160           editMenu.close();
56161         }
56162       }).on("drawn.edit-menu", function(info) {
56163         if (info.full)
56164           updatePosition();
56165       });
56166       var lastPointerUpType;
56167       function pointerup(d3_event) {
56168         lastPointerUpType = d3_event.pointerType;
56169       }
56170       function click(d3_event, operation) {
56171         d3_event.stopPropagation();
56172         if (operation.relatedEntityIds) {
56173           utilHighlightEntities(operation.relatedEntityIds(), false, context);
56174         }
56175         if (operation.disabled()) {
56176           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
56177             context.ui().flash.duration(4e3).iconName("#iD-operation-" + operation.id).iconClass("operation disabled").label(operation.tooltip())();
56178           }
56179         } else {
56180           if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
56181             context.ui().flash.duration(2e3).iconName("#iD-operation-" + operation.id).iconClass("operation").label(operation.annotation() || operation.title)();
56182           }
56183           operation();
56184           editMenu.close();
56185         }
56186         lastPointerUpType = null;
56187       }
56188       dispatch14.call("toggled", this, true);
56189     };
56190     function updatePosition() {
56191       if (!_menu || _menu.empty())
56192         return;
56193       var anchorLoc = context.projection(_anchorLocLonLat);
56194       var viewport = context.surfaceRect();
56195       if (anchorLoc[0] < 0 || anchorLoc[0] > viewport.width || anchorLoc[1] < 0 || anchorLoc[1] > viewport.height) {
56196         editMenu.close();
56197         return;
56198       }
56199       var menuLeft = displayOnLeft(viewport);
56200       var offset = [0, 0];
56201       offset[0] = menuLeft ? -1 * (_menuSideMargin + _menuWidth) : _menuSideMargin;
56202       if (_menuTop) {
56203         if (anchorLoc[1] - _menuHeight < _vpTopMargin) {
56204           offset[1] = -anchorLoc[1] + _vpTopMargin;
56205         } else {
56206           offset[1] = -_menuHeight;
56207         }
56208       } else {
56209         if (anchorLoc[1] + _menuHeight > viewport.height - _vpBottomMargin) {
56210           offset[1] = -anchorLoc[1] - _menuHeight + viewport.height - _vpBottomMargin;
56211         } else {
56212           offset[1] = 0;
56213         }
56214       }
56215       var origin = geoVecAdd(anchorLoc, offset);
56216       _menu.style("left", origin[0] + "px").style("top", origin[1] + "px");
56217       var tooltipSide = tooltipPosition(viewport, menuLeft);
56218       _tooltips.forEach(function(tooltip) {
56219         tooltip.placement(tooltipSide);
56220       });
56221       function displayOnLeft(viewport2) {
56222         if (_mainLocalizer.textDirection() === "ltr") {
56223           if (anchorLoc[0] + _menuSideMargin + _menuWidth > viewport2.width - _vpSideMargin) {
56224             return true;
56225           }
56226           return false;
56227         } else {
56228           if (anchorLoc[0] - _menuSideMargin - _menuWidth < _vpSideMargin) {
56229             return false;
56230           }
56231           return true;
56232         }
56233       }
56234       function tooltipPosition(viewport2, menuLeft2) {
56235         if (_mainLocalizer.textDirection() === "ltr") {
56236           if (menuLeft2) {
56237             return "left";
56238           }
56239           if (anchorLoc[0] + _menuSideMargin + _menuWidth + _tooltipWidth > viewport2.width - _vpSideMargin) {
56240             return "left";
56241           }
56242           return "right";
56243         } else {
56244           if (!menuLeft2) {
56245             return "right";
56246           }
56247           if (anchorLoc[0] - _menuSideMargin - _menuWidth - _tooltipWidth < _vpSideMargin) {
56248             return "right";
56249           }
56250           return "left";
56251         }
56252       }
56253     }
56254     editMenu.close = function() {
56255       context.map().on("move.edit-menu", null).on("drawn.edit-menu", null);
56256       _menu.remove();
56257       _tooltips = [];
56258       dispatch14.call("toggled", this, false);
56259     };
56260     editMenu.anchorLoc = function(val) {
56261       if (!arguments.length)
56262         return _anchorLoc;
56263       _anchorLoc = val;
56264       _anchorLocLonLat = context.projection.invert(_anchorLoc);
56265       return editMenu;
56266     };
56267     editMenu.triggerType = function(val) {
56268       if (!arguments.length)
56269         return _triggerType;
56270       _triggerType = val;
56271       return editMenu;
56272     };
56273     editMenu.operations = function(val) {
56274       if (!arguments.length)
56275         return _operations;
56276       _operations = val;
56277       return editMenu;
56278     };
56279     return utilRebind(editMenu, dispatch14, "on");
56280   }
56281
56282   // modules/ui/feature_info.js
56283   function uiFeatureInfo(context) {
56284     function update(selection2) {
56285       var features = context.features();
56286       var stats = features.stats();
56287       var count = 0;
56288       var hiddenList = features.hidden().map(function(k2) {
56289         if (stats[k2]) {
56290           count += stats[k2];
56291           return _t.append("inspector.title_count", {
56292             title: _t("feature." + k2 + ".description"),
56293             count: stats[k2]
56294           });
56295         }
56296         return null;
56297       }).filter(Boolean);
56298       selection2.text("");
56299       if (hiddenList.length) {
56300         var tooltipBehavior = uiTooltip().placement("top").title(function() {
56301           return (selection3) => {
56302             hiddenList.forEach((hiddenFeature) => {
56303               selection3.append("div").call(hiddenFeature);
56304             });
56305           };
56306         });
56307         selection2.append("a").attr("class", "chip").attr("href", "#").call(_t.append("feature_info.hidden_warning", { count })).call(tooltipBehavior).on("click", function(d3_event) {
56308           tooltipBehavior.hide();
56309           d3_event.preventDefault();
56310           context.ui().togglePanes(context.container().select(".map-panes .map-data-pane"));
56311         });
56312       }
56313       selection2.classed("hide", !hiddenList.length);
56314     }
56315     return function(selection2) {
56316       update(selection2);
56317       context.features().on("change.feature_info", function() {
56318         update(selection2);
56319       });
56320     };
56321   }
56322
56323   // modules/ui/flash.js
56324   function uiFlash(context) {
56325     var _flashTimer;
56326     var _duration = 2e3;
56327     var _iconName = "#iD-icon-no";
56328     var _iconClass = "disabled";
56329     var _label = (s2) => s2.text("");
56330     function flash() {
56331       if (_flashTimer) {
56332         _flashTimer.stop();
56333       }
56334       context.container().select(".main-footer-wrap").classed("footer-hide", true).classed("footer-show", false);
56335       context.container().select(".flash-wrap").classed("footer-hide", false).classed("footer-show", true);
56336       var content = context.container().select(".flash-wrap").selectAll(".flash-content").data([0]);
56337       var contentEnter = content.enter().append("div").attr("class", "flash-content");
56338       var iconEnter = contentEnter.append("svg").attr("class", "flash-icon icon").append("g").attr("transform", "translate(10,10)");
56339       iconEnter.append("circle").attr("r", 9);
56340       iconEnter.append("use").attr("transform", "translate(-7,-7)").attr("width", "14").attr("height", "14");
56341       contentEnter.append("div").attr("class", "flash-text");
56342       content = content.merge(contentEnter);
56343       content.selectAll(".flash-icon").attr("class", "icon flash-icon " + (_iconClass || ""));
56344       content.selectAll(".flash-icon use").attr("xlink:href", _iconName);
56345       content.selectAll(".flash-text").attr("class", "flash-text").call(_label);
56346       _flashTimer = timeout_default(function() {
56347         _flashTimer = null;
56348         context.container().select(".main-footer-wrap").classed("footer-hide", false).classed("footer-show", true);
56349         context.container().select(".flash-wrap").classed("footer-hide", true).classed("footer-show", false);
56350       }, _duration);
56351       return content;
56352     }
56353     flash.duration = function(_2) {
56354       if (!arguments.length)
56355         return _duration;
56356       _duration = _2;
56357       return flash;
56358     };
56359     flash.label = function(_2) {
56360       if (!arguments.length)
56361         return _label;
56362       if (typeof _2 !== "function") {
56363         _label = (selection2) => selection2.text(_2);
56364       } else {
56365         _label = (selection2) => selection2.text("").call(_2);
56366       }
56367       return flash;
56368     };
56369     flash.iconName = function(_2) {
56370       if (!arguments.length)
56371         return _iconName;
56372       _iconName = _2;
56373       return flash;
56374     };
56375     flash.iconClass = function(_2) {
56376       if (!arguments.length)
56377         return _iconClass;
56378       _iconClass = _2;
56379       return flash;
56380     };
56381     return flash;
56382   }
56383
56384   // modules/ui/full_screen.js
56385   function uiFullScreen(context) {
56386     var element = context.container().node();
56387     function getFullScreenFn() {
56388       if (element.requestFullscreen) {
56389         return element.requestFullscreen;
56390       } else if (element.msRequestFullscreen) {
56391         return element.msRequestFullscreen;
56392       } else if (element.mozRequestFullScreen) {
56393         return element.mozRequestFullScreen;
56394       } else if (element.webkitRequestFullscreen) {
56395         return element.webkitRequestFullscreen;
56396       }
56397     }
56398     function getExitFullScreenFn() {
56399       if (document.exitFullscreen) {
56400         return document.exitFullscreen;
56401       } else if (document.msExitFullscreen) {
56402         return document.msExitFullscreen;
56403       } else if (document.mozCancelFullScreen) {
56404         return document.mozCancelFullScreen;
56405       } else if (document.webkitExitFullscreen) {
56406         return document.webkitExitFullscreen;
56407       }
56408     }
56409     function isFullScreen() {
56410       return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
56411     }
56412     function isSupported() {
56413       return !!getFullScreenFn();
56414     }
56415     function fullScreen(d3_event) {
56416       d3_event.preventDefault();
56417       if (!isFullScreen()) {
56418         getFullScreenFn().apply(element);
56419       } else {
56420         getExitFullScreenFn().apply(document);
56421       }
56422     }
56423     return function() {
56424       if (!isSupported())
56425         return;
56426       var detected = utilDetect();
56427       var keys2 = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"];
56428       context.keybinding().on(keys2, fullScreen);
56429     };
56430   }
56431
56432   // modules/ui/geolocate.js
56433   function uiGeolocate(context) {
56434     var _geolocationOptions = {
56435       // prioritize speed and power usage over precision
56436       enableHighAccuracy: false,
56437       // don't hang indefinitely getting the location
56438       timeout: 6e3
56439       // 6sec
56440     };
56441     var _locating = uiLoading(context).message(_t.html("geolocate.locating")).blocking(true);
56442     var _layer = context.layers().layer("geolocate");
56443     var _position;
56444     var _extent;
56445     var _timeoutID;
56446     var _button = select_default2(null);
56447     function click() {
56448       if (context.inIntro())
56449         return;
56450       if (!_layer.enabled() && !_locating.isShown()) {
56451         _timeoutID = setTimeout(
56452           error,
56453           1e4
56454           /* 10sec */
56455         );
56456         context.container().call(_locating);
56457         navigator.geolocation.getCurrentPosition(success, error, _geolocationOptions);
56458       } else {
56459         _locating.close();
56460         _layer.enabled(null, false);
56461         updateButtonState();
56462       }
56463     }
56464     function zoomTo() {
56465       context.enter(modeBrowse(context));
56466       var map2 = context.map();
56467       _layer.enabled(_position, true);
56468       updateButtonState();
56469       map2.centerZoomEase(_extent.center(), Math.min(20, map2.extentZoom(_extent)));
56470     }
56471     function success(geolocation) {
56472       _position = geolocation;
56473       var coords = _position.coords;
56474       _extent = geoExtent([coords.longitude, coords.latitude]).padByMeters(coords.accuracy);
56475       zoomTo();
56476       finish();
56477     }
56478     function error() {
56479       if (_position) {
56480         zoomTo();
56481       } else {
56482         context.ui().flash.label(_t.append("geolocate.location_unavailable")).iconName("#iD-icon-geolocate")();
56483       }
56484       finish();
56485     }
56486     function finish() {
56487       _locating.close();
56488       if (_timeoutID) {
56489         clearTimeout(_timeoutID);
56490       }
56491       _timeoutID = void 0;
56492     }
56493     function updateButtonState() {
56494       _button.classed("active", _layer.enabled());
56495       _button.attr("aria-pressed", _layer.enabled());
56496     }
56497     return function(selection2) {
56498       if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition)
56499         return;
56500       _button = selection2.append("button").on("click", click).attr("aria-pressed", false).call(svgIcon("#iD-icon-geolocate", "light")).call(
56501         uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _t.append("geolocate.title")).keys([_t("geolocate.key")])
56502       );
56503       context.keybinding().on(_t("geolocate.key"), click);
56504     };
56505   }
56506
56507   // modules/ui/panels/background.js
56508   function uiPanelBackground(context) {
56509     var background = context.background();
56510     var _currSourceName = null;
56511     var _metadata = {};
56512     var _metadataKeys = [
56513       "zoom",
56514       "vintage",
56515       "source",
56516       "description",
56517       "resolution",
56518       "accuracy"
56519     ];
56520     var debouncedRedraw = debounce_default(redraw, 250);
56521     function redraw(selection2) {
56522       var source = background.baseLayerSource();
56523       if (!source)
56524         return;
56525       var isDG = source.id.match(/^DigitalGlobe/i) !== null;
56526       var sourceLabel = source.label();
56527       if (_currSourceName !== sourceLabel) {
56528         _currSourceName = sourceLabel;
56529         _metadata = {};
56530       }
56531       selection2.text("");
56532       var list = selection2.append("ul").attr("class", "background-info");
56533       list.append("li").call(_currSourceName);
56534       _metadataKeys.forEach(function(k2) {
56535         if (isDG && k2 === "vintage")
56536           return;
56537         list.append("li").attr("class", "background-info-list-" + k2).classed("hide", !_metadata[k2]).call(_t.append("info_panels.background." + k2, { suffix: ":" })).append("span").attr("class", "background-info-span-" + k2).text(_metadata[k2]);
56538       });
56539       debouncedGetMetadata(selection2);
56540       var toggleTiles = context.getDebug("tile") ? "hide_tiles" : "show_tiles";
56541       selection2.append("a").call(_t.append("info_panels.background." + toggleTiles)).attr("href", "#").attr("class", "button button-toggle-tiles").on("click", function(d3_event) {
56542         d3_event.preventDefault();
56543         context.setDebug("tile", !context.getDebug("tile"));
56544         selection2.call(redraw);
56545       });
56546       if (isDG) {
56547         var key = source.id + "-vintage";
56548         var sourceVintage = context.background().findSource(key);
56549         var showsVintage = context.background().showsLayer(sourceVintage);
56550         var toggleVintage = showsVintage ? "hide_vintage" : "show_vintage";
56551         selection2.append("a").call(_t.append("info_panels.background." + toggleVintage)).attr("href", "#").attr("class", "button button-toggle-vintage").on("click", function(d3_event) {
56552           d3_event.preventDefault();
56553           context.background().toggleOverlayLayer(sourceVintage);
56554           selection2.call(redraw);
56555         });
56556       }
56557       ["DigitalGlobe-Premium", "DigitalGlobe-Standard"].forEach(function(layerId) {
56558         if (source.id !== layerId) {
56559           var key2 = layerId + "-vintage";
56560           var sourceVintage2 = context.background().findSource(key2);
56561           if (context.background().showsLayer(sourceVintage2)) {
56562             context.background().toggleOverlayLayer(sourceVintage2);
56563           }
56564         }
56565       });
56566     }
56567     var debouncedGetMetadata = debounce_default(getMetadata, 250);
56568     function getMetadata(selection2) {
56569       var tile = context.container().select(".layer-background img.tile-center");
56570       if (tile.empty())
56571         return;
56572       var sourceName = _currSourceName;
56573       var d2 = tile.datum();
56574       var zoom = d2 && d2.length >= 3 && d2[2] || Math.floor(context.map().zoom());
56575       var center = context.map().center();
56576       _metadata.zoom = String(zoom);
56577       selection2.selectAll(".background-info-list-zoom").classed("hide", false).selectAll(".background-info-span-zoom").text(_metadata.zoom);
56578       if (!d2 || !d2.length >= 3)
56579         return;
56580       background.baseLayerSource().getMetadata(center, d2, function(err, result) {
56581         if (err || _currSourceName !== sourceName)
56582           return;
56583         var vintage = result.vintage;
56584         _metadata.vintage = vintage && vintage.range || _t("info_panels.background.unknown");
56585         selection2.selectAll(".background-info-list-vintage").classed("hide", false).selectAll(".background-info-span-vintage").text(_metadata.vintage);
56586         _metadataKeys.forEach(function(k2) {
56587           if (k2 === "zoom" || k2 === "vintage")
56588             return;
56589           var val = result[k2];
56590           _metadata[k2] = val;
56591           selection2.selectAll(".background-info-list-" + k2).classed("hide", !val).selectAll(".background-info-span-" + k2).text(val);
56592         });
56593       });
56594     }
56595     var panel = function(selection2) {
56596       selection2.call(redraw);
56597       context.map().on("drawn.info-background", function() {
56598         selection2.call(debouncedRedraw);
56599       }).on("move.info-background", function() {
56600         selection2.call(debouncedGetMetadata);
56601       });
56602     };
56603     panel.off = function() {
56604       context.map().on("drawn.info-background", null).on("move.info-background", null);
56605     };
56606     panel.id = "background";
56607     panel.label = _t.append("info_panels.background.title");
56608     panel.key = _t("info_panels.background.key");
56609     return panel;
56610   }
56611
56612   // modules/ui/panels/history.js
56613   function uiPanelHistory(context) {
56614     var osm;
56615     function displayTimestamp(timestamp) {
56616       if (!timestamp)
56617         return _t("info_panels.history.unknown");
56618       var options2 = {
56619         day: "numeric",
56620         month: "short",
56621         year: "numeric",
56622         hour: "numeric",
56623         minute: "numeric",
56624         second: "numeric"
56625       };
56626       var d2 = new Date(timestamp);
56627       if (isNaN(d2.getTime()))
56628         return _t("info_panels.history.unknown");
56629       return d2.toLocaleString(_mainLocalizer.localeCode(), options2);
56630     }
56631     function displayUser(selection2, userName) {
56632       if (!userName) {
56633         selection2.append("span").call(_t.append("info_panels.history.unknown"));
56634         return;
56635       }
56636       selection2.append("span").attr("class", "user-name").text(userName);
56637       var links = selection2.append("div").attr("class", "links");
56638       if (osm) {
56639         links.append("a").attr("class", "user-osm-link").attr("href", osm.userURL(userName)).attr("target", "_blank").call(_t.append("info_panels.history.profile_link"));
56640       }
56641       links.append("a").attr("class", "user-hdyc-link").attr("href", "https://hdyc.neis-one.org/?" + userName).attr("target", "_blank").attr("tabindex", -1).text("HDYC");
56642     }
56643     function displayChangeset(selection2, changeset) {
56644       if (!changeset) {
56645         selection2.append("span").call(_t.append("info_panels.history.unknown"));
56646         return;
56647       }
56648       selection2.append("span").attr("class", "changeset-id").text(changeset);
56649       var links = selection2.append("div").attr("class", "links");
56650       if (osm) {
56651         links.append("a").attr("class", "changeset-osm-link").attr("href", osm.changesetURL(changeset)).attr("target", "_blank").call(_t.append("info_panels.history.changeset_link"));
56652       }
56653       links.append("a").attr("class", "changeset-osmcha-link").attr("href", "https://osmcha.org/changesets/" + changeset).attr("target", "_blank").text("OSMCha");
56654       links.append("a").attr("class", "changeset-achavi-link").attr("href", "https://overpass-api.de/achavi/?changeset=" + changeset).attr("target", "_blank").text("Achavi");
56655     }
56656     function redraw(selection2) {
56657       var selectedNoteID = context.selectedNoteID();
56658       osm = context.connection();
56659       var selected, note, entity;
56660       if (selectedNoteID && osm) {
56661         selected = [_t.html("note.note") + " " + selectedNoteID];
56662         note = osm.getNote(selectedNoteID);
56663       } else {
56664         selected = context.selectedIDs().filter(function(e3) {
56665           return context.hasEntity(e3);
56666         });
56667         if (selected.length) {
56668           entity = context.entity(selected[0]);
56669         }
56670       }
56671       var singular = selected.length === 1 ? selected[0] : null;
56672       selection2.html("");
56673       if (singular) {
56674         selection2.append("h4").attr("class", "history-heading").html(singular);
56675       } else {
56676         selection2.append("h4").attr("class", "history-heading").call(_t.append("info_panels.selected", { n: selected.length }));
56677       }
56678       if (!singular)
56679         return;
56680       if (entity) {
56681         selection2.call(redrawEntity, entity);
56682       } else if (note) {
56683         selection2.call(redrawNote, note);
56684       }
56685     }
56686     function redrawNote(selection2, note) {
56687       if (!note || note.isNew()) {
56688         selection2.append("div").call(_t.append("info_panels.history.note_no_history"));
56689         return;
56690       }
56691       var list = selection2.append("ul");
56692       list.append("li").call(_t.append("info_panels.history.note_comments", { suffix: ":" })).append("span").text(note.comments.length);
56693       if (note.comments.length) {
56694         list.append("li").call(_t.append("info_panels.history.note_created_date", { suffix: ":" })).append("span").text(displayTimestamp(note.comments[0].date));
56695         list.append("li").call(_t.append("info_panels.history.note_created_user", { suffix: ":" })).call(displayUser, note.comments[0].user);
56696       }
56697       if (osm) {
56698         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"));
56699       }
56700     }
56701     function redrawEntity(selection2, entity) {
56702       if (!entity || entity.isNew()) {
56703         selection2.append("div").call(_t.append("info_panels.history.no_history"));
56704         return;
56705       }
56706       var links = selection2.append("div").attr("class", "links");
56707       if (osm) {
56708         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"));
56709       }
56710       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");
56711       var list = selection2.append("ul");
56712       list.append("li").call(_t.append("info_panels.history.version", { suffix: ":" })).append("span").text(entity.version);
56713       list.append("li").call(_t.append("info_panels.history.last_edit", { suffix: ":" })).append("span").text(displayTimestamp(entity.timestamp));
56714       list.append("li").call(_t.append("info_panels.history.edited_by", { suffix: ":" })).call(displayUser, entity.user);
56715       list.append("li").call(_t.append("info_panels.history.changeset", { suffix: ":" })).call(displayChangeset, entity.changeset);
56716     }
56717     var panel = function(selection2) {
56718       selection2.call(redraw);
56719       context.map().on("drawn.info-history", function() {
56720         selection2.call(redraw);
56721       });
56722       context.on("enter.info-history", function() {
56723         selection2.call(redraw);
56724       });
56725     };
56726     panel.off = function() {
56727       context.map().on("drawn.info-history", null);
56728       context.on("enter.info-history", null);
56729     };
56730     panel.id = "history";
56731     panel.label = _t.append("info_panels.history.title");
56732     panel.key = _t("info_panels.history.key");
56733     return panel;
56734   }
56735
56736   // modules/util/units.js
56737   var OSM_PRECISION = 7;
56738   function displayLength(m2, isImperial) {
56739     var d2 = m2 * (isImperial ? 3.28084 : 1);
56740     var unit2;
56741     if (isImperial) {
56742       if (d2 >= 5280) {
56743         d2 /= 5280;
56744         unit2 = "miles";
56745       } else {
56746         unit2 = "feet";
56747       }
56748     } else {
56749       if (d2 >= 1e3) {
56750         d2 /= 1e3;
56751         unit2 = "kilometers";
56752       } else {
56753         unit2 = "meters";
56754       }
56755     }
56756     return _t("units." + unit2, {
56757       quantity: d2.toLocaleString(_mainLocalizer.localeCode(), {
56758         maximumSignificantDigits: 4
56759       })
56760     });
56761   }
56762   function displayArea(m2, isImperial) {
56763     var locale2 = _mainLocalizer.localeCode();
56764     var d2 = m2 * (isImperial ? 10.7639111056 : 1);
56765     var d1, d22, area;
56766     var unit1 = "";
56767     var unit2 = "";
56768     if (isImperial) {
56769       if (d2 >= 6969600) {
56770         d1 = d2 / 27878400;
56771         unit1 = "square_miles";
56772       } else {
56773         d1 = d2;
56774         unit1 = "square_feet";
56775       }
56776       if (d2 > 4356 && d2 < 4356e4) {
56777         d22 = d2 / 43560;
56778         unit2 = "acres";
56779       }
56780     } else {
56781       if (d2 >= 25e4) {
56782         d1 = d2 / 1e6;
56783         unit1 = "square_kilometers";
56784       } else {
56785         d1 = d2;
56786         unit1 = "square_meters";
56787       }
56788       if (d2 > 1e3 && d2 < 1e7) {
56789         d22 = d2 / 1e4;
56790         unit2 = "hectares";
56791       }
56792     }
56793     area = _t("units." + unit1, {
56794       quantity: d1.toLocaleString(locale2, {
56795         maximumSignificantDigits: 4
56796       })
56797     });
56798     if (d22) {
56799       return _t("units.area_pair", {
56800         area1: area,
56801         area2: _t("units." + unit2, {
56802           quantity: d22.toLocaleString(locale2, {
56803             maximumSignificantDigits: 2
56804           })
56805         })
56806       });
56807     } else {
56808       return area;
56809     }
56810   }
56811   function wrap(x2, min3, max3) {
56812     var d2 = max3 - min3;
56813     return ((x2 - min3) % d2 + d2) % d2 + min3;
56814   }
56815   function clamp2(x2, min3, max3) {
56816     return Math.max(min3, Math.min(x2, max3));
56817   }
56818   function displayCoordinate(deg, pos, neg) {
56819     var locale2 = _mainLocalizer.localeCode();
56820     var min3 = (Math.abs(deg) - Math.floor(Math.abs(deg))) * 60;
56821     var sec = (min3 - Math.floor(min3)) * 60;
56822     var displayDegrees = _t("units.arcdegrees", {
56823       quantity: Math.floor(Math.abs(deg)).toLocaleString(locale2)
56824     });
56825     var displayCoordinate2;
56826     if (Math.floor(sec) > 0) {
56827       displayCoordinate2 = displayDegrees + _t("units.arcminutes", {
56828         quantity: Math.floor(min3).toLocaleString(locale2)
56829       }) + _t("units.arcseconds", {
56830         quantity: Math.round(sec).toLocaleString(locale2)
56831       });
56832     } else if (Math.floor(min3) > 0) {
56833       displayCoordinate2 = displayDegrees + _t("units.arcminutes", {
56834         quantity: Math.round(min3).toLocaleString(locale2)
56835       });
56836     } else {
56837       displayCoordinate2 = _t("units.arcdegrees", {
56838         quantity: Math.round(Math.abs(deg)).toLocaleString(locale2)
56839       });
56840     }
56841     if (deg === 0) {
56842       return displayCoordinate2;
56843     } else {
56844       return _t("units.coordinate", {
56845         coordinate: displayCoordinate2,
56846         direction: _t("units." + (deg > 0 ? pos : neg))
56847       });
56848     }
56849   }
56850   function dmsCoordinatePair(coord2) {
56851     return _t("units.coordinate_pair", {
56852       latitude: displayCoordinate(clamp2(coord2[1], -90, 90), "north", "south"),
56853       longitude: displayCoordinate(wrap(coord2[0], -180, 180), "east", "west")
56854     });
56855   }
56856   function decimalCoordinatePair(coord2) {
56857     return _t("units.coordinate_pair", {
56858       latitude: clamp2(coord2[1], -90, 90).toFixed(OSM_PRECISION),
56859       longitude: wrap(coord2[0], -180, 180).toFixed(OSM_PRECISION)
56860     });
56861   }
56862
56863   // modules/ui/panels/location.js
56864   function uiPanelLocation(context) {
56865     var currLocation = "";
56866     function redraw(selection2) {
56867       selection2.html("");
56868       var list = selection2.append("ul");
56869       var coord2 = context.map().mouseCoordinates();
56870       if (coord2.some(isNaN)) {
56871         coord2 = context.map().center();
56872       }
56873       list.append("li").text(dmsCoordinatePair(coord2)).append("li").text(decimalCoordinatePair(coord2));
56874       selection2.append("div").attr("class", "location-info").text(currLocation || " ");
56875       debouncedGetLocation(selection2, coord2);
56876     }
56877     var debouncedGetLocation = debounce_default(getLocation, 250);
56878     function getLocation(selection2, coord2) {
56879       if (!services.geocoder) {
56880         currLocation = _t("info_panels.location.unknown_location");
56881         selection2.selectAll(".location-info").text(currLocation);
56882       } else {
56883         services.geocoder.reverse(coord2, function(err, result) {
56884           currLocation = result ? result.display_name : _t("info_panels.location.unknown_location");
56885           selection2.selectAll(".location-info").text(currLocation);
56886         });
56887       }
56888     }
56889     var panel = function(selection2) {
56890       selection2.call(redraw);
56891       context.surface().on(("PointerEvent" in window ? "pointer" : "mouse") + "move.info-location", function() {
56892         selection2.call(redraw);
56893       });
56894     };
56895     panel.off = function() {
56896       context.surface().on(".info-location", null);
56897     };
56898     panel.id = "location";
56899     panel.label = _t.append("info_panels.location.title");
56900     panel.key = _t("info_panels.location.key");
56901     return panel;
56902   }
56903
56904   // modules/ui/panels/measurement.js
56905   function uiPanelMeasurement(context) {
56906     function radiansToMeters(r2) {
56907       return r2 * 63710071809e-4;
56908     }
56909     function steradiansToSqmeters(r2) {
56910       return r2 / (4 * Math.PI) * 510065621724e3;
56911     }
56912     function toLineString(feature3) {
56913       if (feature3.type === "LineString")
56914         return feature3;
56915       var result = { type: "LineString", coordinates: [] };
56916       if (feature3.type === "Polygon") {
56917         result.coordinates = feature3.coordinates[0];
56918       } else if (feature3.type === "MultiPolygon") {
56919         result.coordinates = feature3.coordinates[0][0];
56920       }
56921       return result;
56922     }
56923     var _isImperial = !_mainLocalizer.usesMetric();
56924     function redraw(selection2) {
56925       var graph = context.graph();
56926       var selectedNoteID = context.selectedNoteID();
56927       var osm = services.osm;
56928       var localeCode = _mainLocalizer.localeCode();
56929       var heading;
56930       var center, location, centroid;
56931       var closed, geometry;
56932       var totalNodeCount, length = 0, area = 0, distance;
56933       if (selectedNoteID && osm) {
56934         var note = osm.getNote(selectedNoteID);
56935         heading = _t.html("note.note") + " " + selectedNoteID;
56936         location = note.loc;
56937         geometry = "note";
56938       } else {
56939         var selectedIDs = context.selectedIDs().filter(function(id2) {
56940           return context.hasEntity(id2);
56941         });
56942         var selected = selectedIDs.map(function(id2) {
56943           return context.entity(id2);
56944         });
56945         heading = selected.length === 1 ? selected[0].id : _t.html("info_panels.selected", { n: selected.length });
56946         if (selected.length) {
56947           var extent = geoExtent();
56948           for (var i3 in selected) {
56949             var entity = selected[i3];
56950             extent._extend(entity.extent(graph));
56951             geometry = entity.geometry(graph);
56952             if (geometry === "line" || geometry === "area") {
56953               closed = entity.type === "relation" || entity.isClosed() && !entity.isDegenerate();
56954               var feature3 = entity.asGeoJSON(graph);
56955               length += radiansToMeters(length_default(toLineString(feature3)));
56956               centroid = path_default(context.projection).centroid(entity.asGeoJSON(graph));
56957               centroid = centroid && context.projection.invert(centroid);
56958               if (!centroid || !isFinite(centroid[0]) || !isFinite(centroid[1])) {
56959                 centroid = entity.extent(graph).center();
56960               }
56961               if (closed) {
56962                 area += steradiansToSqmeters(entity.area(graph));
56963               }
56964             }
56965           }
56966           if (selected.length > 1) {
56967             geometry = null;
56968             closed = null;
56969             centroid = null;
56970           }
56971           if (selected.length === 2 && selected[0].type === "node" && selected[1].type === "node") {
56972             distance = geoSphericalDistance(selected[0].loc, selected[1].loc);
56973           }
56974           if (selected.length === 1 && selected[0].type === "node") {
56975             location = selected[0].loc;
56976           } else {
56977             totalNodeCount = utilGetAllNodes(selectedIDs, context.graph()).length;
56978           }
56979           if (!location && !centroid) {
56980             center = extent.center();
56981           }
56982         }
56983       }
56984       selection2.html("");
56985       if (heading) {
56986         selection2.append("h4").attr("class", "measurement-heading").html(heading);
56987       }
56988       var list = selection2.append("ul");
56989       var coordItem;
56990       if (geometry) {
56991         list.append("li").call(_t.append("info_panels.measurement.geometry", { suffix: ":" })).append("span").html(
56992           closed ? _t.html("info_panels.measurement.closed_" + geometry) : _t.html("geometry." + geometry)
56993         );
56994       }
56995       if (totalNodeCount) {
56996         list.append("li").call(_t.append("info_panels.measurement.node_count", { suffix: ":" })).append("span").text(totalNodeCount.toLocaleString(localeCode));
56997       }
56998       if (area) {
56999         list.append("li").call(_t.append("info_panels.measurement.area", { suffix: ":" })).append("span").text(displayArea(area, _isImperial));
57000       }
57001       if (length) {
57002         list.append("li").call(_t.append("info_panels.measurement." + (closed ? "perimeter" : "length"), { suffix: ":" })).append("span").text(displayLength(length, _isImperial));
57003       }
57004       if (typeof distance === "number") {
57005         list.append("li").call(_t.append("info_panels.measurement.distance", { suffix: ":" })).append("span").text(displayLength(distance, _isImperial));
57006       }
57007       if (location) {
57008         coordItem = list.append("li").call(_t.append("info_panels.measurement.location", { suffix: ":" }));
57009         coordItem.append("span").text(dmsCoordinatePair(location));
57010         coordItem.append("span").text(decimalCoordinatePair(location));
57011       }
57012       if (centroid) {
57013         coordItem = list.append("li").call(_t.append("info_panels.measurement.centroid", { suffix: ":" }));
57014         coordItem.append("span").text(dmsCoordinatePair(centroid));
57015         coordItem.append("span").text(decimalCoordinatePair(centroid));
57016       }
57017       if (center) {
57018         coordItem = list.append("li").call(_t.append("info_panels.measurement.center", { suffix: ":" }));
57019         coordItem.append("span").text(dmsCoordinatePair(center));
57020         coordItem.append("span").text(decimalCoordinatePair(center));
57021       }
57022       if (length || area || typeof distance === "number") {
57023         var toggle = _isImperial ? "imperial" : "metric";
57024         selection2.append("a").call(_t.append("info_panels.measurement." + toggle)).attr("href", "#").attr("class", "button button-toggle-units").on("click", function(d3_event) {
57025           d3_event.preventDefault();
57026           _isImperial = !_isImperial;
57027           selection2.call(redraw);
57028         });
57029       }
57030     }
57031     var panel = function(selection2) {
57032       selection2.call(redraw);
57033       context.map().on("drawn.info-measurement", function() {
57034         selection2.call(redraw);
57035       });
57036       context.on("enter.info-measurement", function() {
57037         selection2.call(redraw);
57038       });
57039     };
57040     panel.off = function() {
57041       context.map().on("drawn.info-measurement", null);
57042       context.on("enter.info-measurement", null);
57043     };
57044     panel.id = "measurement";
57045     panel.label = _t.append("info_panels.measurement.title");
57046     panel.key = _t("info_panels.measurement.key");
57047     return panel;
57048   }
57049
57050   // modules/ui/panels/index.js
57051   var uiInfoPanels = {
57052     background: uiPanelBackground,
57053     history: uiPanelHistory,
57054     location: uiPanelLocation,
57055     measurement: uiPanelMeasurement
57056   };
57057
57058   // modules/ui/info.js
57059   function uiInfo(context) {
57060     var ids = Object.keys(uiInfoPanels);
57061     var wasActive = ["measurement"];
57062     var panels = {};
57063     var active = {};
57064     ids.forEach(function(k2) {
57065       if (!panels[k2]) {
57066         panels[k2] = uiInfoPanels[k2](context);
57067         active[k2] = false;
57068       }
57069     });
57070     function info(selection2) {
57071       function redraw() {
57072         var activeids = ids.filter(function(k2) {
57073           return active[k2];
57074         }).sort();
57075         var containers = infoPanels.selectAll(".panel-container").data(activeids, function(k2) {
57076           return k2;
57077         });
57078         containers.exit().style("opacity", 1).transition().duration(200).style("opacity", 0).on("end", function(d2) {
57079           select_default2(this).call(panels[d2].off).remove();
57080         });
57081         var enter = containers.enter().append("div").attr("class", function(d2) {
57082           return "fillD2 panel-container panel-container-" + d2;
57083         });
57084         enter.style("opacity", 0).transition().duration(200).style("opacity", 1);
57085         var title = enter.append("div").attr("class", "panel-title fillD2");
57086         title.append("h3").each(function(d2) {
57087           return panels[d2].label(select_default2(this));
57088         });
57089         title.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function(d3_event, d2) {
57090           d3_event.stopImmediatePropagation();
57091           d3_event.preventDefault();
57092           info.toggle(d2);
57093         }).call(svgIcon("#iD-icon-close"));
57094         enter.append("div").attr("class", function(d2) {
57095           return "panel-content panel-content-" + d2;
57096         });
57097         infoPanels.selectAll(".panel-content").each(function(d2) {
57098           select_default2(this).call(panels[d2]);
57099         });
57100       }
57101       info.toggle = function(which) {
57102         var activeids = ids.filter(function(k2) {
57103           return active[k2];
57104         });
57105         if (which) {
57106           active[which] = !active[which];
57107           if (activeids.length === 1 && activeids[0] === which) {
57108             wasActive = [which];
57109           }
57110           context.container().select("." + which + "-panel-toggle-item").classed("active", active[which]).select("input").property("checked", active[which]);
57111         } else {
57112           if (activeids.length) {
57113             wasActive = activeids;
57114             activeids.forEach(function(k2) {
57115               active[k2] = false;
57116             });
57117           } else {
57118             wasActive.forEach(function(k2) {
57119               active[k2] = true;
57120             });
57121           }
57122         }
57123         redraw();
57124       };
57125       var infoPanels = selection2.selectAll(".info-panels").data([0]);
57126       infoPanels = infoPanels.enter().append("div").attr("class", "info-panels").merge(infoPanels);
57127       redraw();
57128       context.keybinding().on(uiCmd("\u2318" + _t("info_panels.key")), function(d3_event) {
57129         d3_event.stopImmediatePropagation();
57130         d3_event.preventDefault();
57131         info.toggle();
57132       });
57133       ids.forEach(function(k2) {
57134         var key = _t("info_panels." + k2 + ".key", { default: null });
57135         if (!key)
57136           return;
57137         context.keybinding().on(uiCmd("\u2318\u21E7" + key), function(d3_event) {
57138           d3_event.stopImmediatePropagation();
57139           d3_event.preventDefault();
57140           info.toggle(k2);
57141         });
57142       });
57143     }
57144     return info;
57145   }
57146
57147   // modules/ui/intro/helper.js
57148   function pointBox(loc, context) {
57149     var rect = context.surfaceRect();
57150     var point2 = context.curtainProjection(loc);
57151     return {
57152       left: point2[0] + rect.left - 40,
57153       top: point2[1] + rect.top - 60,
57154       width: 80,
57155       height: 90
57156     };
57157   }
57158   function pad(locOrBox, padding, context) {
57159     var box;
57160     if (locOrBox instanceof Array) {
57161       var rect = context.surfaceRect();
57162       var point2 = context.curtainProjection(locOrBox);
57163       box = {
57164         left: point2[0] + rect.left,
57165         top: point2[1] + rect.top
57166       };
57167     } else {
57168       box = locOrBox;
57169     }
57170     return {
57171       left: box.left - padding,
57172       top: box.top - padding,
57173       width: (box.width || 0) + 2 * padding,
57174       height: (box.width || 0) + 2 * padding
57175     };
57176   }
57177   function icon(name, svgklass, useklass) {
57178     return '<svg class="icon ' + (svgklass || "") + '"><use xlink:href="' + name + '"' + (useklass ? ' class="' + useklass + '"' : "") + "></use></svg>";
57179   }
57180   var helpStringReplacements;
57181   function helpHtml(id2, replacements) {
57182     if (!helpStringReplacements) {
57183       helpStringReplacements = {
57184         // insert icons corresponding to various UI elements
57185         point_icon: icon("#iD-icon-point", "inline"),
57186         line_icon: icon("#iD-icon-line", "inline"),
57187         area_icon: icon("#iD-icon-area", "inline"),
57188         note_icon: icon("#iD-icon-note", "inline add-note"),
57189         plus: icon("#iD-icon-plus", "inline"),
57190         minus: icon("#iD-icon-minus", "inline"),
57191         layers_icon: icon("#iD-icon-layers", "inline"),
57192         data_icon: icon("#iD-icon-data", "inline"),
57193         inspect: icon("#iD-icon-inspect", "inline"),
57194         help_icon: icon("#iD-icon-help", "inline"),
57195         undo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo", "inline"),
57196         redo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-undo" : "#iD-icon-redo", "inline"),
57197         save_icon: icon("#iD-icon-save", "inline"),
57198         // operation icons
57199         circularize_icon: icon("#iD-operation-circularize", "inline operation"),
57200         continue_icon: icon("#iD-operation-continue", "inline operation"),
57201         copy_icon: icon("#iD-operation-copy", "inline operation"),
57202         delete_icon: icon("#iD-operation-delete", "inline operation"),
57203         disconnect_icon: icon("#iD-operation-disconnect", "inline operation"),
57204         downgrade_icon: icon("#iD-operation-downgrade", "inline operation"),
57205         extract_icon: icon("#iD-operation-extract", "inline operation"),
57206         merge_icon: icon("#iD-operation-merge", "inline operation"),
57207         move_icon: icon("#iD-operation-move", "inline operation"),
57208         orthogonalize_icon: icon("#iD-operation-orthogonalize", "inline operation"),
57209         paste_icon: icon("#iD-operation-paste", "inline operation"),
57210         reflect_long_icon: icon("#iD-operation-reflect-long", "inline operation"),
57211         reflect_short_icon: icon("#iD-operation-reflect-short", "inline operation"),
57212         reverse_icon: icon("#iD-operation-reverse", "inline operation"),
57213         rotate_icon: icon("#iD-operation-rotate", "inline operation"),
57214         split_icon: icon("#iD-operation-split", "inline operation"),
57215         straighten_icon: icon("#iD-operation-straighten", "inline operation"),
57216         // interaction icons
57217         leftclick: icon("#iD-walkthrough-mouse-left", "inline operation"),
57218         rightclick: icon("#iD-walkthrough-mouse-right", "inline operation"),
57219         mousewheel_icon: icon("#iD-walkthrough-mousewheel", "inline operation"),
57220         tap_icon: icon("#iD-walkthrough-tap", "inline operation"),
57221         doubletap_icon: icon("#iD-walkthrough-doubletap", "inline operation"),
57222         longpress_icon: icon("#iD-walkthrough-longpress", "inline operation"),
57223         touchdrag_icon: icon("#iD-walkthrough-touchdrag", "inline operation"),
57224         pinch_icon: icon("#iD-walkthrough-pinch-apart", "inline operation"),
57225         // insert keys; may be localized and platform-dependent
57226         shift: uiCmd.display("\u21E7"),
57227         alt: uiCmd.display("\u2325"),
57228         return: uiCmd.display("\u21B5"),
57229         esc: _t.html("shortcuts.key.esc"),
57230         space: _t.html("shortcuts.key.space"),
57231         add_note_key: _t.html("modes.add_note.key"),
57232         help_key: _t.html("help.key"),
57233         shortcuts_key: _t.html("shortcuts.toggle.key"),
57234         // reference localized UI labels directly so that they'll always match
57235         save: _t.html("save.title"),
57236         undo: _t.html("undo.title"),
57237         redo: _t.html("redo.title"),
57238         upload: _t.html("commit.save"),
57239         point: _t.html("modes.add_point.title"),
57240         line: _t.html("modes.add_line.title"),
57241         area: _t.html("modes.add_area.title"),
57242         note: _t.html("modes.add_note.label"),
57243         circularize: _t.html("operations.circularize.title"),
57244         continue: _t.html("operations.continue.title"),
57245         copy: _t.html("operations.copy.title"),
57246         delete: _t.html("operations.delete.title"),
57247         disconnect: _t.html("operations.disconnect.title"),
57248         downgrade: _t.html("operations.downgrade.title"),
57249         extract: _t.html("operations.extract.title"),
57250         merge: _t.html("operations.merge.title"),
57251         move: _t.html("operations.move.title"),
57252         orthogonalize: _t.html("operations.orthogonalize.title"),
57253         paste: _t.html("operations.paste.title"),
57254         reflect_long: _t.html("operations.reflect.title.long"),
57255         reflect_short: _t.html("operations.reflect.title.short"),
57256         reverse: _t.html("operations.reverse.title"),
57257         rotate: _t.html("operations.rotate.title"),
57258         split: _t.html("operations.split.title"),
57259         straighten: _t.html("operations.straighten.title"),
57260         map_data: _t.html("map_data.title"),
57261         osm_notes: _t.html("map_data.layers.notes.title"),
57262         fields: _t.html("inspector.fields"),
57263         tags: _t.html("inspector.tags"),
57264         relations: _t.html("inspector.relations"),
57265         new_relation: _t.html("inspector.new_relation"),
57266         turn_restrictions: _t.html("_tagging.presets.fields.restrictions.label"),
57267         background_settings: _t.html("background.description"),
57268         imagery_offset: _t.html("background.fix_misalignment"),
57269         start_the_walkthrough: _t.html("splash.walkthrough"),
57270         help: _t.html("help.title"),
57271         ok: _t.html("intro.ok")
57272       };
57273       for (var key in helpStringReplacements) {
57274         helpStringReplacements[key] = { html: helpStringReplacements[key] };
57275       }
57276     }
57277     var reps;
57278     if (replacements) {
57279       reps = Object.assign(replacements, helpStringReplacements);
57280     } else {
57281       reps = helpStringReplacements;
57282     }
57283     return _t.html(id2, reps).replace(/\`(.*?)\`/g, "<kbd>$1</kbd>");
57284   }
57285   function slugify(text2) {
57286     return text2.toString().toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
57287   }
57288   var missingStrings = {};
57289   function checkKey(key, text2) {
57290     if (_t(key, { default: void 0 }) === void 0) {
57291       if (missingStrings.hasOwnProperty(key))
57292         return;
57293       missingStrings[key] = text2;
57294       var missing = key + ": " + text2;
57295       if (typeof console !== "undefined")
57296         console.log(missing);
57297     }
57298   }
57299   function localize(obj) {
57300     var key;
57301     var name = obj.tags && obj.tags.name;
57302     if (name) {
57303       key = "intro.graph.name." + slugify(name);
57304       obj.tags.name = _t(key, { default: name });
57305       checkKey(key, name);
57306     }
57307     var street = obj.tags && obj.tags["addr:street"];
57308     if (street) {
57309       key = "intro.graph.name." + slugify(street);
57310       obj.tags["addr:street"] = _t(key, { default: street });
57311       checkKey(key, street);
57312       var addrTags = [
57313         "block_number",
57314         "city",
57315         "county",
57316         "district",
57317         "hamlet",
57318         "neighbourhood",
57319         "postcode",
57320         "province",
57321         "quarter",
57322         "state",
57323         "subdistrict",
57324         "suburb"
57325       ];
57326       addrTags.forEach(function(k2) {
57327         var key2 = "intro.graph." + k2;
57328         var tag = "addr:" + k2;
57329         var val = obj.tags && obj.tags[tag];
57330         var str2 = _t(key2, { default: val });
57331         if (str2) {
57332           if (str2.match(/^<.*>$/) !== null) {
57333             delete obj.tags[tag];
57334           } else {
57335             obj.tags[tag] = str2;
57336           }
57337         }
57338       });
57339     }
57340     return obj;
57341   }
57342   function isMostlySquare(points) {
57343     var threshold = 15;
57344     var lowerBound = Math.cos((90 - threshold) * Math.PI / 180);
57345     var upperBound = Math.cos(threshold * Math.PI / 180);
57346     for (var i3 = 0; i3 < points.length; i3++) {
57347       var a2 = points[(i3 - 1 + points.length) % points.length];
57348       var origin = points[i3];
57349       var b2 = points[(i3 + 1) % points.length];
57350       var dotp = geoVecNormalizedDot(a2, b2, origin);
57351       var mag = Math.abs(dotp);
57352       if (mag > lowerBound && mag < upperBound) {
57353         return false;
57354       }
57355     }
57356     return true;
57357   }
57358   function selectMenuItem(context, operation) {
57359     return context.container().select(".edit-menu .edit-menu-item-" + operation);
57360   }
57361   function transitionTime(point1, point2) {
57362     var distance = geoSphericalDistance(point1, point2);
57363     if (distance === 0) {
57364       return 0;
57365     } else if (distance < 80) {
57366       return 500;
57367     } else {
57368       return 1e3;
57369     }
57370   }
57371
57372   // modules/ui/toggle.js
57373   function uiToggle(show, callback) {
57374     return function(selection2) {
57375       selection2.style("opacity", show ? 0 : 1).classed("hide", false).transition().style("opacity", show ? 1 : 0).on("end", function() {
57376         select_default2(this).classed("hide", !show).style("opacity", null);
57377         if (callback)
57378           callback.apply(this);
57379       });
57380     };
57381   }
57382
57383   // modules/ui/curtain.js
57384   function uiCurtain(containerNode) {
57385     var surface = select_default2(null), tooltip = select_default2(null), darkness = select_default2(null);
57386     function curtain(selection2) {
57387       surface = selection2.append("svg").attr("class", "curtain").style("top", 0).style("left", 0);
57388       darkness = surface.append("path").attr("x", 0).attr("y", 0).attr("class", "curtain-darkness");
57389       select_default2(window).on("resize.curtain", resize);
57390       tooltip = selection2.append("div").attr("class", "tooltip");
57391       tooltip.append("div").attr("class", "popover-arrow");
57392       tooltip.append("div").attr("class", "popover-inner");
57393       resize();
57394       function resize() {
57395         surface.attr("width", containerNode.clientWidth).attr("height", containerNode.clientHeight);
57396         curtain.cut(darkness.datum());
57397       }
57398     }
57399     curtain.reveal = function(box, html2, options2) {
57400       options2 = options2 || {};
57401       if (typeof box === "string") {
57402         box = select_default2(box).node();
57403       }
57404       if (box && box.getBoundingClientRect) {
57405         box = copyBox(box.getBoundingClientRect());
57406         var containerRect = containerNode.getBoundingClientRect();
57407         box.top -= containerRect.top;
57408         box.left -= containerRect.left;
57409       }
57410       if (box && options2.padding) {
57411         box.top -= options2.padding;
57412         box.left -= options2.padding;
57413         box.bottom += options2.padding;
57414         box.right += options2.padding;
57415         box.height += options2.padding * 2;
57416         box.width += options2.padding * 2;
57417       }
57418       var tooltipBox;
57419       if (options2.tooltipBox) {
57420         tooltipBox = options2.tooltipBox;
57421         if (typeof tooltipBox === "string") {
57422           tooltipBox = select_default2(tooltipBox).node();
57423         }
57424         if (tooltipBox && tooltipBox.getBoundingClientRect) {
57425           tooltipBox = copyBox(tooltipBox.getBoundingClientRect());
57426         }
57427       } else {
57428         tooltipBox = box;
57429       }
57430       if (tooltipBox && html2) {
57431         if (html2.indexOf("**") !== -1) {
57432           if (html2.indexOf("<span") === 0) {
57433             html2 = html2.replace(/^(<span.*?>)(.+?)(\*\*)/, "$1<span>$2</span>$3");
57434           } else {
57435             html2 = html2.replace(/^(.+?)(\*\*)/, "<span>$1</span>$2");
57436           }
57437           html2 = html2.replace(/\*\*(.*?)\*\*/g, '<span class="instruction">$1</span>');
57438         }
57439         html2 = html2.replace(/\*(.*?)\*/g, "<em>$1</em>");
57440         html2 = html2.replace(/\{br\}/g, "<br/><br/>");
57441         if (options2.buttonText && options2.buttonCallback) {
57442           html2 += '<div class="button-section"><button href="#" class="button action">' + options2.buttonText + "</button></div>";
57443         }
57444         var classes = "curtain-tooltip popover tooltip arrowed in " + (options2.tooltipClass || "");
57445         tooltip.classed(classes, true).selectAll(".popover-inner").html(html2);
57446         if (options2.buttonText && options2.buttonCallback) {
57447           var button = tooltip.selectAll(".button-section .button.action");
57448           button.on("click", function(d3_event) {
57449             d3_event.preventDefault();
57450             options2.buttonCallback();
57451           });
57452         }
57453         var tip = copyBox(tooltip.node().getBoundingClientRect()), w2 = containerNode.clientWidth, h2 = containerNode.clientHeight, tooltipWidth = 200, tooltipArrow = 5, side, pos;
57454         if (options2.tooltipClass === "intro-mouse") {
57455           tip.height += 80;
57456         }
57457         if (tooltipBox.top + tooltipBox.height > h2) {
57458           tooltipBox.height -= tooltipBox.top + tooltipBox.height - h2;
57459         }
57460         if (tooltipBox.left + tooltipBox.width > w2) {
57461           tooltipBox.width -= tooltipBox.left + tooltipBox.width - w2;
57462         }
57463         if (tooltipBox.top + tooltipBox.height < 100) {
57464           side = "bottom";
57465           pos = [
57466             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
57467             tooltipBox.top + tooltipBox.height
57468           ];
57469         } else if (tooltipBox.top > h2 - 140) {
57470           side = "top";
57471           pos = [
57472             tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
57473             tooltipBox.top - tip.height
57474           ];
57475         } else {
57476           var tipY = tooltipBox.top + tooltipBox.height / 2 - tip.height / 2;
57477           if (_mainLocalizer.textDirection() === "rtl") {
57478             if (tooltipBox.left - tooltipWidth - tooltipArrow < 70) {
57479               side = "right";
57480               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
57481             } else {
57482               side = "left";
57483               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
57484             }
57485           } else {
57486             if (tooltipBox.left + tooltipBox.width + tooltipArrow + tooltipWidth > w2 - 70) {
57487               side = "left";
57488               pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
57489             } else {
57490               side = "right";
57491               pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
57492             }
57493           }
57494         }
57495         if (options2.duration !== 0 || !tooltip.classed(side)) {
57496           tooltip.call(uiToggle(true));
57497         }
57498         tooltip.style("top", pos[1] + "px").style("left", pos[0] + "px").attr("class", classes + " " + side);
57499         var shiftY = 0;
57500         if (side === "left" || side === "right") {
57501           if (pos[1] < 60) {
57502             shiftY = 60 - pos[1];
57503           } else if (pos[1] + tip.height > h2 - 100) {
57504             shiftY = h2 - pos[1] - tip.height - 100;
57505           }
57506         }
57507         tooltip.selectAll(".popover-inner").style("top", shiftY + "px");
57508       } else {
57509         tooltip.classed("in", false).call(uiToggle(false));
57510       }
57511       curtain.cut(box, options2.duration);
57512       return tooltip;
57513     };
57514     curtain.cut = function(datum2, duration) {
57515       darkness.datum(datum2).interrupt();
57516       var selection2;
57517       if (duration === 0) {
57518         selection2 = darkness;
57519       } else {
57520         selection2 = darkness.transition().duration(duration || 600).ease(linear2);
57521       }
57522       selection2.attr("d", function(d2) {
57523         var containerWidth = containerNode.clientWidth;
57524         var containerHeight = containerNode.clientHeight;
57525         var string = "M 0,0 L 0," + containerHeight + " L " + containerWidth + "," + containerHeight + "L" + containerWidth + ",0 Z";
57526         if (!d2)
57527           return string;
57528         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";
57529       });
57530     };
57531     curtain.remove = function() {
57532       surface.remove();
57533       tooltip.remove();
57534       select_default2(window).on("resize.curtain", null);
57535     };
57536     function copyBox(src) {
57537       return {
57538         top: src.top,
57539         right: src.right,
57540         bottom: src.bottom,
57541         left: src.left,
57542         width: src.width,
57543         height: src.height
57544       };
57545     }
57546     return curtain;
57547   }
57548
57549   // modules/ui/intro/welcome.js
57550   function uiIntroWelcome(context, reveal) {
57551     var dispatch14 = dispatch_default("done");
57552     var chapter = {
57553       title: "intro.welcome.title"
57554     };
57555     function welcome() {
57556       context.map().centerZoom([-85.63591, 41.94285], 19);
57557       reveal(
57558         ".intro-nav-wrap .chapter-welcome",
57559         helpHtml("intro.welcome.welcome"),
57560         { buttonText: _t.html("intro.ok"), buttonCallback: practice }
57561       );
57562     }
57563     function practice() {
57564       reveal(
57565         ".intro-nav-wrap .chapter-welcome",
57566         helpHtml("intro.welcome.practice"),
57567         { buttonText: _t.html("intro.ok"), buttonCallback: words }
57568       );
57569     }
57570     function words() {
57571       reveal(
57572         ".intro-nav-wrap .chapter-welcome",
57573         helpHtml("intro.welcome.words"),
57574         { buttonText: _t.html("intro.ok"), buttonCallback: chapters }
57575       );
57576     }
57577     function chapters() {
57578       dispatch14.call("done");
57579       reveal(
57580         ".intro-nav-wrap .chapter-navigation",
57581         helpHtml("intro.welcome.chapters", { next: _t("intro.navigation.title") })
57582       );
57583     }
57584     chapter.enter = function() {
57585       welcome();
57586     };
57587     chapter.exit = function() {
57588       context.container().select(".curtain-tooltip.intro-mouse").selectAll(".counter").remove();
57589     };
57590     chapter.restart = function() {
57591       chapter.exit();
57592       chapter.enter();
57593     };
57594     return utilRebind(chapter, dispatch14, "on");
57595   }
57596
57597   // modules/ui/intro/navigation.js
57598   function uiIntroNavigation(context, reveal) {
57599     var dispatch14 = dispatch_default("done");
57600     var timeouts = [];
57601     var hallId = "n2061";
57602     var townHall = [-85.63591, 41.94285];
57603     var springStreetId = "w397";
57604     var springStreetEndId = "n1834";
57605     var springStreet = [-85.63582, 41.94255];
57606     var onewayField = _mainPresetIndex.field("oneway");
57607     var maxspeedField = _mainPresetIndex.field("maxspeed");
57608     var chapter = {
57609       title: "intro.navigation.title"
57610     };
57611     function timeout2(f3, t2) {
57612       timeouts.push(window.setTimeout(f3, t2));
57613     }
57614     function eventCancel(d3_event) {
57615       d3_event.stopPropagation();
57616       d3_event.preventDefault();
57617     }
57618     function isTownHallSelected() {
57619       var ids = context.selectedIDs();
57620       return ids.length === 1 && ids[0] === hallId;
57621     }
57622     function dragMap() {
57623       context.enter(modeBrowse(context));
57624       context.history().reset("initial");
57625       var msec = transitionTime(townHall, context.map().center());
57626       if (msec) {
57627         reveal(null, null, { duration: 0 });
57628       }
57629       context.map().centerZoomEase(townHall, 19, msec);
57630       timeout2(function() {
57631         var centerStart = context.map().center();
57632         var textId = context.lastPointerType() === "mouse" ? "drag" : "drag_touch";
57633         var dragString = helpHtml("intro.navigation.map_info") + "{br}" + helpHtml("intro.navigation." + textId);
57634         reveal(".surface", dragString);
57635         context.map().on("drawn.intro", function() {
57636           reveal(".surface", dragString, { duration: 0 });
57637         });
57638         context.map().on("move.intro", function() {
57639           var centerNow = context.map().center();
57640           if (centerStart[0] !== centerNow[0] || centerStart[1] !== centerNow[1]) {
57641             context.map().on("move.intro", null);
57642             timeout2(function() {
57643               continueTo(zoomMap);
57644             }, 3e3);
57645           }
57646         });
57647       }, msec + 100);
57648       function continueTo(nextStep) {
57649         context.map().on("move.intro drawn.intro", null);
57650         nextStep();
57651       }
57652     }
57653     function zoomMap() {
57654       var zoomStart = context.map().zoom();
57655       var textId = context.lastPointerType() === "mouse" ? "zoom" : "zoom_touch";
57656       var zoomString = helpHtml("intro.navigation." + textId);
57657       reveal(".surface", zoomString);
57658       context.map().on("drawn.intro", function() {
57659         reveal(".surface", zoomString, { duration: 0 });
57660       });
57661       context.map().on("move.intro", function() {
57662         if (context.map().zoom() !== zoomStart) {
57663           context.map().on("move.intro", null);
57664           timeout2(function() {
57665             continueTo(features);
57666           }, 3e3);
57667         }
57668       });
57669       function continueTo(nextStep) {
57670         context.map().on("move.intro drawn.intro", null);
57671         nextStep();
57672       }
57673     }
57674     function features() {
57675       var onClick = function() {
57676         continueTo(pointsLinesAreas);
57677       };
57678       reveal(
57679         ".surface",
57680         helpHtml("intro.navigation.features"),
57681         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57682       );
57683       context.map().on("drawn.intro", function() {
57684         reveal(
57685           ".surface",
57686           helpHtml("intro.navigation.features"),
57687           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57688         );
57689       });
57690       function continueTo(nextStep) {
57691         context.map().on("drawn.intro", null);
57692         nextStep();
57693       }
57694     }
57695     function pointsLinesAreas() {
57696       var onClick = function() {
57697         continueTo(nodesWays);
57698       };
57699       reveal(
57700         ".surface",
57701         helpHtml("intro.navigation.points_lines_areas"),
57702         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57703       );
57704       context.map().on("drawn.intro", function() {
57705         reveal(
57706           ".surface",
57707           helpHtml("intro.navigation.points_lines_areas"),
57708           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57709         );
57710       });
57711       function continueTo(nextStep) {
57712         context.map().on("drawn.intro", null);
57713         nextStep();
57714       }
57715     }
57716     function nodesWays() {
57717       var onClick = function() {
57718         continueTo(clickTownHall);
57719       };
57720       reveal(
57721         ".surface",
57722         helpHtml("intro.navigation.nodes_ways"),
57723         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57724       );
57725       context.map().on("drawn.intro", function() {
57726         reveal(
57727           ".surface",
57728           helpHtml("intro.navigation.nodes_ways"),
57729           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57730         );
57731       });
57732       function continueTo(nextStep) {
57733         context.map().on("drawn.intro", null);
57734         nextStep();
57735       }
57736     }
57737     function clickTownHall() {
57738       context.enter(modeBrowse(context));
57739       context.history().reset("initial");
57740       var entity = context.hasEntity(hallId);
57741       if (!entity)
57742         return;
57743       reveal(null, null, { duration: 0 });
57744       context.map().centerZoomEase(entity.loc, 19, 500);
57745       timeout2(function() {
57746         var entity2 = context.hasEntity(hallId);
57747         if (!entity2)
57748           return;
57749         var box = pointBox(entity2.loc, context);
57750         var textId = context.lastPointerType() === "mouse" ? "click_townhall" : "tap_townhall";
57751         reveal(box, helpHtml("intro.navigation." + textId));
57752         context.map().on("move.intro drawn.intro", function() {
57753           var entity3 = context.hasEntity(hallId);
57754           if (!entity3)
57755             return;
57756           var box2 = pointBox(entity3.loc, context);
57757           reveal(box2, helpHtml("intro.navigation." + textId), { duration: 0 });
57758         });
57759         context.on("enter.intro", function() {
57760           if (isTownHallSelected())
57761             continueTo(selectedTownHall);
57762         });
57763       }, 550);
57764       context.history().on("change.intro", function() {
57765         if (!context.hasEntity(hallId)) {
57766           continueTo(clickTownHall);
57767         }
57768       });
57769       function continueTo(nextStep) {
57770         context.on("enter.intro", null);
57771         context.map().on("move.intro drawn.intro", null);
57772         context.history().on("change.intro", null);
57773         nextStep();
57774       }
57775     }
57776     function selectedTownHall() {
57777       if (!isTownHallSelected())
57778         return clickTownHall();
57779       var entity = context.hasEntity(hallId);
57780       if (!entity)
57781         return clickTownHall();
57782       var box = pointBox(entity.loc, context);
57783       var onClick = function() {
57784         continueTo(editorTownHall);
57785       };
57786       reveal(
57787         box,
57788         helpHtml("intro.navigation.selected_townhall"),
57789         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57790       );
57791       context.map().on("move.intro drawn.intro", function() {
57792         var entity2 = context.hasEntity(hallId);
57793         if (!entity2)
57794           return;
57795         var box2 = pointBox(entity2.loc, context);
57796         reveal(
57797           box2,
57798           helpHtml("intro.navigation.selected_townhall"),
57799           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57800         );
57801       });
57802       context.history().on("change.intro", function() {
57803         if (!context.hasEntity(hallId)) {
57804           continueTo(clickTownHall);
57805         }
57806       });
57807       function continueTo(nextStep) {
57808         context.map().on("move.intro drawn.intro", null);
57809         context.history().on("change.intro", null);
57810         nextStep();
57811       }
57812     }
57813     function editorTownHall() {
57814       if (!isTownHallSelected())
57815         return clickTownHall();
57816       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57817       var onClick = function() {
57818         continueTo(presetTownHall);
57819       };
57820       reveal(
57821         ".entity-editor-pane",
57822         helpHtml("intro.navigation.editor_townhall"),
57823         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57824       );
57825       context.on("exit.intro", function() {
57826         continueTo(clickTownHall);
57827       });
57828       context.history().on("change.intro", function() {
57829         if (!context.hasEntity(hallId)) {
57830           continueTo(clickTownHall);
57831         }
57832       });
57833       function continueTo(nextStep) {
57834         context.on("exit.intro", null);
57835         context.history().on("change.intro", null);
57836         context.container().select(".inspector-wrap").on("wheel.intro", null);
57837         nextStep();
57838       }
57839     }
57840     function presetTownHall() {
57841       if (!isTownHallSelected())
57842         return clickTownHall();
57843       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
57844       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57845       var entity = context.entity(context.selectedIDs()[0]);
57846       var preset = _mainPresetIndex.match(entity, context.graph());
57847       var onClick = function() {
57848         continueTo(fieldsTownHall);
57849       };
57850       reveal(
57851         ".entity-editor-pane .section-feature-type",
57852         helpHtml("intro.navigation.preset_townhall", { preset: preset.name() }),
57853         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57854       );
57855       context.on("exit.intro", function() {
57856         continueTo(clickTownHall);
57857       });
57858       context.history().on("change.intro", function() {
57859         if (!context.hasEntity(hallId)) {
57860           continueTo(clickTownHall);
57861         }
57862       });
57863       function continueTo(nextStep) {
57864         context.on("exit.intro", null);
57865         context.history().on("change.intro", null);
57866         context.container().select(".inspector-wrap").on("wheel.intro", null);
57867         nextStep();
57868       }
57869     }
57870     function fieldsTownHall() {
57871       if (!isTownHallSelected())
57872         return clickTownHall();
57873       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
57874       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57875       var onClick = function() {
57876         continueTo(closeTownHall);
57877       };
57878       reveal(
57879         ".entity-editor-pane .section-preset-fields",
57880         helpHtml("intro.navigation.fields_townhall"),
57881         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57882       );
57883       context.on("exit.intro", function() {
57884         continueTo(clickTownHall);
57885       });
57886       context.history().on("change.intro", function() {
57887         if (!context.hasEntity(hallId)) {
57888           continueTo(clickTownHall);
57889         }
57890       });
57891       function continueTo(nextStep) {
57892         context.on("exit.intro", null);
57893         context.history().on("change.intro", null);
57894         context.container().select(".inspector-wrap").on("wheel.intro", null);
57895         nextStep();
57896       }
57897     }
57898     function closeTownHall() {
57899       if (!isTownHallSelected())
57900         return clickTownHall();
57901       var selector = ".entity-editor-pane button.close svg use";
57902       var href = select_default2(selector).attr("href") || "#iD-icon-close";
57903       reveal(
57904         ".entity-editor-pane",
57905         helpHtml("intro.navigation.close_townhall", { button: { html: icon(href, "inline") } })
57906       );
57907       context.on("exit.intro", function() {
57908         continueTo(searchStreet);
57909       });
57910       context.history().on("change.intro", function() {
57911         var selector2 = ".entity-editor-pane button.close svg use";
57912         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
57913         reveal(
57914           ".entity-editor-pane",
57915           helpHtml("intro.navigation.close_townhall", { button: { html: icon(href2, "inline") } }),
57916           { duration: 0 }
57917         );
57918       });
57919       function continueTo(nextStep) {
57920         context.on("exit.intro", null);
57921         context.history().on("change.intro", null);
57922         nextStep();
57923       }
57924     }
57925     function searchStreet() {
57926       context.enter(modeBrowse(context));
57927       context.history().reset("initial");
57928       var msec = transitionTime(springStreet, context.map().center());
57929       if (msec) {
57930         reveal(null, null, { duration: 0 });
57931       }
57932       context.map().centerZoomEase(springStreet, 19, msec);
57933       timeout2(function() {
57934         reveal(
57935           ".search-header input",
57936           helpHtml("intro.navigation.search_street", { name: _t("intro.graph.name.spring-street") })
57937         );
57938         context.container().select(".search-header input").on("keyup.intro", checkSearchResult);
57939       }, msec + 100);
57940     }
57941     function checkSearchResult() {
57942       var first = context.container().select(".feature-list-item:nth-child(0n+2)");
57943       var firstName = first.select(".entity-name");
57944       var name = _t("intro.graph.name.spring-street");
57945       if (!firstName.empty() && firstName.html() === name) {
57946         reveal(
57947           first.node(),
57948           helpHtml("intro.navigation.choose_street", { name }),
57949           { duration: 300 }
57950         );
57951         context.on("exit.intro", function() {
57952           continueTo(selectedStreet);
57953         });
57954         context.container().select(".search-header input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
57955       }
57956       function continueTo(nextStep) {
57957         context.on("exit.intro", null);
57958         context.container().select(".search-header input").on("keydown.intro", null).on("keyup.intro", null);
57959         nextStep();
57960       }
57961     }
57962     function selectedStreet() {
57963       if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
57964         return searchStreet();
57965       }
57966       var onClick = function() {
57967         continueTo(editorStreet);
57968       };
57969       var entity = context.entity(springStreetEndId);
57970       var box = pointBox(entity.loc, context);
57971       box.height = 500;
57972       reveal(
57973         box,
57974         helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
57975         { duration: 600, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57976       );
57977       timeout2(function() {
57978         context.map().on("move.intro drawn.intro", function() {
57979           var entity2 = context.hasEntity(springStreetEndId);
57980           if (!entity2)
57981             return;
57982           var box2 = pointBox(entity2.loc, context);
57983           box2.height = 500;
57984           reveal(
57985             box2,
57986             helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
57987             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57988           );
57989         });
57990       }, 600);
57991       context.on("enter.intro", function(mode) {
57992         if (!context.hasEntity(springStreetId)) {
57993           return continueTo(searchStreet);
57994         }
57995         var ids = context.selectedIDs();
57996         if (mode.id !== "select" || !ids.length || ids[0] !== springStreetId) {
57997           context.enter(modeSelect(context, [springStreetId]));
57998         }
57999       });
58000       context.history().on("change.intro", function() {
58001         if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
58002           timeout2(function() {
58003             continueTo(searchStreet);
58004           }, 300);
58005         }
58006       });
58007       function continueTo(nextStep) {
58008         context.map().on("move.intro drawn.intro", null);
58009         context.on("enter.intro", null);
58010         context.history().on("change.intro", null);
58011         nextStep();
58012       }
58013     }
58014     function editorStreet() {
58015       var selector = ".entity-editor-pane button.close svg use";
58016       var href = select_default2(selector).attr("href") || "#iD-icon-close";
58017       reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
58018         button: { html: icon(href, "inline") },
58019         field1: onewayField.title(),
58020         field2: maxspeedField.title()
58021       }));
58022       context.on("exit.intro", function() {
58023         continueTo(play);
58024       });
58025       context.history().on("change.intro", function() {
58026         var selector2 = ".entity-editor-pane button.close svg use";
58027         var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
58028         reveal(
58029           ".entity-editor-pane",
58030           helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
58031             button: { html: icon(href2, "inline") },
58032             field1: onewayField.title(),
58033             field2: maxspeedField.title()
58034           }),
58035           { duration: 0 }
58036         );
58037       });
58038       function continueTo(nextStep) {
58039         context.on("exit.intro", null);
58040         context.history().on("change.intro", null);
58041         nextStep();
58042       }
58043     }
58044     function play() {
58045       dispatch14.call("done");
58046       reveal(
58047         ".ideditor",
58048         helpHtml("intro.navigation.play", { next: _t("intro.points.title") }),
58049         {
58050           tooltipBox: ".intro-nav-wrap .chapter-point",
58051           buttonText: _t.html("intro.ok"),
58052           buttonCallback: function() {
58053             reveal(".ideditor");
58054           }
58055         }
58056       );
58057     }
58058     chapter.enter = function() {
58059       dragMap();
58060     };
58061     chapter.exit = function() {
58062       timeouts.forEach(window.clearTimeout);
58063       context.on("enter.intro exit.intro", null);
58064       context.map().on("move.intro drawn.intro", null);
58065       context.history().on("change.intro", null);
58066       context.container().select(".inspector-wrap").on("wheel.intro", null);
58067       context.container().select(".search-header input").on("keydown.intro keyup.intro", null);
58068     };
58069     chapter.restart = function() {
58070       chapter.exit();
58071       chapter.enter();
58072     };
58073     return utilRebind(chapter, dispatch14, "on");
58074   }
58075
58076   // modules/ui/intro/point.js
58077   function uiIntroPoint(context, reveal) {
58078     var dispatch14 = dispatch_default("done");
58079     var timeouts = [];
58080     var intersection = [-85.63279, 41.94394];
58081     var building = [-85.632422, 41.944045];
58082     var cafePreset = _mainPresetIndex.item("amenity/cafe");
58083     var _pointID = null;
58084     var chapter = {
58085       title: "intro.points.title"
58086     };
58087     function timeout2(f3, t2) {
58088       timeouts.push(window.setTimeout(f3, t2));
58089     }
58090     function eventCancel(d3_event) {
58091       d3_event.stopPropagation();
58092       d3_event.preventDefault();
58093     }
58094     function addPoint() {
58095       context.enter(modeBrowse(context));
58096       context.history().reset("initial");
58097       var msec = transitionTime(intersection, context.map().center());
58098       if (msec) {
58099         reveal(null, null, { duration: 0 });
58100       }
58101       context.map().centerZoomEase(intersection, 19, msec);
58102       timeout2(function() {
58103         var tooltip = reveal(
58104           "button.add-point",
58105           helpHtml("intro.points.points_info") + "{br}" + helpHtml("intro.points.add_point")
58106         );
58107         _pointID = null;
58108         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-points");
58109         context.on("enter.intro", function(mode) {
58110           if (mode.id !== "add-point")
58111             return;
58112           continueTo(placePoint);
58113         });
58114       }, msec + 100);
58115       function continueTo(nextStep) {
58116         context.on("enter.intro", null);
58117         nextStep();
58118       }
58119     }
58120     function placePoint() {
58121       if (context.mode().id !== "add-point") {
58122         return chapter.restart();
58123       }
58124       var pointBox2 = pad(building, 150, context);
58125       var textId = context.lastPointerType() === "mouse" ? "place_point" : "place_point_touch";
58126       reveal(pointBox2, helpHtml("intro.points." + textId));
58127       context.map().on("move.intro drawn.intro", function() {
58128         pointBox2 = pad(building, 150, context);
58129         reveal(pointBox2, helpHtml("intro.points." + textId), { duration: 0 });
58130       });
58131       context.on("enter.intro", function(mode) {
58132         if (mode.id !== "select")
58133           return chapter.restart();
58134         _pointID = context.mode().selectedIDs()[0];
58135         continueTo(searchPreset);
58136       });
58137       function continueTo(nextStep) {
58138         context.map().on("move.intro drawn.intro", null);
58139         context.on("enter.intro", null);
58140         nextStep();
58141       }
58142     }
58143     function searchPreset() {
58144       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58145         return addPoint();
58146       }
58147       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58148       context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58149       reveal(
58150         ".preset-search-input",
58151         helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
58152       );
58153       context.on("enter.intro", function(mode) {
58154         if (!_pointID || !context.hasEntity(_pointID)) {
58155           return continueTo(addPoint);
58156         }
58157         var ids = context.selectedIDs();
58158         if (mode.id !== "select" || !ids.length || ids[0] !== _pointID) {
58159           context.enter(modeSelect(context, [_pointID]));
58160           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58161           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58162           reveal(
58163             ".preset-search-input",
58164             helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
58165           );
58166           context.history().on("change.intro", null);
58167         }
58168       });
58169       function checkPresetSearch() {
58170         var first = context.container().select(".preset-list-item:first-child");
58171         if (first.classed("preset-amenity-cafe")) {
58172           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
58173           reveal(
58174             first.select(".preset-list-button").node(),
58175             helpHtml("intro.points.choose_cafe", { preset: cafePreset.name() }),
58176             { duration: 300 }
58177           );
58178           context.history().on("change.intro", function() {
58179             continueTo(aboutFeatureEditor);
58180           });
58181         }
58182       }
58183       function continueTo(nextStep) {
58184         context.on("enter.intro", null);
58185         context.history().on("change.intro", null);
58186         context.container().select(".inspector-wrap").on("wheel.intro", null);
58187         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58188         nextStep();
58189       }
58190     }
58191     function aboutFeatureEditor() {
58192       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58193         return addPoint();
58194       }
58195       timeout2(function() {
58196         reveal(".entity-editor-pane", helpHtml("intro.points.feature_editor"), {
58197           tooltipClass: "intro-points-describe",
58198           buttonText: _t.html("intro.ok"),
58199           buttonCallback: function() {
58200             continueTo(addName);
58201           }
58202         });
58203       }, 400);
58204       context.on("exit.intro", function() {
58205         continueTo(reselectPoint);
58206       });
58207       function continueTo(nextStep) {
58208         context.on("exit.intro", null);
58209         nextStep();
58210       }
58211     }
58212     function addName() {
58213       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58214         return addPoint();
58215       }
58216       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58217       var addNameString = helpHtml("intro.points.fields_info") + "{br}" + helpHtml("intro.points.add_name");
58218       timeout2(function() {
58219         var entity = context.entity(_pointID);
58220         if (entity.tags.name) {
58221           var tooltip = reveal(".entity-editor-pane", addNameString, {
58222             tooltipClass: "intro-points-describe",
58223             buttonText: _t.html("intro.ok"),
58224             buttonCallback: function() {
58225               continueTo(addCloseEditor);
58226             }
58227           });
58228           tooltip.select(".instruction").style("display", "none");
58229         } else {
58230           reveal(
58231             ".entity-editor-pane",
58232             addNameString,
58233             { tooltipClass: "intro-points-describe" }
58234           );
58235         }
58236       }, 400);
58237       context.history().on("change.intro", function() {
58238         continueTo(addCloseEditor);
58239       });
58240       context.on("exit.intro", function() {
58241         continueTo(reselectPoint);
58242       });
58243       function continueTo(nextStep) {
58244         context.on("exit.intro", null);
58245         context.history().on("change.intro", null);
58246         nextStep();
58247       }
58248     }
58249     function addCloseEditor() {
58250       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58251       var selector = ".entity-editor-pane button.close svg use";
58252       var href = select_default2(selector).attr("href") || "#iD-icon-close";
58253       context.on("exit.intro", function() {
58254         continueTo(reselectPoint);
58255       });
58256       reveal(
58257         ".entity-editor-pane",
58258         helpHtml("intro.points.add_close", { button: { html: icon(href, "inline") } })
58259       );
58260       function continueTo(nextStep) {
58261         context.on("exit.intro", null);
58262         nextStep();
58263       }
58264     }
58265     function reselectPoint() {
58266       if (!_pointID)
58267         return chapter.restart();
58268       var entity = context.hasEntity(_pointID);
58269       if (!entity)
58270         return chapter.restart();
58271       var oldPreset = _mainPresetIndex.match(entity, context.graph());
58272       context.replace(actionChangePreset(_pointID, oldPreset, cafePreset));
58273       context.enter(modeBrowse(context));
58274       var msec = transitionTime(entity.loc, context.map().center());
58275       if (msec) {
58276         reveal(null, null, { duration: 0 });
58277       }
58278       context.map().centerEase(entity.loc, msec);
58279       timeout2(function() {
58280         var box = pointBox(entity.loc, context);
58281         reveal(box, helpHtml("intro.points.reselect"), { duration: 600 });
58282         timeout2(function() {
58283           context.map().on("move.intro drawn.intro", function() {
58284             var entity2 = context.hasEntity(_pointID);
58285             if (!entity2)
58286               return chapter.restart();
58287             var box2 = pointBox(entity2.loc, context);
58288             reveal(box2, helpHtml("intro.points.reselect"), { duration: 0 });
58289           });
58290         }, 600);
58291         context.on("enter.intro", function(mode) {
58292           if (mode.id !== "select")
58293             return;
58294           continueTo(updatePoint);
58295         });
58296       }, msec + 100);
58297       function continueTo(nextStep) {
58298         context.map().on("move.intro drawn.intro", null);
58299         context.on("enter.intro", null);
58300         nextStep();
58301       }
58302     }
58303     function updatePoint() {
58304       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58305         return continueTo(reselectPoint);
58306       }
58307       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58308       context.on("exit.intro", function() {
58309         continueTo(reselectPoint);
58310       });
58311       context.history().on("change.intro", function() {
58312         continueTo(updateCloseEditor);
58313       });
58314       timeout2(function() {
58315         reveal(
58316           ".entity-editor-pane",
58317           helpHtml("intro.points.update"),
58318           { tooltipClass: "intro-points-describe" }
58319         );
58320       }, 400);
58321       function continueTo(nextStep) {
58322         context.on("exit.intro", null);
58323         context.history().on("change.intro", null);
58324         nextStep();
58325       }
58326     }
58327     function updateCloseEditor() {
58328       if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58329         return continueTo(reselectPoint);
58330       }
58331       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58332       context.on("exit.intro", function() {
58333         continueTo(rightClickPoint);
58334       });
58335       timeout2(function() {
58336         reveal(
58337           ".entity-editor-pane",
58338           helpHtml("intro.points.update_close", { button: { html: icon("#iD-icon-close", "inline") } })
58339         );
58340       }, 500);
58341       function continueTo(nextStep) {
58342         context.on("exit.intro", null);
58343         nextStep();
58344       }
58345     }
58346     function rightClickPoint() {
58347       if (!_pointID)
58348         return chapter.restart();
58349       var entity = context.hasEntity(_pointID);
58350       if (!entity)
58351         return chapter.restart();
58352       context.enter(modeBrowse(context));
58353       var box = pointBox(entity.loc, context);
58354       var textId = context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch";
58355       reveal(box, helpHtml("intro.points." + textId), { duration: 600 });
58356       timeout2(function() {
58357         context.map().on("move.intro", function() {
58358           var entity2 = context.hasEntity(_pointID);
58359           if (!entity2)
58360             return chapter.restart();
58361           var box2 = pointBox(entity2.loc, context);
58362           reveal(box2, helpHtml("intro.points." + textId), { duration: 0 });
58363         });
58364       }, 600);
58365       context.on("enter.intro", function(mode) {
58366         if (mode.id !== "select")
58367           return;
58368         var ids = context.selectedIDs();
58369         if (ids.length !== 1 || ids[0] !== _pointID)
58370           return;
58371         timeout2(function() {
58372           var node = selectMenuItem(context, "delete").node();
58373           if (!node)
58374             return;
58375           continueTo(enterDelete);
58376         }, 50);
58377       });
58378       function continueTo(nextStep) {
58379         context.on("enter.intro", null);
58380         context.map().on("move.intro", null);
58381         nextStep();
58382       }
58383     }
58384     function enterDelete() {
58385       if (!_pointID)
58386         return chapter.restart();
58387       var entity = context.hasEntity(_pointID);
58388       if (!entity)
58389         return chapter.restart();
58390       var node = selectMenuItem(context, "delete").node();
58391       if (!node) {
58392         return continueTo(rightClickPoint);
58393       }
58394       reveal(
58395         ".edit-menu",
58396         helpHtml("intro.points.delete"),
58397         { padding: 50 }
58398       );
58399       timeout2(function() {
58400         context.map().on("move.intro", function() {
58401           reveal(
58402             ".edit-menu",
58403             helpHtml("intro.points.delete"),
58404             { duration: 0, padding: 50 }
58405           );
58406         });
58407       }, 300);
58408       context.on("exit.intro", function() {
58409         if (!_pointID)
58410           return chapter.restart();
58411         var entity2 = context.hasEntity(_pointID);
58412         if (entity2)
58413           return continueTo(rightClickPoint);
58414       });
58415       context.history().on("change.intro", function(changed) {
58416         if (changed.deleted().length) {
58417           continueTo(undo);
58418         }
58419       });
58420       function continueTo(nextStep) {
58421         context.map().on("move.intro", null);
58422         context.history().on("change.intro", null);
58423         context.on("exit.intro", null);
58424         nextStep();
58425       }
58426     }
58427     function undo() {
58428       context.history().on("change.intro", function() {
58429         continueTo(play);
58430       });
58431       reveal(
58432         ".top-toolbar button.undo-button",
58433         helpHtml("intro.points.undo")
58434       );
58435       function continueTo(nextStep) {
58436         context.history().on("change.intro", null);
58437         nextStep();
58438       }
58439     }
58440     function play() {
58441       dispatch14.call("done");
58442       reveal(
58443         ".ideditor",
58444         helpHtml("intro.points.play", { next: _t("intro.areas.title") }),
58445         {
58446           tooltipBox: ".intro-nav-wrap .chapter-area",
58447           buttonText: _t.html("intro.ok"),
58448           buttonCallback: function() {
58449             reveal(".ideditor");
58450           }
58451         }
58452       );
58453     }
58454     chapter.enter = function() {
58455       addPoint();
58456     };
58457     chapter.exit = function() {
58458       timeouts.forEach(window.clearTimeout);
58459       context.on("enter.intro exit.intro", null);
58460       context.map().on("move.intro drawn.intro", null);
58461       context.history().on("change.intro", null);
58462       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58463       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58464     };
58465     chapter.restart = function() {
58466       chapter.exit();
58467       chapter.enter();
58468     };
58469     return utilRebind(chapter, dispatch14, "on");
58470   }
58471
58472   // modules/ui/intro/area.js
58473   function uiIntroArea(context, reveal) {
58474     var dispatch14 = dispatch_default("done");
58475     var playground = [-85.63552, 41.94159];
58476     var playgroundPreset = _mainPresetIndex.item("leisure/playground");
58477     var nameField = _mainPresetIndex.field("name");
58478     var descriptionField = _mainPresetIndex.field("description");
58479     var timeouts = [];
58480     var _areaID;
58481     var chapter = {
58482       title: "intro.areas.title"
58483     };
58484     function timeout2(f3, t2) {
58485       timeouts.push(window.setTimeout(f3, t2));
58486     }
58487     function eventCancel(d3_event) {
58488       d3_event.stopPropagation();
58489       d3_event.preventDefault();
58490     }
58491     function revealPlayground(center, text2, options2) {
58492       var padding = 180 * Math.pow(2, context.map().zoom() - 19.5);
58493       var box = pad(center, padding, context);
58494       reveal(box, text2, options2);
58495     }
58496     function addArea() {
58497       context.enter(modeBrowse(context));
58498       context.history().reset("initial");
58499       _areaID = null;
58500       var msec = transitionTime(playground, context.map().center());
58501       if (msec) {
58502         reveal(null, null, { duration: 0 });
58503       }
58504       context.map().centerZoomEase(playground, 19, msec);
58505       timeout2(function() {
58506         var tooltip = reveal(
58507           "button.add-area",
58508           helpHtml("intro.areas.add_playground")
58509         );
58510         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-areas");
58511         context.on("enter.intro", function(mode) {
58512           if (mode.id !== "add-area")
58513             return;
58514           continueTo(startPlayground);
58515         });
58516       }, msec + 100);
58517       function continueTo(nextStep) {
58518         context.on("enter.intro", null);
58519         nextStep();
58520       }
58521     }
58522     function startPlayground() {
58523       if (context.mode().id !== "add-area") {
58524         return chapter.restart();
58525       }
58526       _areaID = null;
58527       context.map().zoomEase(19.5, 500);
58528       timeout2(function() {
58529         var textId = context.lastPointerType() === "mouse" ? "starting_node_click" : "starting_node_tap";
58530         var startDrawString = helpHtml("intro.areas.start_playground") + helpHtml("intro.areas." + textId);
58531         revealPlayground(
58532           playground,
58533           startDrawString,
58534           { duration: 250 }
58535         );
58536         timeout2(function() {
58537           context.map().on("move.intro drawn.intro", function() {
58538             revealPlayground(
58539               playground,
58540               startDrawString,
58541               { duration: 0 }
58542             );
58543           });
58544           context.on("enter.intro", function(mode) {
58545             if (mode.id !== "draw-area")
58546               return chapter.restart();
58547             continueTo(continuePlayground);
58548           });
58549         }, 250);
58550       }, 550);
58551       function continueTo(nextStep) {
58552         context.map().on("move.intro drawn.intro", null);
58553         context.on("enter.intro", null);
58554         nextStep();
58555       }
58556     }
58557     function continuePlayground() {
58558       if (context.mode().id !== "draw-area") {
58559         return chapter.restart();
58560       }
58561       _areaID = null;
58562       revealPlayground(
58563         playground,
58564         helpHtml("intro.areas.continue_playground"),
58565         { duration: 250 }
58566       );
58567       timeout2(function() {
58568         context.map().on("move.intro drawn.intro", function() {
58569           revealPlayground(
58570             playground,
58571             helpHtml("intro.areas.continue_playground"),
58572             { duration: 0 }
58573           );
58574         });
58575       }, 250);
58576       context.on("enter.intro", function(mode) {
58577         if (mode.id === "draw-area") {
58578           var entity = context.hasEntity(context.selectedIDs()[0]);
58579           if (entity && entity.nodes.length >= 6) {
58580             return continueTo(finishPlayground);
58581           } else {
58582             return;
58583           }
58584         } else if (mode.id === "select") {
58585           _areaID = context.selectedIDs()[0];
58586           return continueTo(searchPresets);
58587         } else {
58588           return chapter.restart();
58589         }
58590       });
58591       function continueTo(nextStep) {
58592         context.map().on("move.intro drawn.intro", null);
58593         context.on("enter.intro", null);
58594         nextStep();
58595       }
58596     }
58597     function finishPlayground() {
58598       if (context.mode().id !== "draw-area") {
58599         return chapter.restart();
58600       }
58601       _areaID = null;
58602       var finishString = helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.areas.finish_playground");
58603       revealPlayground(
58604         playground,
58605         finishString,
58606         { duration: 250 }
58607       );
58608       timeout2(function() {
58609         context.map().on("move.intro drawn.intro", function() {
58610           revealPlayground(
58611             playground,
58612             finishString,
58613             { duration: 0 }
58614           );
58615         });
58616       }, 250);
58617       context.on("enter.intro", function(mode) {
58618         if (mode.id === "draw-area") {
58619           return;
58620         } else if (mode.id === "select") {
58621           _areaID = context.selectedIDs()[0];
58622           return continueTo(searchPresets);
58623         } else {
58624           return chapter.restart();
58625         }
58626       });
58627       function continueTo(nextStep) {
58628         context.map().on("move.intro drawn.intro", null);
58629         context.on("enter.intro", null);
58630         nextStep();
58631       }
58632     }
58633     function searchPresets() {
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         context.enter(modeSelect(context, [_areaID]));
58640       }
58641       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58642       timeout2(function() {
58643         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
58644         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58645         reveal(
58646           ".preset-search-input",
58647           helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
58648         );
58649       }, 400);
58650       context.on("enter.intro", function(mode) {
58651         if (!_areaID || !context.hasEntity(_areaID)) {
58652           return continueTo(addArea);
58653         }
58654         var ids2 = context.selectedIDs();
58655         if (mode.id !== "select" || !ids2.length || ids2[0] !== _areaID) {
58656           context.enter(modeSelect(context, [_areaID]));
58657           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
58658           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58659           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58660           reveal(
58661             ".preset-search-input",
58662             helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
58663           );
58664           context.history().on("change.intro", null);
58665         }
58666       });
58667       function checkPresetSearch() {
58668         var first = context.container().select(".preset-list-item:first-child");
58669         if (first.classed("preset-leisure-playground")) {
58670           reveal(
58671             first.select(".preset-list-button").node(),
58672             helpHtml("intro.areas.choose_playground", { preset: playgroundPreset.name() }),
58673             { duration: 300 }
58674           );
58675           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
58676           context.history().on("change.intro", function() {
58677             continueTo(clickAddField);
58678           });
58679         }
58680       }
58681       function continueTo(nextStep) {
58682         context.container().select(".inspector-wrap").on("wheel.intro", null);
58683         context.on("enter.intro", null);
58684         context.history().on("change.intro", null);
58685         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58686         nextStep();
58687       }
58688     }
58689     function clickAddField() {
58690       if (!_areaID || !context.hasEntity(_areaID)) {
58691         return addArea();
58692       }
58693       var ids = context.selectedIDs();
58694       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58695         return searchPresets();
58696       }
58697       if (!context.container().select(".form-field-description").empty()) {
58698         return continueTo(describePlayground);
58699       }
58700       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58701       timeout2(function() {
58702         context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58703         var entity = context.entity(_areaID);
58704         if (entity.tags.description) {
58705           return continueTo(play);
58706         }
58707         var box = context.container().select(".more-fields").node().getBoundingClientRect();
58708         if (box.top > 300) {
58709           var pane = context.container().select(".entity-editor-pane .inspector-body");
58710           var start2 = pane.node().scrollTop;
58711           var end = start2 + (box.top - 300);
58712           pane.transition().duration(250).tween("scroll.inspector", function() {
58713             var node = this;
58714             var i3 = number_default(start2, end);
58715             return function(t2) {
58716               node.scrollTop = i3(t2);
58717             };
58718           });
58719         }
58720         timeout2(function() {
58721           reveal(
58722             ".more-fields .combobox-input",
58723             helpHtml("intro.areas.add_field", {
58724               name: nameField.title(),
58725               description: descriptionField.title()
58726             }),
58727             { duration: 300 }
58728           );
58729           context.container().select(".more-fields .combobox-input").on("click.intro", function() {
58730             var watcher;
58731             watcher = window.setInterval(function() {
58732               if (!context.container().select("div.combobox").empty()) {
58733                 window.clearInterval(watcher);
58734                 continueTo(chooseDescriptionField);
58735               }
58736             }, 300);
58737           });
58738         }, 300);
58739       }, 400);
58740       context.on("exit.intro", function() {
58741         return continueTo(searchPresets);
58742       });
58743       function continueTo(nextStep) {
58744         context.container().select(".inspector-wrap").on("wheel.intro", null);
58745         context.container().select(".more-fields .combobox-input").on("click.intro", null);
58746         context.on("exit.intro", null);
58747         nextStep();
58748       }
58749     }
58750     function chooseDescriptionField() {
58751       if (!_areaID || !context.hasEntity(_areaID)) {
58752         return addArea();
58753       }
58754       var ids = context.selectedIDs();
58755       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58756         return searchPresets();
58757       }
58758       if (!context.container().select(".form-field-description").empty()) {
58759         return continueTo(describePlayground);
58760       }
58761       if (context.container().select("div.combobox").empty()) {
58762         return continueTo(clickAddField);
58763       }
58764       var watcher;
58765       watcher = window.setInterval(function() {
58766         if (context.container().select("div.combobox").empty()) {
58767           window.clearInterval(watcher);
58768           timeout2(function() {
58769             if (context.container().select(".form-field-description").empty()) {
58770               continueTo(retryChooseDescription);
58771             } else {
58772               continueTo(describePlayground);
58773             }
58774           }, 300);
58775         }
58776       }, 300);
58777       reveal(
58778         "div.combobox",
58779         helpHtml("intro.areas.choose_field", { field: descriptionField.title() }),
58780         { duration: 300 }
58781       );
58782       context.on("exit.intro", function() {
58783         return continueTo(searchPresets);
58784       });
58785       function continueTo(nextStep) {
58786         if (watcher)
58787           window.clearInterval(watcher);
58788         context.on("exit.intro", null);
58789         nextStep();
58790       }
58791     }
58792     function describePlayground() {
58793       if (!_areaID || !context.hasEntity(_areaID)) {
58794         return addArea();
58795       }
58796       var ids = context.selectedIDs();
58797       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58798         return searchPresets();
58799       }
58800       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58801       if (context.container().select(".form-field-description").empty()) {
58802         return continueTo(retryChooseDescription);
58803       }
58804       context.on("exit.intro", function() {
58805         continueTo(play);
58806       });
58807       reveal(
58808         ".entity-editor-pane",
58809         helpHtml("intro.areas.describe_playground", { button: { html: icon("#iD-icon-close", "inline") } }),
58810         { duration: 300 }
58811       );
58812       function continueTo(nextStep) {
58813         context.on("exit.intro", null);
58814         nextStep();
58815       }
58816     }
58817     function retryChooseDescription() {
58818       if (!_areaID || !context.hasEntity(_areaID)) {
58819         return addArea();
58820       }
58821       var ids = context.selectedIDs();
58822       if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58823         return searchPresets();
58824       }
58825       context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58826       reveal(
58827         ".entity-editor-pane",
58828         helpHtml("intro.areas.retry_add_field", { field: descriptionField.title() }),
58829         {
58830           buttonText: _t.html("intro.ok"),
58831           buttonCallback: function() {
58832             continueTo(clickAddField);
58833           }
58834         }
58835       );
58836       context.on("exit.intro", function() {
58837         return continueTo(searchPresets);
58838       });
58839       function continueTo(nextStep) {
58840         context.on("exit.intro", null);
58841         nextStep();
58842       }
58843     }
58844     function play() {
58845       dispatch14.call("done");
58846       reveal(
58847         ".ideditor",
58848         helpHtml("intro.areas.play", { next: _t("intro.lines.title") }),
58849         {
58850           tooltipBox: ".intro-nav-wrap .chapter-line",
58851           buttonText: _t.html("intro.ok"),
58852           buttonCallback: function() {
58853             reveal(".ideditor");
58854           }
58855         }
58856       );
58857     }
58858     chapter.enter = function() {
58859       addArea();
58860     };
58861     chapter.exit = function() {
58862       timeouts.forEach(window.clearTimeout);
58863       context.on("enter.intro exit.intro", null);
58864       context.map().on("move.intro drawn.intro", null);
58865       context.history().on("change.intro", null);
58866       context.container().select(".inspector-wrap").on("wheel.intro", null);
58867       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58868       context.container().select(".more-fields .combobox-input").on("click.intro", null);
58869     };
58870     chapter.restart = function() {
58871       chapter.exit();
58872       chapter.enter();
58873     };
58874     return utilRebind(chapter, dispatch14, "on");
58875   }
58876
58877   // modules/ui/intro/line.js
58878   function uiIntroLine(context, reveal) {
58879     var dispatch14 = dispatch_default("done");
58880     var timeouts = [];
58881     var _tulipRoadID = null;
58882     var flowerRoadID = "w646";
58883     var tulipRoadStart = [-85.6297754121684, 41.95805253325314];
58884     var tulipRoadMidpoint = [-85.62975395449628, 41.95787501510204];
58885     var tulipRoadIntersection = [-85.62974496187628, 41.95742515554585];
58886     var roadCategory = _mainPresetIndex.item("category-road_minor");
58887     var residentialPreset = _mainPresetIndex.item("highway/residential");
58888     var woodRoadID = "w525";
58889     var woodRoadEndID = "n2862";
58890     var woodRoadAddNode = [-85.62390110349587, 41.95397111462291];
58891     var woodRoadDragEndpoint = [-85.623867390213, 41.95466987786487];
58892     var woodRoadDragMidpoint = [-85.62386254803509, 41.95430395953872];
58893     var washingtonStreetID = "w522";
58894     var twelfthAvenueID = "w1";
58895     var eleventhAvenueEndID = "n3550";
58896     var twelfthAvenueEndID = "n5";
58897     var _washingtonSegmentID = null;
58898     var eleventhAvenueEnd = context.entity(eleventhAvenueEndID).loc;
58899     var twelfthAvenueEnd = context.entity(twelfthAvenueEndID).loc;
58900     var deleteLinesLoc = [-85.6219395542764, 41.95228033922477];
58901     var twelfthAvenue = [-85.62219310052491, 41.952505413152956];
58902     var chapter = {
58903       title: "intro.lines.title"
58904     };
58905     function timeout2(f3, t2) {
58906       timeouts.push(window.setTimeout(f3, t2));
58907     }
58908     function eventCancel(d3_event) {
58909       d3_event.stopPropagation();
58910       d3_event.preventDefault();
58911     }
58912     function addLine() {
58913       context.enter(modeBrowse(context));
58914       context.history().reset("initial");
58915       var msec = transitionTime(tulipRoadStart, context.map().center());
58916       if (msec) {
58917         reveal(null, null, { duration: 0 });
58918       }
58919       context.map().centerZoomEase(tulipRoadStart, 18.5, msec);
58920       timeout2(function() {
58921         var tooltip = reveal(
58922           "button.add-line",
58923           helpHtml("intro.lines.add_line")
58924         );
58925         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-lines");
58926         context.on("enter.intro", function(mode) {
58927           if (mode.id !== "add-line")
58928             return;
58929           continueTo(startLine);
58930         });
58931       }, msec + 100);
58932       function continueTo(nextStep) {
58933         context.on("enter.intro", null);
58934         nextStep();
58935       }
58936     }
58937     function startLine() {
58938       if (context.mode().id !== "add-line")
58939         return chapter.restart();
58940       _tulipRoadID = null;
58941       var padding = 70 * Math.pow(2, context.map().zoom() - 18);
58942       var box = pad(tulipRoadStart, padding, context);
58943       box.height = box.height + 100;
58944       var textId = context.lastPointerType() === "mouse" ? "start_line" : "start_line_tap";
58945       var startLineString = helpHtml("intro.lines.missing_road") + "{br}" + helpHtml("intro.lines.line_draw_info") + helpHtml("intro.lines." + textId);
58946       reveal(box, startLineString);
58947       context.map().on("move.intro drawn.intro", function() {
58948         padding = 70 * Math.pow(2, context.map().zoom() - 18);
58949         box = pad(tulipRoadStart, padding, context);
58950         box.height = box.height + 100;
58951         reveal(box, startLineString, { duration: 0 });
58952       });
58953       context.on("enter.intro", function(mode) {
58954         if (mode.id !== "draw-line")
58955           return chapter.restart();
58956         continueTo(drawLine);
58957       });
58958       function continueTo(nextStep) {
58959         context.map().on("move.intro drawn.intro", null);
58960         context.on("enter.intro", null);
58961         nextStep();
58962       }
58963     }
58964     function drawLine() {
58965       if (context.mode().id !== "draw-line")
58966         return chapter.restart();
58967       _tulipRoadID = context.mode().selectedIDs()[0];
58968       context.map().centerEase(tulipRoadMidpoint, 500);
58969       timeout2(function() {
58970         var padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
58971         var box = pad(tulipRoadMidpoint, padding, context);
58972         box.height = box.height * 2;
58973         reveal(
58974           box,
58975           helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") })
58976         );
58977         context.map().on("move.intro drawn.intro", function() {
58978           padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
58979           box = pad(tulipRoadMidpoint, padding, context);
58980           box.height = box.height * 2;
58981           reveal(
58982             box,
58983             helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }),
58984             { duration: 0 }
58985           );
58986         });
58987       }, 550);
58988       context.history().on("change.intro", function() {
58989         if (isLineConnected()) {
58990           continueTo(continueLine);
58991         }
58992       });
58993       context.on("enter.intro", function(mode) {
58994         if (mode.id === "draw-line") {
58995           return;
58996         } else if (mode.id === "select") {
58997           continueTo(retryIntersect);
58998           return;
58999         } else {
59000           return chapter.restart();
59001         }
59002       });
59003       function continueTo(nextStep) {
59004         context.map().on("move.intro drawn.intro", null);
59005         context.history().on("change.intro", null);
59006         context.on("enter.intro", null);
59007         nextStep();
59008       }
59009     }
59010     function isLineConnected() {
59011       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
59012       if (!entity)
59013         return false;
59014       var drawNodes = context.graph().childNodes(entity);
59015       return drawNodes.some(function(node) {
59016         return context.graph().parentWays(node).some(function(parent) {
59017           return parent.id === flowerRoadID;
59018         });
59019       });
59020     }
59021     function retryIntersect() {
59022       select_default2(window).on("pointerdown.intro mousedown.intro", eventCancel, true);
59023       var box = pad(tulipRoadIntersection, 80, context);
59024       reveal(
59025         box,
59026         helpHtml("intro.lines.retry_intersect", { name: _t("intro.graph.name.flower-street") })
59027       );
59028       timeout2(chapter.restart, 3e3);
59029     }
59030     function continueLine() {
59031       if (context.mode().id !== "draw-line")
59032         return chapter.restart();
59033       var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
59034       if (!entity)
59035         return chapter.restart();
59036       context.map().centerEase(tulipRoadIntersection, 500);
59037       var continueLineText = helpHtml("intro.lines.continue_line") + "{br}" + helpHtml("intro.lines.finish_line_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.lines.finish_road");
59038       reveal(".surface", continueLineText);
59039       context.on("enter.intro", function(mode) {
59040         if (mode.id === "draw-line") {
59041           return;
59042         } else if (mode.id === "select") {
59043           return continueTo(chooseCategoryRoad);
59044         } else {
59045           return chapter.restart();
59046         }
59047       });
59048       function continueTo(nextStep) {
59049         context.on("enter.intro", null);
59050         nextStep();
59051       }
59052     }
59053     function chooseCategoryRoad() {
59054       if (context.mode().id !== "select")
59055         return chapter.restart();
59056       context.on("exit.intro", function() {
59057         return chapter.restart();
59058       });
59059       var button = context.container().select(".preset-category-road_minor .preset-list-button");
59060       if (button.empty())
59061         return chapter.restart();
59062       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
59063       timeout2(function() {
59064         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
59065         reveal(
59066           button.node(),
59067           helpHtml("intro.lines.choose_category_road", { category: roadCategory.name() })
59068         );
59069         button.on("click.intro", function() {
59070           continueTo(choosePresetResidential);
59071         });
59072       }, 400);
59073       function continueTo(nextStep) {
59074         context.container().select(".inspector-wrap").on("wheel.intro", null);
59075         context.container().select(".preset-list-button").on("click.intro", null);
59076         context.on("exit.intro", null);
59077         nextStep();
59078       }
59079     }
59080     function choosePresetResidential() {
59081       if (context.mode().id !== "select")
59082         return chapter.restart();
59083       context.on("exit.intro", function() {
59084         return chapter.restart();
59085       });
59086       var subgrid = context.container().select(".preset-category-road_minor .subgrid");
59087       if (subgrid.empty())
59088         return chapter.restart();
59089       subgrid.selectAll(":not(.preset-highway-residential) .preset-list-button").on("click.intro", function() {
59090         continueTo(retryPresetResidential);
59091       });
59092       subgrid.selectAll(".preset-highway-residential .preset-list-button").on("click.intro", function() {
59093         continueTo(nameRoad);
59094       });
59095       timeout2(function() {
59096         reveal(
59097           subgrid.node(),
59098           helpHtml("intro.lines.choose_preset_residential", { preset: residentialPreset.name() }),
59099           { tooltipBox: ".preset-highway-residential .preset-list-button", duration: 300 }
59100         );
59101       }, 300);
59102       function continueTo(nextStep) {
59103         context.container().select(".preset-list-button").on("click.intro", null);
59104         context.on("exit.intro", null);
59105         nextStep();
59106       }
59107     }
59108     function retryPresetResidential() {
59109       if (context.mode().id !== "select")
59110         return chapter.restart();
59111       context.on("exit.intro", function() {
59112         return chapter.restart();
59113       });
59114       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
59115       timeout2(function() {
59116         var button = context.container().select(".entity-editor-pane .preset-list-button");
59117         reveal(
59118           button.node(),
59119           helpHtml("intro.lines.retry_preset_residential", { preset: residentialPreset.name() })
59120         );
59121         button.on("click.intro", function() {
59122           continueTo(chooseCategoryRoad);
59123         });
59124       }, 500);
59125       function continueTo(nextStep) {
59126         context.container().select(".inspector-wrap").on("wheel.intro", null);
59127         context.container().select(".preset-list-button").on("click.intro", null);
59128         context.on("exit.intro", null);
59129         nextStep();
59130       }
59131     }
59132     function nameRoad() {
59133       context.on("exit.intro", function() {
59134         continueTo(didNameRoad);
59135       });
59136       timeout2(function() {
59137         reveal(
59138           ".entity-editor-pane",
59139           helpHtml("intro.lines.name_road", { button: { html: icon("#iD-icon-close", "inline") } }),
59140           { tooltipClass: "intro-lines-name_road" }
59141         );
59142       }, 500);
59143       function continueTo(nextStep) {
59144         context.on("exit.intro", null);
59145         nextStep();
59146       }
59147     }
59148     function didNameRoad() {
59149       context.history().checkpoint("doneAddLine");
59150       timeout2(function() {
59151         reveal(".surface", helpHtml("intro.lines.did_name_road"), {
59152           buttonText: _t.html("intro.ok"),
59153           buttonCallback: function() {
59154             continueTo(updateLine);
59155           }
59156         });
59157       }, 500);
59158       function continueTo(nextStep) {
59159         nextStep();
59160       }
59161     }
59162     function updateLine() {
59163       context.history().reset("doneAddLine");
59164       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59165         return chapter.restart();
59166       }
59167       var msec = transitionTime(woodRoadDragMidpoint, context.map().center());
59168       if (msec) {
59169         reveal(null, null, { duration: 0 });
59170       }
59171       context.map().centerZoomEase(woodRoadDragMidpoint, 19, msec);
59172       timeout2(function() {
59173         var padding = 250 * Math.pow(2, context.map().zoom() - 19);
59174         var box = pad(woodRoadDragMidpoint, padding, context);
59175         var advance = function() {
59176           continueTo(addNode);
59177         };
59178         reveal(
59179           box,
59180           helpHtml("intro.lines.update_line"),
59181           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59182         );
59183         context.map().on("move.intro drawn.intro", function() {
59184           var padding2 = 250 * Math.pow(2, context.map().zoom() - 19);
59185           var box2 = pad(woodRoadDragMidpoint, padding2, context);
59186           reveal(
59187             box2,
59188             helpHtml("intro.lines.update_line"),
59189             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59190           );
59191         });
59192       }, msec + 100);
59193       function continueTo(nextStep) {
59194         context.map().on("move.intro drawn.intro", null);
59195         nextStep();
59196       }
59197     }
59198     function addNode() {
59199       context.history().reset("doneAddLine");
59200       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59201         return chapter.restart();
59202       }
59203       var padding = 40 * Math.pow(2, context.map().zoom() - 19);
59204       var box = pad(woodRoadAddNode, padding, context);
59205       var addNodeString = helpHtml("intro.lines.add_node" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
59206       reveal(box, addNodeString);
59207       context.map().on("move.intro drawn.intro", function() {
59208         var padding2 = 40 * Math.pow(2, context.map().zoom() - 19);
59209         var box2 = pad(woodRoadAddNode, padding2, context);
59210         reveal(box2, addNodeString, { duration: 0 });
59211       });
59212       context.history().on("change.intro", function(changed) {
59213         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59214           return continueTo(updateLine);
59215         }
59216         if (changed.created().length === 1) {
59217           timeout2(function() {
59218             continueTo(startDragEndpoint);
59219           }, 500);
59220         }
59221       });
59222       context.on("enter.intro", function(mode) {
59223         if (mode.id !== "select") {
59224           continueTo(updateLine);
59225         }
59226       });
59227       function continueTo(nextStep) {
59228         context.map().on("move.intro drawn.intro", null);
59229         context.history().on("change.intro", null);
59230         context.on("enter.intro", null);
59231         nextStep();
59232       }
59233     }
59234     function startDragEndpoint() {
59235       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59236         return continueTo(updateLine);
59237       }
59238       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
59239       var box = pad(woodRoadDragEndpoint, padding, context);
59240       var startDragString = helpHtml("intro.lines.start_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch")) + helpHtml("intro.lines.drag_to_intersection");
59241       reveal(box, startDragString);
59242       context.map().on("move.intro drawn.intro", function() {
59243         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59244           return continueTo(updateLine);
59245         }
59246         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
59247         var box2 = pad(woodRoadDragEndpoint, padding2, context);
59248         reveal(box2, startDragString, { duration: 0 });
59249         var entity = context.entity(woodRoadEndID);
59250         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) <= 4) {
59251           continueTo(finishDragEndpoint);
59252         }
59253       });
59254       function continueTo(nextStep) {
59255         context.map().on("move.intro drawn.intro", null);
59256         nextStep();
59257       }
59258     }
59259     function finishDragEndpoint() {
59260       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59261         return continueTo(updateLine);
59262       }
59263       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
59264       var box = pad(woodRoadDragEndpoint, padding, context);
59265       var finishDragString = helpHtml("intro.lines.spot_looks_good") + helpHtml("intro.lines.finish_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
59266       reveal(box, finishDragString);
59267       context.map().on("move.intro drawn.intro", function() {
59268         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59269           return continueTo(updateLine);
59270         }
59271         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
59272         var box2 = pad(woodRoadDragEndpoint, padding2, context);
59273         reveal(box2, finishDragString, { duration: 0 });
59274         var entity = context.entity(woodRoadEndID);
59275         if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) > 4) {
59276           continueTo(startDragEndpoint);
59277         }
59278       });
59279       context.on("enter.intro", function() {
59280         continueTo(startDragMidpoint);
59281       });
59282       function continueTo(nextStep) {
59283         context.map().on("move.intro drawn.intro", null);
59284         context.on("enter.intro", null);
59285         nextStep();
59286       }
59287     }
59288     function startDragMidpoint() {
59289       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59290         return continueTo(updateLine);
59291       }
59292       if (context.selectedIDs().indexOf(woodRoadID) === -1) {
59293         context.enter(modeSelect(context, [woodRoadID]));
59294       }
59295       var padding = 80 * Math.pow(2, context.map().zoom() - 19);
59296       var box = pad(woodRoadDragMidpoint, padding, context);
59297       reveal(box, helpHtml("intro.lines.start_drag_midpoint"));
59298       context.map().on("move.intro drawn.intro", function() {
59299         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59300           return continueTo(updateLine);
59301         }
59302         var padding2 = 80 * Math.pow(2, context.map().zoom() - 19);
59303         var box2 = pad(woodRoadDragMidpoint, padding2, context);
59304         reveal(box2, helpHtml("intro.lines.start_drag_midpoint"), { duration: 0 });
59305       });
59306       context.history().on("change.intro", function(changed) {
59307         if (changed.created().length === 1) {
59308           continueTo(continueDragMidpoint);
59309         }
59310       });
59311       context.on("enter.intro", function(mode) {
59312         if (mode.id !== "select") {
59313           context.enter(modeSelect(context, [woodRoadID]));
59314         }
59315       });
59316       function continueTo(nextStep) {
59317         context.map().on("move.intro drawn.intro", null);
59318         context.history().on("change.intro", null);
59319         context.on("enter.intro", null);
59320         nextStep();
59321       }
59322     }
59323     function continueDragMidpoint() {
59324       if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59325         return continueTo(updateLine);
59326       }
59327       var padding = 100 * Math.pow(2, context.map().zoom() - 19);
59328       var box = pad(woodRoadDragEndpoint, padding, context);
59329       box.height += 400;
59330       var advance = function() {
59331         context.history().checkpoint("doneUpdateLine");
59332         continueTo(deleteLines);
59333       };
59334       reveal(
59335         box,
59336         helpHtml("intro.lines.continue_drag_midpoint"),
59337         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59338       );
59339       context.map().on("move.intro drawn.intro", function() {
59340         if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59341           return continueTo(updateLine);
59342         }
59343         var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
59344         var box2 = pad(woodRoadDragEndpoint, padding2, context);
59345         box2.height += 400;
59346         reveal(
59347           box2,
59348           helpHtml("intro.lines.continue_drag_midpoint"),
59349           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59350         );
59351       });
59352       function continueTo(nextStep) {
59353         context.map().on("move.intro drawn.intro", null);
59354         nextStep();
59355       }
59356     }
59357     function deleteLines() {
59358       context.history().reset("doneUpdateLine");
59359       context.enter(modeBrowse(context));
59360       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59361         return chapter.restart();
59362       }
59363       var msec = transitionTime(deleteLinesLoc, context.map().center());
59364       if (msec) {
59365         reveal(null, null, { duration: 0 });
59366       }
59367       context.map().centerZoomEase(deleteLinesLoc, 18, msec);
59368       timeout2(function() {
59369         var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59370         var box = pad(deleteLinesLoc, padding, context);
59371         box.top -= 200;
59372         box.height += 400;
59373         var advance = function() {
59374           continueTo(rightClickIntersection);
59375         };
59376         reveal(
59377           box,
59378           helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
59379           { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59380         );
59381         context.map().on("move.intro drawn.intro", function() {
59382           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
59383           var box2 = pad(deleteLinesLoc, padding2, context);
59384           box2.top -= 200;
59385           box2.height += 400;
59386           reveal(
59387             box2,
59388             helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
59389             { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59390           );
59391         });
59392         context.history().on("change.intro", function() {
59393           timeout2(function() {
59394             continueTo(deleteLines);
59395           }, 500);
59396         });
59397       }, msec + 100);
59398       function continueTo(nextStep) {
59399         context.map().on("move.intro drawn.intro", null);
59400         context.history().on("change.intro", null);
59401         nextStep();
59402       }
59403     }
59404     function rightClickIntersection() {
59405       context.history().reset("doneUpdateLine");
59406       context.enter(modeBrowse(context));
59407       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
59408       var rightClickString = helpHtml("intro.lines.split_street", {
59409         street1: _t("intro.graph.name.11th-avenue"),
59410         street2: _t("intro.graph.name.washington-street")
59411       }) + helpHtml("intro.lines." + (context.lastPointerType() === "mouse" ? "rightclick_intersection" : "edit_menu_intersection_touch"));
59412       timeout2(function() {
59413         var padding = 60 * Math.pow(2, context.map().zoom() - 18);
59414         var box = pad(eleventhAvenueEnd, padding, context);
59415         reveal(box, rightClickString);
59416         context.map().on("move.intro drawn.intro", function() {
59417           var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
59418           var box2 = pad(eleventhAvenueEnd, padding2, context);
59419           reveal(
59420             box2,
59421             rightClickString,
59422             { duration: 0 }
59423           );
59424         });
59425         context.on("enter.intro", function(mode) {
59426           if (mode.id !== "select")
59427             return;
59428           var ids = context.selectedIDs();
59429           if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID)
59430             return;
59431           timeout2(function() {
59432             var node = selectMenuItem(context, "split").node();
59433             if (!node)
59434               return;
59435             continueTo(splitIntersection);
59436           }, 50);
59437         });
59438         context.history().on("change.intro", function() {
59439           timeout2(function() {
59440             continueTo(deleteLines);
59441           }, 300);
59442         });
59443       }, 600);
59444       function continueTo(nextStep) {
59445         context.map().on("move.intro drawn.intro", null);
59446         context.on("enter.intro", null);
59447         context.history().on("change.intro", null);
59448         nextStep();
59449       }
59450     }
59451     function splitIntersection() {
59452       if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59453         return continueTo(deleteLines);
59454       }
59455       var node = selectMenuItem(context, "split").node();
59456       if (!node) {
59457         return continueTo(rightClickIntersection);
59458       }
59459       var wasChanged = false;
59460       _washingtonSegmentID = null;
59461       reveal(
59462         ".edit-menu",
59463         helpHtml(
59464           "intro.lines.split_intersection",
59465           { street: _t("intro.graph.name.washington-street") }
59466         ),
59467         { padding: 50 }
59468       );
59469       context.map().on("move.intro drawn.intro", function() {
59470         var node2 = selectMenuItem(context, "split").node();
59471         if (!wasChanged && !node2) {
59472           return continueTo(rightClickIntersection);
59473         }
59474         reveal(
59475           ".edit-menu",
59476           helpHtml(
59477             "intro.lines.split_intersection",
59478             { street: _t("intro.graph.name.washington-street") }
59479           ),
59480           { duration: 0, padding: 50 }
59481         );
59482       });
59483       context.history().on("change.intro", function(changed) {
59484         wasChanged = true;
59485         timeout2(function() {
59486           if (context.history().undoAnnotation() === _t("operations.split.annotation.line", { n: 1 })) {
59487             _washingtonSegmentID = changed.created()[0].id;
59488             continueTo(didSplit);
59489           } else {
59490             _washingtonSegmentID = null;
59491             continueTo(retrySplit);
59492           }
59493         }, 300);
59494       });
59495       function continueTo(nextStep) {
59496         context.map().on("move.intro drawn.intro", null);
59497         context.history().on("change.intro", null);
59498         nextStep();
59499       }
59500     }
59501     function retrySplit() {
59502       context.enter(modeBrowse(context));
59503       context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
59504       var advance = function() {
59505         continueTo(rightClickIntersection);
59506       };
59507       var padding = 60 * Math.pow(2, context.map().zoom() - 18);
59508       var box = pad(eleventhAvenueEnd, padding, context);
59509       reveal(
59510         box,
59511         helpHtml("intro.lines.retry_split"),
59512         { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59513       );
59514       context.map().on("move.intro drawn.intro", function() {
59515         var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
59516         var box2 = pad(eleventhAvenueEnd, padding2, context);
59517         reveal(
59518           box2,
59519           helpHtml("intro.lines.retry_split"),
59520           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59521         );
59522       });
59523       function continueTo(nextStep) {
59524         context.map().on("move.intro drawn.intro", null);
59525         nextStep();
59526       }
59527     }
59528     function didSplit() {
59529       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59530         return continueTo(rightClickIntersection);
59531       }
59532       var ids = context.selectedIDs();
59533       var string = "intro.lines.did_split_" + (ids.length > 1 ? "multi" : "single");
59534       var street = _t("intro.graph.name.washington-street");
59535       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59536       var box = pad(twelfthAvenue, padding, context);
59537       box.width = box.width / 2;
59538       reveal(
59539         box,
59540         helpHtml(string, { street1: street, street2: street }),
59541         { duration: 500 }
59542       );
59543       timeout2(function() {
59544         context.map().centerZoomEase(twelfthAvenue, 18, 500);
59545         context.map().on("move.intro drawn.intro", function() {
59546           var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
59547           var box2 = pad(twelfthAvenue, padding2, context);
59548           box2.width = box2.width / 2;
59549           reveal(
59550             box2,
59551             helpHtml(string, { street1: street, street2: street }),
59552             { duration: 0 }
59553           );
59554         });
59555       }, 600);
59556       context.on("enter.intro", function() {
59557         var ids2 = context.selectedIDs();
59558         if (ids2.length === 1 && ids2[0] === _washingtonSegmentID) {
59559           continueTo(multiSelect);
59560         }
59561       });
59562       context.history().on("change.intro", function() {
59563         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59564           return continueTo(rightClickIntersection);
59565         }
59566       });
59567       function continueTo(nextStep) {
59568         context.map().on("move.intro drawn.intro", null);
59569         context.on("enter.intro", null);
59570         context.history().on("change.intro", null);
59571         nextStep();
59572       }
59573     }
59574     function multiSelect() {
59575       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59576         return continueTo(rightClickIntersection);
59577       }
59578       var ids = context.selectedIDs();
59579       var hasWashington = ids.indexOf(_washingtonSegmentID) !== -1;
59580       var hasTwelfth = ids.indexOf(twelfthAvenueID) !== -1;
59581       if (hasWashington && hasTwelfth) {
59582         return continueTo(multiRightClick);
59583       } else if (!hasWashington && !hasTwelfth) {
59584         return continueTo(didSplit);
59585       }
59586       context.map().centerZoomEase(twelfthAvenue, 18, 500);
59587       timeout2(function() {
59588         var selected, other, padding, box;
59589         if (hasWashington) {
59590           selected = _t("intro.graph.name.washington-street");
59591           other = _t("intro.graph.name.12th-avenue");
59592           padding = 60 * Math.pow(2, context.map().zoom() - 18);
59593           box = pad(twelfthAvenueEnd, padding, context);
59594           box.width *= 3;
59595         } else {
59596           selected = _t("intro.graph.name.12th-avenue");
59597           other = _t("intro.graph.name.washington-street");
59598           padding = 200 * Math.pow(2, context.map().zoom() - 18);
59599           box = pad(twelfthAvenue, padding, context);
59600           box.width /= 2;
59601         }
59602         reveal(
59603           box,
59604           helpHtml(
59605             "intro.lines.multi_select",
59606             { selected, other1: other }
59607           ) + " " + helpHtml(
59608             "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
59609             { selected, other2: other }
59610           )
59611         );
59612         context.map().on("move.intro drawn.intro", function() {
59613           if (hasWashington) {
59614             selected = _t("intro.graph.name.washington-street");
59615             other = _t("intro.graph.name.12th-avenue");
59616             padding = 60 * Math.pow(2, context.map().zoom() - 18);
59617             box = pad(twelfthAvenueEnd, padding, context);
59618             box.width *= 3;
59619           } else {
59620             selected = _t("intro.graph.name.12th-avenue");
59621             other = _t("intro.graph.name.washington-street");
59622             padding = 200 * Math.pow(2, context.map().zoom() - 18);
59623             box = pad(twelfthAvenue, padding, context);
59624             box.width /= 2;
59625           }
59626           reveal(
59627             box,
59628             helpHtml(
59629               "intro.lines.multi_select",
59630               { selected, other1: other }
59631             ) + " " + helpHtml(
59632               "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
59633               { selected, other2: other }
59634             ),
59635             { duration: 0 }
59636           );
59637         });
59638         context.on("enter.intro", function() {
59639           continueTo(multiSelect);
59640         });
59641         context.history().on("change.intro", function() {
59642           if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59643             return continueTo(rightClickIntersection);
59644           }
59645         });
59646       }, 600);
59647       function continueTo(nextStep) {
59648         context.map().on("move.intro drawn.intro", null);
59649         context.on("enter.intro", null);
59650         context.history().on("change.intro", null);
59651         nextStep();
59652       }
59653     }
59654     function multiRightClick() {
59655       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59656         return continueTo(rightClickIntersection);
59657       }
59658       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59659       var box = pad(twelfthAvenue, padding, context);
59660       var rightClickString = helpHtml("intro.lines.multi_select_success") + helpHtml("intro.lines.multi_" + (context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch"));
59661       reveal(box, rightClickString);
59662       context.map().on("move.intro drawn.intro", function() {
59663         var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
59664         var box2 = pad(twelfthAvenue, padding2, context);
59665         reveal(box2, rightClickString, { duration: 0 });
59666       });
59667       context.ui().editMenu().on("toggled.intro", function(open) {
59668         if (!open)
59669           return;
59670         timeout2(function() {
59671           var ids = context.selectedIDs();
59672           if (ids.length === 2 && ids.indexOf(twelfthAvenueID) !== -1 && ids.indexOf(_washingtonSegmentID) !== -1) {
59673             var node = selectMenuItem(context, "delete").node();
59674             if (!node)
59675               return;
59676             continueTo(multiDelete);
59677           } else if (ids.length === 1 && ids.indexOf(_washingtonSegmentID) !== -1) {
59678             return continueTo(multiSelect);
59679           } else {
59680             return continueTo(didSplit);
59681           }
59682         }, 300);
59683       });
59684       context.history().on("change.intro", function() {
59685         if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59686           return continueTo(rightClickIntersection);
59687         }
59688       });
59689       function continueTo(nextStep) {
59690         context.map().on("move.intro drawn.intro", null);
59691         context.ui().editMenu().on("toggled.intro", null);
59692         context.history().on("change.intro", null);
59693         nextStep();
59694       }
59695     }
59696     function multiDelete() {
59697       if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59698         return continueTo(rightClickIntersection);
59699       }
59700       var node = selectMenuItem(context, "delete").node();
59701       if (!node)
59702         return continueTo(multiRightClick);
59703       reveal(
59704         ".edit-menu",
59705         helpHtml("intro.lines.multi_delete"),
59706         { padding: 50 }
59707       );
59708       context.map().on("move.intro drawn.intro", function() {
59709         reveal(
59710           ".edit-menu",
59711           helpHtml("intro.lines.multi_delete"),
59712           { duration: 0, padding: 50 }
59713         );
59714       });
59715       context.on("exit.intro", function() {
59716         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
59717           return continueTo(multiSelect);
59718         }
59719       });
59720       context.history().on("change.intro", function() {
59721         if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
59722           continueTo(retryDelete);
59723         } else {
59724           continueTo(play);
59725         }
59726       });
59727       function continueTo(nextStep) {
59728         context.map().on("move.intro drawn.intro", null);
59729         context.on("exit.intro", null);
59730         context.history().on("change.intro", null);
59731         nextStep();
59732       }
59733     }
59734     function retryDelete() {
59735       context.enter(modeBrowse(context));
59736       var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59737       var box = pad(twelfthAvenue, padding, context);
59738       reveal(box, helpHtml("intro.lines.retry_delete"), {
59739         buttonText: _t.html("intro.ok"),
59740         buttonCallback: function() {
59741           continueTo(multiSelect);
59742         }
59743       });
59744       function continueTo(nextStep) {
59745         nextStep();
59746       }
59747     }
59748     function play() {
59749       dispatch14.call("done");
59750       reveal(
59751         ".ideditor",
59752         helpHtml("intro.lines.play", { next: _t("intro.buildings.title") }),
59753         {
59754           tooltipBox: ".intro-nav-wrap .chapter-building",
59755           buttonText: _t.html("intro.ok"),
59756           buttonCallback: function() {
59757             reveal(".ideditor");
59758           }
59759         }
59760       );
59761     }
59762     chapter.enter = function() {
59763       addLine();
59764     };
59765     chapter.exit = function() {
59766       timeouts.forEach(window.clearTimeout);
59767       select_default2(window).on("pointerdown.intro mousedown.intro", null, true);
59768       context.on("enter.intro exit.intro", null);
59769       context.map().on("move.intro drawn.intro", null);
59770       context.history().on("change.intro", null);
59771       context.container().select(".inspector-wrap").on("wheel.intro", null);
59772       context.container().select(".preset-list-button").on("click.intro", null);
59773     };
59774     chapter.restart = function() {
59775       chapter.exit();
59776       chapter.enter();
59777     };
59778     return utilRebind(chapter, dispatch14, "on");
59779   }
59780
59781   // modules/ui/intro/building.js
59782   function uiIntroBuilding(context, reveal) {
59783     var dispatch14 = dispatch_default("done");
59784     var house = [-85.62815, 41.95638];
59785     var tank = [-85.62732, 41.95347];
59786     var buildingCatetory = _mainPresetIndex.item("category-building");
59787     var housePreset = _mainPresetIndex.item("building/house");
59788     var tankPreset = _mainPresetIndex.item("man_made/storage_tank");
59789     var timeouts = [];
59790     var _houseID = null;
59791     var _tankID = null;
59792     var chapter = {
59793       title: "intro.buildings.title"
59794     };
59795     function timeout2(f3, t2) {
59796       timeouts.push(window.setTimeout(f3, t2));
59797     }
59798     function eventCancel(d3_event) {
59799       d3_event.stopPropagation();
59800       d3_event.preventDefault();
59801     }
59802     function revealHouse(center, text2, options2) {
59803       var padding = 160 * Math.pow(2, context.map().zoom() - 20);
59804       var box = pad(center, padding, context);
59805       reveal(box, text2, options2);
59806     }
59807     function revealTank(center, text2, options2) {
59808       var padding = 190 * Math.pow(2, context.map().zoom() - 19.5);
59809       var box = pad(center, padding, context);
59810       reveal(box, text2, options2);
59811     }
59812     function addHouse() {
59813       context.enter(modeBrowse(context));
59814       context.history().reset("initial");
59815       _houseID = null;
59816       var msec = transitionTime(house, context.map().center());
59817       if (msec) {
59818         reveal(null, null, { duration: 0 });
59819       }
59820       context.map().centerZoomEase(house, 19, msec);
59821       timeout2(function() {
59822         var tooltip = reveal(
59823           "button.add-area",
59824           helpHtml("intro.buildings.add_building")
59825         );
59826         tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-buildings");
59827         context.on("enter.intro", function(mode) {
59828           if (mode.id !== "add-area")
59829             return;
59830           continueTo(startHouse);
59831         });
59832       }, msec + 100);
59833       function continueTo(nextStep) {
59834         context.on("enter.intro", null);
59835         nextStep();
59836       }
59837     }
59838     function startHouse() {
59839       if (context.mode().id !== "add-area") {
59840         return continueTo(addHouse);
59841       }
59842       _houseID = null;
59843       context.map().zoomEase(20, 500);
59844       timeout2(function() {
59845         var startString = helpHtml("intro.buildings.start_building") + helpHtml("intro.buildings.building_corner_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
59846         revealHouse(house, startString);
59847         context.map().on("move.intro drawn.intro", function() {
59848           revealHouse(house, startString, { duration: 0 });
59849         });
59850         context.on("enter.intro", function(mode) {
59851           if (mode.id !== "draw-area")
59852             return chapter.restart();
59853           continueTo(continueHouse);
59854         });
59855       }, 550);
59856       function continueTo(nextStep) {
59857         context.map().on("move.intro drawn.intro", null);
59858         context.on("enter.intro", null);
59859         nextStep();
59860       }
59861     }
59862     function continueHouse() {
59863       if (context.mode().id !== "draw-area") {
59864         return continueTo(addHouse);
59865       }
59866       _houseID = null;
59867       var continueString = helpHtml("intro.buildings.continue_building") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_building");
59868       revealHouse(house, continueString);
59869       context.map().on("move.intro drawn.intro", function() {
59870         revealHouse(house, continueString, { duration: 0 });
59871       });
59872       context.on("enter.intro", function(mode) {
59873         if (mode.id === "draw-area") {
59874           return;
59875         } else if (mode.id === "select") {
59876           var graph = context.graph();
59877           var way = context.entity(context.selectedIDs()[0]);
59878           var nodes = graph.childNodes(way);
59879           var points = utilArrayUniq(nodes).map(function(n3) {
59880             return context.projection(n3.loc);
59881           });
59882           if (isMostlySquare(points)) {
59883             _houseID = way.id;
59884             return continueTo(chooseCategoryBuilding);
59885           } else {
59886             return continueTo(retryHouse);
59887           }
59888         } else {
59889           return chapter.restart();
59890         }
59891       });
59892       function continueTo(nextStep) {
59893         context.map().on("move.intro drawn.intro", null);
59894         context.on("enter.intro", null);
59895         nextStep();
59896       }
59897     }
59898     function retryHouse() {
59899       var onClick = function() {
59900         continueTo(addHouse);
59901       };
59902       revealHouse(
59903         house,
59904         helpHtml("intro.buildings.retry_building"),
59905         { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
59906       );
59907       context.map().on("move.intro drawn.intro", function() {
59908         revealHouse(
59909           house,
59910           helpHtml("intro.buildings.retry_building"),
59911           { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
59912         );
59913       });
59914       function continueTo(nextStep) {
59915         context.map().on("move.intro drawn.intro", null);
59916         nextStep();
59917       }
59918     }
59919     function chooseCategoryBuilding() {
59920       if (!_houseID || !context.hasEntity(_houseID)) {
59921         return addHouse();
59922       }
59923       var ids = context.selectedIDs();
59924       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
59925         context.enter(modeSelect(context, [_houseID]));
59926       }
59927       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
59928       timeout2(function() {
59929         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
59930         var button = context.container().select(".preset-category-building .preset-list-button");
59931         reveal(
59932           button.node(),
59933           helpHtml("intro.buildings.choose_category_building", { category: buildingCatetory.name() })
59934         );
59935         button.on("click.intro", function() {
59936           button.on("click.intro", null);
59937           continueTo(choosePresetHouse);
59938         });
59939       }, 400);
59940       context.on("enter.intro", function(mode) {
59941         if (!_houseID || !context.hasEntity(_houseID)) {
59942           return continueTo(addHouse);
59943         }
59944         var ids2 = context.selectedIDs();
59945         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
59946           return continueTo(chooseCategoryBuilding);
59947         }
59948       });
59949       function continueTo(nextStep) {
59950         context.container().select(".inspector-wrap").on("wheel.intro", null);
59951         context.container().select(".preset-list-button").on("click.intro", null);
59952         context.on("enter.intro", null);
59953         nextStep();
59954       }
59955     }
59956     function choosePresetHouse() {
59957       if (!_houseID || !context.hasEntity(_houseID)) {
59958         return addHouse();
59959       }
59960       var ids = context.selectedIDs();
59961       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
59962         context.enter(modeSelect(context, [_houseID]));
59963       }
59964       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
59965       timeout2(function() {
59966         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
59967         var button = context.container().select(".preset-building-house .preset-list-button");
59968         reveal(
59969           button.node(),
59970           helpHtml("intro.buildings.choose_preset_house", { preset: housePreset.name() }),
59971           { duration: 300 }
59972         );
59973         button.on("click.intro", function() {
59974           button.on("click.intro", null);
59975           continueTo(closeEditorHouse);
59976         });
59977       }, 400);
59978       context.on("enter.intro", function(mode) {
59979         if (!_houseID || !context.hasEntity(_houseID)) {
59980           return continueTo(addHouse);
59981         }
59982         var ids2 = context.selectedIDs();
59983         if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
59984           return continueTo(chooseCategoryBuilding);
59985         }
59986       });
59987       function continueTo(nextStep) {
59988         context.container().select(".inspector-wrap").on("wheel.intro", null);
59989         context.container().select(".preset-list-button").on("click.intro", null);
59990         context.on("enter.intro", null);
59991         nextStep();
59992       }
59993     }
59994     function closeEditorHouse() {
59995       if (!_houseID || !context.hasEntity(_houseID)) {
59996         return addHouse();
59997       }
59998       var ids = context.selectedIDs();
59999       if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
60000         context.enter(modeSelect(context, [_houseID]));
60001       }
60002       context.history().checkpoint("hasHouse");
60003       context.on("exit.intro", function() {
60004         continueTo(rightClickHouse);
60005       });
60006       timeout2(function() {
60007         reveal(
60008           ".entity-editor-pane",
60009           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
60010         );
60011       }, 500);
60012       function continueTo(nextStep) {
60013         context.on("exit.intro", null);
60014         nextStep();
60015       }
60016     }
60017     function rightClickHouse() {
60018       if (!_houseID)
60019         return chapter.restart();
60020       context.enter(modeBrowse(context));
60021       context.history().reset("hasHouse");
60022       var zoom = context.map().zoom();
60023       if (zoom < 20) {
60024         zoom = 20;
60025       }
60026       context.map().centerZoomEase(house, zoom, 500);
60027       context.on("enter.intro", function(mode) {
60028         if (mode.id !== "select")
60029           return;
60030         var ids = context.selectedIDs();
60031         if (ids.length !== 1 || ids[0] !== _houseID)
60032           return;
60033         timeout2(function() {
60034           var node = selectMenuItem(context, "orthogonalize").node();
60035           if (!node)
60036             return;
60037           continueTo(clickSquare);
60038         }, 50);
60039       });
60040       context.map().on("move.intro drawn.intro", function() {
60041         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_building" : "edit_menu_building_touch"));
60042         revealHouse(house, rightclickString, { duration: 0 });
60043       });
60044       context.history().on("change.intro", function() {
60045         continueTo(rightClickHouse);
60046       });
60047       function continueTo(nextStep) {
60048         context.on("enter.intro", null);
60049         context.map().on("move.intro drawn.intro", null);
60050         context.history().on("change.intro", null);
60051         nextStep();
60052       }
60053     }
60054     function clickSquare() {
60055       if (!_houseID)
60056         return chapter.restart();
60057       var entity = context.hasEntity(_houseID);
60058       if (!entity)
60059         return continueTo(rightClickHouse);
60060       var node = selectMenuItem(context, "orthogonalize").node();
60061       if (!node) {
60062         return continueTo(rightClickHouse);
60063       }
60064       var wasChanged = false;
60065       reveal(
60066         ".edit-menu",
60067         helpHtml("intro.buildings.square_building"),
60068         { padding: 50 }
60069       );
60070       context.on("enter.intro", function(mode) {
60071         if (mode.id === "browse") {
60072           continueTo(rightClickHouse);
60073         } else if (mode.id === "move" || mode.id === "rotate") {
60074           continueTo(retryClickSquare);
60075         }
60076       });
60077       context.map().on("move.intro", function() {
60078         var node2 = selectMenuItem(context, "orthogonalize").node();
60079         if (!wasChanged && !node2) {
60080           return continueTo(rightClickHouse);
60081         }
60082         reveal(
60083           ".edit-menu",
60084           helpHtml("intro.buildings.square_building"),
60085           { duration: 0, padding: 50 }
60086         );
60087       });
60088       context.history().on("change.intro", function() {
60089         wasChanged = true;
60090         context.history().on("change.intro", null);
60091         timeout2(function() {
60092           if (context.history().undoAnnotation() === _t("operations.orthogonalize.annotation.feature", { n: 1 })) {
60093             continueTo(doneSquare);
60094           } else {
60095             continueTo(retryClickSquare);
60096           }
60097         }, 500);
60098       });
60099       function continueTo(nextStep) {
60100         context.on("enter.intro", null);
60101         context.map().on("move.intro", null);
60102         context.history().on("change.intro", null);
60103         nextStep();
60104       }
60105     }
60106     function retryClickSquare() {
60107       context.enter(modeBrowse(context));
60108       revealHouse(house, helpHtml("intro.buildings.retry_square"), {
60109         buttonText: _t.html("intro.ok"),
60110         buttonCallback: function() {
60111           continueTo(rightClickHouse);
60112         }
60113       });
60114       function continueTo(nextStep) {
60115         nextStep();
60116       }
60117     }
60118     function doneSquare() {
60119       context.history().checkpoint("doneSquare");
60120       revealHouse(house, helpHtml("intro.buildings.done_square"), {
60121         buttonText: _t.html("intro.ok"),
60122         buttonCallback: function() {
60123           continueTo(addTank);
60124         }
60125       });
60126       function continueTo(nextStep) {
60127         nextStep();
60128       }
60129     }
60130     function addTank() {
60131       context.enter(modeBrowse(context));
60132       context.history().reset("doneSquare");
60133       _tankID = null;
60134       var msec = transitionTime(tank, context.map().center());
60135       if (msec) {
60136         reveal(null, null, { duration: 0 });
60137       }
60138       context.map().centerZoomEase(tank, 19.5, msec);
60139       timeout2(function() {
60140         reveal(
60141           "button.add-area",
60142           helpHtml("intro.buildings.add_tank")
60143         );
60144         context.on("enter.intro", function(mode) {
60145           if (mode.id !== "add-area")
60146             return;
60147           continueTo(startTank);
60148         });
60149       }, msec + 100);
60150       function continueTo(nextStep) {
60151         context.on("enter.intro", null);
60152         nextStep();
60153       }
60154     }
60155     function startTank() {
60156       if (context.mode().id !== "add-area") {
60157         return continueTo(addTank);
60158       }
60159       _tankID = null;
60160       timeout2(function() {
60161         var startString = helpHtml("intro.buildings.start_tank") + helpHtml("intro.buildings.tank_edge_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
60162         revealTank(tank, startString);
60163         context.map().on("move.intro drawn.intro", function() {
60164           revealTank(tank, startString, { duration: 0 });
60165         });
60166         context.on("enter.intro", function(mode) {
60167           if (mode.id !== "draw-area")
60168             return chapter.restart();
60169           continueTo(continueTank);
60170         });
60171       }, 550);
60172       function continueTo(nextStep) {
60173         context.map().on("move.intro drawn.intro", null);
60174         context.on("enter.intro", null);
60175         nextStep();
60176       }
60177     }
60178     function continueTank() {
60179       if (context.mode().id !== "draw-area") {
60180         return continueTo(addTank);
60181       }
60182       _tankID = null;
60183       var continueString = helpHtml("intro.buildings.continue_tank") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_tank");
60184       revealTank(tank, continueString);
60185       context.map().on("move.intro drawn.intro", function() {
60186         revealTank(tank, continueString, { duration: 0 });
60187       });
60188       context.on("enter.intro", function(mode) {
60189         if (mode.id === "draw-area") {
60190           return;
60191         } else if (mode.id === "select") {
60192           _tankID = context.selectedIDs()[0];
60193           return continueTo(searchPresetTank);
60194         } else {
60195           return continueTo(addTank);
60196         }
60197       });
60198       function continueTo(nextStep) {
60199         context.map().on("move.intro drawn.intro", null);
60200         context.on("enter.intro", null);
60201         nextStep();
60202       }
60203     }
60204     function searchPresetTank() {
60205       if (!_tankID || !context.hasEntity(_tankID)) {
60206         return addTank();
60207       }
60208       var ids = context.selectedIDs();
60209       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
60210         context.enter(modeSelect(context, [_tankID]));
60211       }
60212       context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60213       timeout2(function() {
60214         context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
60215         context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
60216         reveal(
60217           ".preset-search-input",
60218           helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
60219         );
60220       }, 400);
60221       context.on("enter.intro", function(mode) {
60222         if (!_tankID || !context.hasEntity(_tankID)) {
60223           return continueTo(addTank);
60224         }
60225         var ids2 = context.selectedIDs();
60226         if (mode.id !== "select" || !ids2.length || ids2[0] !== _tankID) {
60227           context.enter(modeSelect(context, [_tankID]));
60228           context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
60229           context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60230           context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
60231           reveal(
60232             ".preset-search-input",
60233             helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
60234           );
60235           context.history().on("change.intro", null);
60236         }
60237       });
60238       function checkPresetSearch() {
60239         var first = context.container().select(".preset-list-item:first-child");
60240         if (first.classed("preset-man_made-storage_tank")) {
60241           reveal(
60242             first.select(".preset-list-button").node(),
60243             helpHtml("intro.buildings.choose_tank", { preset: tankPreset.name() }),
60244             { duration: 300 }
60245           );
60246           context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
60247           context.history().on("change.intro", function() {
60248             continueTo(closeEditorTank);
60249           });
60250         }
60251       }
60252       function continueTo(nextStep) {
60253         context.container().select(".inspector-wrap").on("wheel.intro", null);
60254         context.on("enter.intro", null);
60255         context.history().on("change.intro", null);
60256         context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
60257         nextStep();
60258       }
60259     }
60260     function closeEditorTank() {
60261       if (!_tankID || !context.hasEntity(_tankID)) {
60262         return addTank();
60263       }
60264       var ids = context.selectedIDs();
60265       if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
60266         context.enter(modeSelect(context, [_tankID]));
60267       }
60268       context.history().checkpoint("hasTank");
60269       context.on("exit.intro", function() {
60270         continueTo(rightClickTank);
60271       });
60272       timeout2(function() {
60273         reveal(
60274           ".entity-editor-pane",
60275           helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
60276         );
60277       }, 500);
60278       function continueTo(nextStep) {
60279         context.on("exit.intro", null);
60280         nextStep();
60281       }
60282     }
60283     function rightClickTank() {
60284       if (!_tankID)
60285         return continueTo(addTank);
60286       context.enter(modeBrowse(context));
60287       context.history().reset("hasTank");
60288       context.map().centerEase(tank, 500);
60289       timeout2(function() {
60290         context.on("enter.intro", function(mode) {
60291           if (mode.id !== "select")
60292             return;
60293           var ids = context.selectedIDs();
60294           if (ids.length !== 1 || ids[0] !== _tankID)
60295             return;
60296           timeout2(function() {
60297             var node = selectMenuItem(context, "circularize").node();
60298             if (!node)
60299               return;
60300             continueTo(clickCircle);
60301           }, 50);
60302         });
60303         var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_tank" : "edit_menu_tank_touch"));
60304         revealTank(tank, rightclickString);
60305         context.map().on("move.intro drawn.intro", function() {
60306           revealTank(tank, rightclickString, { duration: 0 });
60307         });
60308         context.history().on("change.intro", function() {
60309           continueTo(rightClickTank);
60310         });
60311       }, 600);
60312       function continueTo(nextStep) {
60313         context.on("enter.intro", null);
60314         context.map().on("move.intro drawn.intro", null);
60315         context.history().on("change.intro", null);
60316         nextStep();
60317       }
60318     }
60319     function clickCircle() {
60320       if (!_tankID)
60321         return chapter.restart();
60322       var entity = context.hasEntity(_tankID);
60323       if (!entity)
60324         return continueTo(rightClickTank);
60325       var node = selectMenuItem(context, "circularize").node();
60326       if (!node) {
60327         return continueTo(rightClickTank);
60328       }
60329       var wasChanged = false;
60330       reveal(
60331         ".edit-menu",
60332         helpHtml("intro.buildings.circle_tank"),
60333         { padding: 50 }
60334       );
60335       context.on("enter.intro", function(mode) {
60336         if (mode.id === "browse") {
60337           continueTo(rightClickTank);
60338         } else if (mode.id === "move" || mode.id === "rotate") {
60339           continueTo(retryClickCircle);
60340         }
60341       });
60342       context.map().on("move.intro", function() {
60343         var node2 = selectMenuItem(context, "circularize").node();
60344         if (!wasChanged && !node2) {
60345           return continueTo(rightClickTank);
60346         }
60347         reveal(
60348           ".edit-menu",
60349           helpHtml("intro.buildings.circle_tank"),
60350           { duration: 0, padding: 50 }
60351         );
60352       });
60353       context.history().on("change.intro", function() {
60354         wasChanged = true;
60355         context.history().on("change.intro", null);
60356         timeout2(function() {
60357           if (context.history().undoAnnotation() === _t("operations.circularize.annotation.feature", { n: 1 })) {
60358             continueTo(play);
60359           } else {
60360             continueTo(retryClickCircle);
60361           }
60362         }, 500);
60363       });
60364       function continueTo(nextStep) {
60365         context.on("enter.intro", null);
60366         context.map().on("move.intro", null);
60367         context.history().on("change.intro", null);
60368         nextStep();
60369       }
60370     }
60371     function retryClickCircle() {
60372       context.enter(modeBrowse(context));
60373       revealTank(tank, helpHtml("intro.buildings.retry_circle"), {
60374         buttonText: _t.html("intro.ok"),
60375         buttonCallback: function() {
60376           continueTo(rightClickTank);
60377         }
60378       });
60379       function continueTo(nextStep) {
60380         nextStep();
60381       }
60382     }
60383     function play() {
60384       dispatch14.call("done");
60385       reveal(
60386         ".ideditor",
60387         helpHtml("intro.buildings.play", { next: _t("intro.startediting.title") }),
60388         {
60389           tooltipBox: ".intro-nav-wrap .chapter-startEditing",
60390           buttonText: _t.html("intro.ok"),
60391           buttonCallback: function() {
60392             reveal(".ideditor");
60393           }
60394         }
60395       );
60396     }
60397     chapter.enter = function() {
60398       addHouse();
60399     };
60400     chapter.exit = function() {
60401       timeouts.forEach(window.clearTimeout);
60402       context.on("enter.intro exit.intro", null);
60403       context.map().on("move.intro drawn.intro", null);
60404       context.history().on("change.intro", null);
60405       context.container().select(".inspector-wrap").on("wheel.intro", null);
60406       context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
60407       context.container().select(".more-fields .combobox-input").on("click.intro", null);
60408     };
60409     chapter.restart = function() {
60410       chapter.exit();
60411       chapter.enter();
60412     };
60413     return utilRebind(chapter, dispatch14, "on");
60414   }
60415
60416   // modules/ui/intro/start_editing.js
60417   function uiIntroStartEditing(context, reveal) {
60418     var dispatch14 = dispatch_default("done", "startEditing");
60419     var modalSelection = select_default2(null);
60420     var chapter = {
60421       title: "intro.startediting.title"
60422     };
60423     function showHelp() {
60424       reveal(
60425         ".map-control.help-control",
60426         helpHtml("intro.startediting.help"),
60427         {
60428           buttonText: _t.html("intro.ok"),
60429           buttonCallback: function() {
60430             shortcuts();
60431           }
60432         }
60433       );
60434     }
60435     function shortcuts() {
60436       reveal(
60437         ".map-control.help-control",
60438         helpHtml("intro.startediting.shortcuts"),
60439         {
60440           buttonText: _t.html("intro.ok"),
60441           buttonCallback: function() {
60442             showSave();
60443           }
60444         }
60445       );
60446     }
60447     function showSave() {
60448       context.container().selectAll(".shaded").remove();
60449       reveal(
60450         ".top-toolbar button.save",
60451         helpHtml("intro.startediting.save"),
60452         {
60453           buttonText: _t.html("intro.ok"),
60454           buttonCallback: function() {
60455             showStart();
60456           }
60457         }
60458       );
60459     }
60460     function showStart() {
60461       context.container().selectAll(".shaded").remove();
60462       modalSelection = uiModal(context.container());
60463       modalSelection.select(".modal").attr("class", "modal-splash modal");
60464       modalSelection.selectAll(".close").remove();
60465       var startbutton = modalSelection.select(".content").attr("class", "fillL").append("button").attr("class", "modal-section huge-modal-button").on("click", function() {
60466         modalSelection.remove();
60467       });
60468       startbutton.append("svg").attr("class", "illustration").append("use").attr("xlink:href", "#iD-logo-walkthrough");
60469       startbutton.append("h2").call(_t.append("intro.startediting.start"));
60470       dispatch14.call("startEditing");
60471     }
60472     chapter.enter = function() {
60473       showHelp();
60474     };
60475     chapter.exit = function() {
60476       modalSelection.remove();
60477       context.container().selectAll(".shaded").remove();
60478     };
60479     return utilRebind(chapter, dispatch14, "on");
60480   }
60481
60482   // modules/ui/intro/intro.js
60483   var chapterUi = {
60484     welcome: uiIntroWelcome,
60485     navigation: uiIntroNavigation,
60486     point: uiIntroPoint,
60487     area: uiIntroArea,
60488     line: uiIntroLine,
60489     building: uiIntroBuilding,
60490     startEditing: uiIntroStartEditing
60491   };
60492   var chapterFlow = [
60493     "welcome",
60494     "navigation",
60495     "point",
60496     "area",
60497     "line",
60498     "building",
60499     "startEditing"
60500   ];
60501   function uiIntro(context) {
60502     const INTRO_IMAGERY = "EsriWorldImageryClarity";
60503     let _introGraph = {};
60504     let _currChapter;
60505     function intro(selection2) {
60506       _mainFileFetcher.get("intro_graph").then((dataIntroGraph) => {
60507         for (let id2 in dataIntroGraph) {
60508           if (!_introGraph[id2]) {
60509             _introGraph[id2] = osmEntity(localize(dataIntroGraph[id2]));
60510           }
60511         }
60512         selection2.call(startIntro);
60513       }).catch(function() {
60514       });
60515     }
60516     function startIntro(selection2) {
60517       context.enter(modeBrowse(context));
60518       let osm = context.connection();
60519       let history = context.history().toJSON();
60520       let hash = window.location.hash;
60521       let center = context.map().center();
60522       let zoom = context.map().zoom();
60523       let background = context.background().baseLayerSource();
60524       let overlays = context.background().overlayLayerSources();
60525       let opacity = context.container().selectAll(".main-map .layer-background").style("opacity");
60526       let caches = osm && osm.caches();
60527       let baseEntities = context.history().graph().base().entities;
60528       context.ui().sidebar.expand();
60529       context.container().selectAll("button.sidebar-toggle").classed("disabled", true);
60530       context.inIntro(true);
60531       if (osm) {
60532         osm.toggle(false).reset();
60533       }
60534       context.history().reset();
60535       context.history().merge(Object.values(coreGraph().load(_introGraph).entities));
60536       context.history().checkpoint("initial");
60537       let imagery = context.background().findSource(INTRO_IMAGERY);
60538       if (imagery) {
60539         context.background().baseLayerSource(imagery);
60540       } else {
60541         context.background().bing();
60542       }
60543       overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
60544       let layers = context.layers();
60545       layers.all().forEach((item) => {
60546         if (typeof item.layer.enabled === "function") {
60547           item.layer.enabled(item.id === "osm");
60548         }
60549       });
60550       context.container().selectAll(".main-map .layer-background").style("opacity", 1);
60551       let curtain = uiCurtain(context.container().node());
60552       selection2.call(curtain);
60553       corePreferences("walkthrough_started", "yes");
60554       let storedProgress = corePreferences("walkthrough_progress") || "";
60555       let progress = storedProgress.split(";").filter(Boolean);
60556       let chapters = chapterFlow.map((chapter, i3) => {
60557         let s2 = chapterUi[chapter](context, curtain.reveal).on("done", () => {
60558           buttons.filter((d2) => d2.title === s2.title).classed("finished", true);
60559           if (i3 < chapterFlow.length - 1) {
60560             const next = chapterFlow[i3 + 1];
60561             context.container().select("button.chapter-".concat(next)).classed("next", true);
60562           }
60563           progress.push(chapter);
60564           corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
60565         });
60566         return s2;
60567       });
60568       chapters[chapters.length - 1].on("startEditing", () => {
60569         progress.push("startEditing");
60570         corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
60571         let incomplete = utilArrayDifference(chapterFlow, progress);
60572         if (!incomplete.length) {
60573           corePreferences("walkthrough_completed", "yes");
60574         }
60575         curtain.remove();
60576         navwrap.remove();
60577         context.container().selectAll(".main-map .layer-background").style("opacity", opacity);
60578         context.container().selectAll("button.sidebar-toggle").classed("disabled", false);
60579         if (osm) {
60580           osm.toggle(true).reset().caches(caches);
60581         }
60582         context.history().reset().merge(Object.values(baseEntities));
60583         context.background().baseLayerSource(background);
60584         overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
60585         if (history) {
60586           context.history().fromJSON(history, false);
60587         }
60588         context.map().centerZoom(center, zoom);
60589         window.location.replace(hash);
60590         context.inIntro(false);
60591       });
60592       let navwrap = selection2.append("div").attr("class", "intro-nav-wrap fillD");
60593       navwrap.append("svg").attr("class", "intro-nav-wrap-logo").append("use").attr("xlink:href", "#iD-logo-walkthrough");
60594       let buttonwrap = navwrap.append("div").attr("class", "joined").selectAll("button.chapter");
60595       let buttons = buttonwrap.data(chapters).enter().append("button").attr("class", (d2, i3) => "chapter chapter-".concat(chapterFlow[i3])).on("click", enterChapter);
60596       buttons.append("span").html((d2) => _t.html(d2.title));
60597       buttons.append("span").attr("class", "status").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
60598       enterChapter(null, chapters[0]);
60599       function enterChapter(d3_event, newChapter) {
60600         if (_currChapter) {
60601           _currChapter.exit();
60602         }
60603         context.enter(modeBrowse(context));
60604         _currChapter = newChapter;
60605         _currChapter.enter();
60606         buttons.classed("next", false).classed("active", (d2) => d2.title === _currChapter.title);
60607       }
60608     }
60609     return intro;
60610   }
60611
60612   // modules/ui/issues_info.js
60613   function uiIssuesInfo(context) {
60614     var warningsItem = {
60615       id: "warnings",
60616       count: 0,
60617       iconID: "iD-icon-alert",
60618       descriptionID: "issues.warnings_and_errors"
60619     };
60620     var resolvedItem = {
60621       id: "resolved",
60622       count: 0,
60623       iconID: "iD-icon-apply",
60624       descriptionID: "issues.user_resolved_issues"
60625     };
60626     function update(selection2) {
60627       var shownItems = [];
60628       var liveIssues = context.validator().getIssues({
60629         what: corePreferences("validate-what") || "edited",
60630         where: corePreferences("validate-where") || "all"
60631       });
60632       if (liveIssues.length) {
60633         warningsItem.count = liveIssues.length;
60634         shownItems.push(warningsItem);
60635       }
60636       if (corePreferences("validate-what") === "all") {
60637         var resolvedIssues = context.validator().getResolvedIssues();
60638         if (resolvedIssues.length) {
60639           resolvedItem.count = resolvedIssues.length;
60640           shownItems.push(resolvedItem);
60641         }
60642       }
60643       var chips = selection2.selectAll(".chip").data(shownItems, function(d2) {
60644         return d2.id;
60645       });
60646       chips.exit().remove();
60647       var enter = chips.enter().append("a").attr("class", function(d2) {
60648         return "chip " + d2.id + "-count";
60649       }).attr("href", "#").each(function(d2) {
60650         var chipSelection = select_default2(this);
60651         var tooltipBehavior = uiTooltip().placement("top").title(() => _t.append(d2.descriptionID));
60652         chipSelection.call(tooltipBehavior).on("click", function(d3_event) {
60653           d3_event.preventDefault();
60654           tooltipBehavior.hide(select_default2(this));
60655           context.ui().togglePanes(context.container().select(".map-panes .issues-pane"));
60656         });
60657         chipSelection.call(svgIcon("#" + d2.iconID));
60658       });
60659       enter.append("span").attr("class", "count");
60660       enter.merge(chips).selectAll("span.count").text(function(d2) {
60661         return d2.count.toString();
60662       });
60663     }
60664     return function(selection2) {
60665       update(selection2);
60666       context.validator().on("validated.infobox", function() {
60667         update(selection2);
60668       });
60669     };
60670   }
60671
60672   // modules/ui/map_in_map.js
60673   function uiMapInMap(context) {
60674     function mapInMap(selection2) {
60675       var backgroundLayer = rendererTileLayer(context);
60676       var overlayLayers = {};
60677       var projection2 = geoRawMercator();
60678       var dataLayer = svgData(projection2, context).showLabels(false);
60679       var debugLayer = svgDebug(projection2, context);
60680       var zoom = zoom_default2().scaleExtent([geoZoomToScale(0.5), geoZoomToScale(24)]).on("start", zoomStarted).on("zoom", zoomed).on("end", zoomEnded);
60681       var wrap2 = select_default2(null);
60682       var tiles = select_default2(null);
60683       var viewport = select_default2(null);
60684       var _isTransformed = false;
60685       var _isHidden = true;
60686       var _skipEvents = false;
60687       var _gesture = null;
60688       var _zDiff = 6;
60689       var _dMini;
60690       var _cMini;
60691       var _tStart;
60692       var _tCurr;
60693       var _timeoutID;
60694       function zoomStarted() {
60695         if (_skipEvents)
60696           return;
60697         _tStart = _tCurr = projection2.transform();
60698         _gesture = null;
60699       }
60700       function zoomed(d3_event) {
60701         if (_skipEvents)
60702           return;
60703         var x2 = d3_event.transform.x;
60704         var y2 = d3_event.transform.y;
60705         var k2 = d3_event.transform.k;
60706         var isZooming = k2 !== _tStart.k;
60707         var isPanning = x2 !== _tStart.x || y2 !== _tStart.y;
60708         if (!isZooming && !isPanning) {
60709           return;
60710         }
60711         if (!_gesture) {
60712           _gesture = isZooming ? "zoom" : "pan";
60713         }
60714         var tMini = projection2.transform();
60715         var tX, tY, scale;
60716         if (_gesture === "zoom") {
60717           scale = k2 / tMini.k;
60718           tX = (_cMini[0] / scale - _cMini[0]) * scale;
60719           tY = (_cMini[1] / scale - _cMini[1]) * scale;
60720         } else {
60721           k2 = tMini.k;
60722           scale = 1;
60723           tX = x2 - tMini.x;
60724           tY = y2 - tMini.y;
60725         }
60726         utilSetTransform(tiles, tX, tY, scale);
60727         utilSetTransform(viewport, 0, 0, scale);
60728         _isTransformed = true;
60729         _tCurr = identity2.translate(x2, y2).scale(k2);
60730         var zMain = geoScaleToZoom(context.projection.scale());
60731         var zMini = geoScaleToZoom(k2);
60732         _zDiff = zMain - zMini;
60733         queueRedraw();
60734       }
60735       function zoomEnded() {
60736         if (_skipEvents)
60737           return;
60738         if (_gesture !== "pan")
60739           return;
60740         updateProjection();
60741         _gesture = null;
60742         context.map().center(projection2.invert(_cMini));
60743       }
60744       function updateProjection() {
60745         var loc = context.map().center();
60746         var tMain = context.projection.transform();
60747         var zMain = geoScaleToZoom(tMain.k);
60748         var zMini = Math.max(zMain - _zDiff, 0.5);
60749         var kMini = geoZoomToScale(zMini);
60750         projection2.translate([tMain.x, tMain.y]).scale(kMini);
60751         var point2 = projection2(loc);
60752         var mouse = _gesture === "pan" ? geoVecSubtract([_tCurr.x, _tCurr.y], [_tStart.x, _tStart.y]) : [0, 0];
60753         var xMini = _cMini[0] - point2[0] + tMain.x + mouse[0];
60754         var yMini = _cMini[1] - point2[1] + tMain.y + mouse[1];
60755         projection2.translate([xMini, yMini]).clipExtent([[0, 0], _dMini]);
60756         _tCurr = projection2.transform();
60757         if (_isTransformed) {
60758           utilSetTransform(tiles, 0, 0);
60759           utilSetTransform(viewport, 0, 0);
60760           _isTransformed = false;
60761         }
60762         zoom.scaleExtent([geoZoomToScale(0.5), geoZoomToScale(zMain - 3)]);
60763         _skipEvents = true;
60764         wrap2.call(zoom.transform, _tCurr);
60765         _skipEvents = false;
60766       }
60767       function redraw() {
60768         clearTimeout(_timeoutID);
60769         if (_isHidden)
60770           return;
60771         updateProjection();
60772         var zMini = geoScaleToZoom(projection2.scale());
60773         tiles = wrap2.selectAll(".map-in-map-tiles").data([0]);
60774         tiles = tiles.enter().append("div").attr("class", "map-in-map-tiles").merge(tiles);
60775         backgroundLayer.source(context.background().baseLayerSource()).projection(projection2).dimensions(_dMini);
60776         var background = tiles.selectAll(".map-in-map-background").data([0]);
60777         background.enter().append("div").attr("class", "map-in-map-background").merge(background).call(backgroundLayer);
60778         var overlaySources = context.background().overlayLayerSources();
60779         var activeOverlayLayers = [];
60780         for (var i3 = 0; i3 < overlaySources.length; i3++) {
60781           if (overlaySources[i3].validZoom(zMini)) {
60782             if (!overlayLayers[i3])
60783               overlayLayers[i3] = rendererTileLayer(context);
60784             activeOverlayLayers.push(overlayLayers[i3].source(overlaySources[i3]).projection(projection2).dimensions(_dMini));
60785           }
60786         }
60787         var overlay = tiles.selectAll(".map-in-map-overlay").data([0]);
60788         overlay = overlay.enter().append("div").attr("class", "map-in-map-overlay").merge(overlay);
60789         var overlays = overlay.selectAll("div").data(activeOverlayLayers, function(d2) {
60790           return d2.source().name();
60791         });
60792         overlays.exit().remove();
60793         overlays = overlays.enter().append("div").merge(overlays).each(function(layer) {
60794           select_default2(this).call(layer);
60795         });
60796         var dataLayers = tiles.selectAll(".map-in-map-data").data([0]);
60797         dataLayers.exit().remove();
60798         dataLayers = dataLayers.enter().append("svg").attr("class", "map-in-map-data").merge(dataLayers).call(dataLayer).call(debugLayer);
60799         if (_gesture !== "pan") {
60800           var getPath = path_default(projection2);
60801           var bbox2 = { type: "Polygon", coordinates: [context.map().extent().polygon()] };
60802           viewport = wrap2.selectAll(".map-in-map-viewport").data([0]);
60803           viewport = viewport.enter().append("svg").attr("class", "map-in-map-viewport").merge(viewport);
60804           var path = viewport.selectAll(".map-in-map-bbox").data([bbox2]);
60805           path.enter().append("path").attr("class", "map-in-map-bbox").merge(path).attr("d", getPath).classed("thick", function(d2) {
60806             return getPath.area(d2) < 30;
60807           });
60808         }
60809       }
60810       function queueRedraw() {
60811         clearTimeout(_timeoutID);
60812         _timeoutID = setTimeout(function() {
60813           redraw();
60814         }, 750);
60815       }
60816       function toggle(d3_event) {
60817         if (d3_event)
60818           d3_event.preventDefault();
60819         _isHidden = !_isHidden;
60820         context.container().select(".minimap-toggle-item").classed("active", !_isHidden).select("input").property("checked", !_isHidden);
60821         if (_isHidden) {
60822           wrap2.style("display", "block").style("opacity", "1").transition().duration(200).style("opacity", "0").on("end", function() {
60823             selection2.selectAll(".map-in-map").style("display", "none");
60824           });
60825         } else {
60826           wrap2.style("display", "block").style("opacity", "0").transition().duration(200).style("opacity", "1").on("end", function() {
60827             redraw();
60828           });
60829         }
60830       }
60831       uiMapInMap.toggle = toggle;
60832       wrap2 = selection2.selectAll(".map-in-map").data([0]);
60833       wrap2 = wrap2.enter().append("div").attr("class", "map-in-map").style("display", _isHidden ? "none" : "block").call(zoom).on("dblclick.zoom", null).merge(wrap2);
60834       _dMini = [200, 150];
60835       _cMini = geoVecScale(_dMini, 0.5);
60836       context.map().on("drawn.map-in-map", function(drawn) {
60837         if (drawn.full === true) {
60838           redraw();
60839         }
60840       });
60841       redraw();
60842       context.keybinding().on(_t("background.minimap.key"), toggle);
60843     }
60844     return mapInMap;
60845   }
60846
60847   // modules/ui/notice.js
60848   function uiNotice(context) {
60849     return function(selection2) {
60850       var div = selection2.append("div").attr("class", "notice");
60851       var button = div.append("button").attr("class", "zoom-to notice fillD").on("click", function() {
60852         context.map().zoomEase(context.minEditableZoom());
60853       }).on("wheel", function(d3_event) {
60854         var e22 = new WheelEvent(d3_event.type, d3_event);
60855         context.surface().node().dispatchEvent(e22);
60856       });
60857       button.call(svgIcon("#iD-icon-plus", "pre-text")).append("span").attr("class", "label").call(_t.append("zoom_in_edit"));
60858       function disableTooHigh() {
60859         var canEdit = context.map().zoom() >= context.minEditableZoom();
60860         div.style("display", canEdit ? "none" : "block");
60861       }
60862       context.map().on("move.notice", debounce_default(disableTooHigh, 500));
60863       disableTooHigh();
60864     };
60865   }
60866
60867   // modules/ui/photoviewer.js
60868   function uiPhotoviewer(context) {
60869     var dispatch14 = dispatch_default("resize");
60870     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
60871     function photoviewer(selection2) {
60872       selection2.append("button").attr("class", "thumb-hide").attr("title", _t("icons.close")).on("click", function() {
60873         if (services.streetside) {
60874           services.streetside.hideViewer(context);
60875         }
60876         if (services.mapillary) {
60877           services.mapillary.hideViewer(context);
60878         }
60879         if (services.kartaview) {
60880           services.kartaview.hideViewer(context);
60881         }
60882         if (services.mapilio) {
60883           services.mapilio.hideViewer(context);
60884         }
60885         if (services.vegbilder) {
60886           services.vegbilder.hideViewer(context);
60887         }
60888       }).append("div").call(svgIcon("#iD-icon-close"));
60889       function preventDefault(d3_event) {
60890         d3_event.preventDefault();
60891       }
60892       selection2.append("button").attr("class", "resize-handle-xy").on("touchstart touchdown touchend", preventDefault).on(
60893         _pointerPrefix + "down",
60894         buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true, resizeOnY: true })
60895       );
60896       selection2.append("button").attr("class", "resize-handle-x").on("touchstart touchdown touchend", preventDefault).on(
60897         _pointerPrefix + "down",
60898         buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true })
60899       );
60900       selection2.append("button").attr("class", "resize-handle-y").on("touchstart touchdown touchend", preventDefault).on(
60901         _pointerPrefix + "down",
60902         buildResizeListener(selection2, "resize", dispatch14, { resizeOnY: true })
60903       );
60904       function buildResizeListener(target, eventName, dispatch15, options2) {
60905         var resizeOnX = !!options2.resizeOnX;
60906         var resizeOnY = !!options2.resizeOnY;
60907         var minHeight = options2.minHeight || 240;
60908         var minWidth = options2.minWidth || 320;
60909         var pointerId;
60910         var startX;
60911         var startY;
60912         var startWidth;
60913         var startHeight;
60914         function startResize(d3_event) {
60915           if (pointerId !== (d3_event.pointerId || "mouse"))
60916             return;
60917           d3_event.preventDefault();
60918           d3_event.stopPropagation();
60919           var mapSize = context.map().dimensions();
60920           if (resizeOnX) {
60921             var maxWidth = mapSize[0];
60922             var newWidth = clamp3(startWidth + d3_event.clientX - startX, minWidth, maxWidth);
60923             target.style("width", newWidth + "px");
60924           }
60925           if (resizeOnY) {
60926             var maxHeight = mapSize[1] - 90;
60927             var newHeight = clamp3(startHeight + startY - d3_event.clientY, minHeight, maxHeight);
60928             target.style("height", newHeight + "px");
60929           }
60930           dispatch15.call(eventName, target, subtractPadding(utilGetDimensions(target, true), target));
60931         }
60932         function clamp3(num, min3, max3) {
60933           return Math.max(min3, Math.min(num, max3));
60934         }
60935         function stopResize(d3_event) {
60936           if (pointerId !== (d3_event.pointerId || "mouse"))
60937             return;
60938           d3_event.preventDefault();
60939           d3_event.stopPropagation();
60940           select_default2(window).on("." + eventName, null);
60941         }
60942         return function initResize(d3_event) {
60943           d3_event.preventDefault();
60944           d3_event.stopPropagation();
60945           pointerId = d3_event.pointerId || "mouse";
60946           startX = d3_event.clientX;
60947           startY = d3_event.clientY;
60948           var targetRect = target.node().getBoundingClientRect();
60949           startWidth = targetRect.width;
60950           startHeight = targetRect.height;
60951           select_default2(window).on(_pointerPrefix + "move." + eventName, startResize, false).on(_pointerPrefix + "up." + eventName, stopResize, false);
60952           if (_pointerPrefix === "pointer") {
60953             select_default2(window).on("pointercancel." + eventName, stopResize, false);
60954           }
60955         };
60956       }
60957     }
60958     photoviewer.onMapResize = function() {
60959       var photoviewer2 = context.container().select(".photoviewer");
60960       var content = context.container().select(".main-content");
60961       var mapDimensions = utilGetDimensions(content, true);
60962       var photoDimensions = utilGetDimensions(photoviewer2, true);
60963       if (photoDimensions[0] > mapDimensions[0] || photoDimensions[1] > mapDimensions[1] - 90) {
60964         var setPhotoDimensions = [
60965           Math.min(photoDimensions[0], mapDimensions[0]),
60966           Math.min(photoDimensions[1], mapDimensions[1] - 90)
60967         ];
60968         photoviewer2.style("width", setPhotoDimensions[0] + "px").style("height", setPhotoDimensions[1] + "px");
60969         dispatch14.call("resize", photoviewer2, subtractPadding(setPhotoDimensions, photoviewer2));
60970       }
60971     };
60972     function subtractPadding(dimensions, selection2) {
60973       return [
60974         dimensions[0] - parseFloat(selection2.style("padding-left")) - parseFloat(selection2.style("padding-right")),
60975         dimensions[1] - parseFloat(selection2.style("padding-top")) - parseFloat(selection2.style("padding-bottom"))
60976       ];
60977     }
60978     return utilRebind(photoviewer, dispatch14, "on");
60979   }
60980
60981   // modules/ui/restore.js
60982   function uiRestore(context) {
60983     return function(selection2) {
60984       if (!context.history().hasRestorableChanges())
60985         return;
60986       let modalSelection = uiModal(selection2, true);
60987       modalSelection.select(".modal").attr("class", "modal fillL");
60988       let introModal = modalSelection.select(".content");
60989       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("restore.heading"));
60990       introModal.append("div").attr("class", "modal-section").append("p").call(_t.append("restore.description"));
60991       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
60992       let restore = buttonWrap.append("button").attr("class", "restore").on("click", () => {
60993         context.history().restore();
60994         modalSelection.remove();
60995       });
60996       restore.append("svg").attr("class", "logo logo-restore").append("use").attr("xlink:href", "#iD-logo-restore");
60997       restore.append("div").call(_t.append("restore.restore"));
60998       let reset = buttonWrap.append("button").attr("class", "reset").on("click", () => {
60999         context.history().clearSaved();
61000         modalSelection.remove();
61001       });
61002       reset.append("svg").attr("class", "logo logo-reset").append("use").attr("xlink:href", "#iD-logo-reset");
61003       reset.append("div").call(_t.append("restore.reset"));
61004       restore.node().focus();
61005     };
61006   }
61007
61008   // modules/ui/scale.js
61009   function uiScale(context) {
61010     var projection2 = context.projection, isImperial = !_mainLocalizer.usesMetric(), maxLength = 180, tickHeight = 8;
61011     function scaleDefs(loc1, loc2) {
61012       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;
61013       if (isImperial) {
61014         buckets = [528e4, 528e3, 52800, 5280, 500, 50, 5, 1];
61015       } else {
61016         buckets = [5e6, 5e5, 5e4, 5e3, 500, 50, 5, 1];
61017       }
61018       for (i3 = 0; i3 < buckets.length; i3++) {
61019         val = buckets[i3];
61020         if (dist >= val) {
61021           scale.dist = Math.floor(dist / val) * val;
61022           break;
61023         } else {
61024           scale.dist = +dist.toFixed(2);
61025         }
61026       }
61027       dLon = geoMetersToLon(scale.dist / conversion, lat);
61028       scale.px = Math.round(projection2([loc1[0] + dLon, loc1[1]])[0]);
61029       scale.text = displayLength(scale.dist / conversion, isImperial);
61030       return scale;
61031     }
61032     function update(selection2) {
61033       var dims = context.map().dimensions(), loc1 = projection2.invert([0, dims[1]]), loc2 = projection2.invert([maxLength, dims[1]]), scale = scaleDefs(loc1, loc2);
61034       selection2.select(".scale-path").attr("d", "M0.5,0.5v" + tickHeight + "h" + scale.px + "v-" + tickHeight);
61035       selection2.select(".scale-text").style(_mainLocalizer.textDirection() === "ltr" ? "left" : "right", scale.px + 16 + "px").text(scale.text);
61036     }
61037     return function(selection2) {
61038       function switchUnits() {
61039         isImperial = !isImperial;
61040         selection2.call(update);
61041       }
61042       var scalegroup = selection2.append("svg").attr("class", "scale").on("click", switchUnits).append("g").attr("transform", "translate(10,11)");
61043       scalegroup.append("path").attr("class", "scale-path");
61044       selection2.append("div").attr("class", "scale-text");
61045       selection2.call(update);
61046       context.map().on("move.scale", function() {
61047         update(selection2);
61048       });
61049     };
61050   }
61051
61052   // modules/ui/shortcuts.js
61053   function uiShortcuts(context) {
61054     var detected = utilDetect();
61055     var _activeTab = 0;
61056     var _modalSelection;
61057     var _selection = select_default2(null);
61058     var _dataShortcuts;
61059     function shortcutsModal(_modalSelection2) {
61060       _modalSelection2.select(".modal").classed("modal-shortcuts", true);
61061       var content = _modalSelection2.select(".content");
61062       content.append("div").attr("class", "modal-section header").append("h2").call(_t.append("shortcuts.title"));
61063       _mainFileFetcher.get("shortcuts").then(function(data) {
61064         _dataShortcuts = data;
61065         content.call(render);
61066       }).catch(function() {
61067       });
61068     }
61069     function render(selection2) {
61070       if (!_dataShortcuts)
61071         return;
61072       var wrapper = selection2.selectAll(".wrapper").data([0]);
61073       var wrapperEnter = wrapper.enter().append("div").attr("class", "wrapper modal-section");
61074       var tabsBar = wrapperEnter.append("div").attr("class", "tabs-bar");
61075       var shortcutsList = wrapperEnter.append("div").attr("class", "shortcuts-list");
61076       wrapper = wrapper.merge(wrapperEnter);
61077       var tabs = tabsBar.selectAll(".tab").data(_dataShortcuts);
61078       var tabsEnter = tabs.enter().append("a").attr("class", "tab").attr("href", "#").on("click", function(d3_event, d2) {
61079         d3_event.preventDefault();
61080         var i3 = _dataShortcuts.indexOf(d2);
61081         _activeTab = i3;
61082         render(selection2);
61083       });
61084       tabsEnter.append("span").html(function(d2) {
61085         return _t.html(d2.text);
61086       });
61087       wrapper.selectAll(".tab").classed("active", function(d2, i3) {
61088         return i3 === _activeTab;
61089       });
61090       var shortcuts = shortcutsList.selectAll(".shortcut-tab").data(_dataShortcuts);
61091       var shortcutsEnter = shortcuts.enter().append("div").attr("class", function(d2) {
61092         return "shortcut-tab shortcut-tab-" + d2.tab;
61093       });
61094       var columnsEnter = shortcutsEnter.selectAll(".shortcut-column").data(function(d2) {
61095         return d2.columns;
61096       }).enter().append("table").attr("class", "shortcut-column");
61097       var rowsEnter = columnsEnter.selectAll(".shortcut-row").data(function(d2) {
61098         return d2.rows;
61099       }).enter().append("tr").attr("class", "shortcut-row");
61100       var sectionRows = rowsEnter.filter(function(d2) {
61101         return !d2.shortcuts;
61102       });
61103       sectionRows.append("td");
61104       sectionRows.append("td").attr("class", "shortcut-section").append("h3").html(function(d2) {
61105         return _t.html(d2.text);
61106       });
61107       var shortcutRows = rowsEnter.filter(function(d2) {
61108         return d2.shortcuts;
61109       });
61110       var shortcutKeys = shortcutRows.append("td").attr("class", "shortcut-keys");
61111       var modifierKeys = shortcutKeys.filter(function(d2) {
61112         return d2.modifiers;
61113       });
61114       modifierKeys.selectAll("kbd.modifier").data(function(d2) {
61115         if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
61116           return ["\u2318"];
61117         } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
61118           return [];
61119         } else {
61120           return d2.modifiers;
61121         }
61122       }).enter().each(function() {
61123         var selection3 = select_default2(this);
61124         selection3.append("kbd").attr("class", "modifier").text(function(d2) {
61125           return uiCmd.display(d2);
61126         });
61127         selection3.append("span").text("+");
61128       });
61129       shortcutKeys.selectAll("kbd.shortcut").data(function(d2) {
61130         var arr = d2.shortcuts;
61131         if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
61132           arr = ["Y"];
61133         } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
61134           arr = ["F11"];
61135         }
61136         arr = arr.map(function(s2) {
61137           return uiCmd.display(s2.indexOf(".") !== -1 ? _t(s2) : s2);
61138         });
61139         return utilArrayUniq(arr).map(function(s2) {
61140           return {
61141             shortcut: s2,
61142             separator: d2.separator,
61143             suffix: d2.suffix
61144           };
61145         });
61146       }).enter().each(function(d2, i3, nodes) {
61147         var selection3 = select_default2(this);
61148         var click = d2.shortcut.toLowerCase().match(/(.*).click/);
61149         if (click && click[1]) {
61150           selection3.call(svgIcon("#iD-walkthrough-mouse-" + click[1], "operation"));
61151         } else if (d2.shortcut.toLowerCase() === "long-press") {
61152           selection3.call(svgIcon("#iD-walkthrough-longpress", "longpress operation"));
61153         } else if (d2.shortcut.toLowerCase() === "tap") {
61154           selection3.call(svgIcon("#iD-walkthrough-tap", "tap operation"));
61155         } else {
61156           selection3.append("kbd").attr("class", "shortcut").text(function(d4) {
61157             return d4.shortcut;
61158           });
61159         }
61160         if (i3 < nodes.length - 1) {
61161           selection3.append("span").html(d2.separator || "\xA0" + _t.html("shortcuts.or") + "\xA0");
61162         } else if (i3 === nodes.length - 1 && d2.suffix) {
61163           selection3.append("span").text(d2.suffix);
61164         }
61165       });
61166       shortcutKeys.filter(function(d2) {
61167         return d2.gesture;
61168       }).each(function() {
61169         var selection3 = select_default2(this);
61170         selection3.append("span").text("+");
61171         selection3.append("span").attr("class", "gesture").html(function(d2) {
61172           return _t.html(d2.gesture);
61173         });
61174       });
61175       shortcutRows.append("td").attr("class", "shortcut-desc").html(function(d2) {
61176         return d2.text ? _t.html(d2.text) : "\xA0";
61177       });
61178       wrapper.selectAll(".shortcut-tab").style("display", function(d2, i3) {
61179         return i3 === _activeTab ? "flex" : "none";
61180       });
61181     }
61182     return function(selection2, show) {
61183       _selection = selection2;
61184       if (show) {
61185         _modalSelection = uiModal(selection2);
61186         _modalSelection.call(shortcutsModal);
61187       } else {
61188         context.keybinding().on([_t("shortcuts.toggle.key"), "?"], function() {
61189           if (context.container().selectAll(".modal-shortcuts").size()) {
61190             if (_modalSelection) {
61191               _modalSelection.close();
61192               _modalSelection = null;
61193             }
61194           } else {
61195             _modalSelection = uiModal(_selection);
61196             _modalSelection.call(shortcutsModal);
61197           }
61198         });
61199       }
61200     };
61201   }
61202
61203   // modules/ui/data_header.js
61204   function uiDataHeader() {
61205     var _datum;
61206     function dataHeader(selection2) {
61207       var header = selection2.selectAll(".data-header").data(
61208         _datum ? [_datum] : [],
61209         function(d2) {
61210           return d2.__featurehash__;
61211         }
61212       );
61213       header.exit().remove();
61214       var headerEnter = header.enter().append("div").attr("class", "data-header");
61215       var iconEnter = headerEnter.append("div").attr("class", "data-header-icon");
61216       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-data", "note-fill"));
61217       headerEnter.append("div").attr("class", "data-header-label").call(_t.append("map_data.layers.custom.title"));
61218     }
61219     dataHeader.datum = function(val) {
61220       if (!arguments.length)
61221         return _datum;
61222       _datum = val;
61223       return this;
61224     };
61225     return dataHeader;
61226   }
61227
61228   // modules/ui/combobox.js
61229   var _comboHideTimerID;
61230   function uiCombobox(context, klass) {
61231     var dispatch14 = dispatch_default("accept", "cancel", "update");
61232     var container = context.container();
61233     var _suggestions = [];
61234     var _data = [];
61235     var _fetched = {};
61236     var _selected = null;
61237     var _canAutocomplete = true;
61238     var _caseSensitive = false;
61239     var _cancelFetch = false;
61240     var _minItems = 2;
61241     var _tDown = 0;
61242     var _mouseEnterHandler, _mouseLeaveHandler;
61243     var _fetcher = function(val, cb) {
61244       cb(_data.filter(function(d2) {
61245         var terms = d2.terms || [];
61246         terms.push(d2.value);
61247         if (d2.key) {
61248           terms.push(d2.key);
61249         }
61250         return terms.some(function(term) {
61251           return term.toString().toLowerCase().indexOf(val.toLowerCase()) !== -1;
61252         });
61253       }));
61254     };
61255     var combobox = function(input, attachTo) {
61256       if (!input || input.empty())
61257         return;
61258       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() {
61259         var parent = this.parentNode;
61260         var sibling = this.nextSibling;
61261         select_default2(parent).selectAll(".combobox-caret").filter(function(d2) {
61262           return d2 === input.node();
61263         }).data([input.node()]).enter().insert("div", function() {
61264           return sibling;
61265         }).attr("class", "combobox-caret").on("mousedown.combo-caret", function(d3_event) {
61266           d3_event.preventDefault();
61267           input.node().focus();
61268           mousedown(d3_event);
61269         }).on("mouseup.combo-caret", function(d3_event) {
61270           d3_event.preventDefault();
61271           mouseup(d3_event);
61272         });
61273       });
61274       function mousedown(d3_event) {
61275         if (d3_event.button !== 0)
61276           return;
61277         if (input.classed("disabled"))
61278           return;
61279         _tDown = +/* @__PURE__ */ new Date();
61280         var start2 = input.property("selectionStart");
61281         var end = input.property("selectionEnd");
61282         if (start2 !== end) {
61283           var val = utilGetSetValue(input);
61284           input.node().setSelectionRange(val.length, val.length);
61285           return;
61286         }
61287         input.on("mouseup.combo-input", mouseup);
61288       }
61289       function mouseup(d3_event) {
61290         input.on("mouseup.combo-input", null);
61291         if (d3_event.button !== 0)
61292           return;
61293         if (input.classed("disabled"))
61294           return;
61295         if (input.node() !== document.activeElement)
61296           return;
61297         var start2 = input.property("selectionStart");
61298         var end = input.property("selectionEnd");
61299         if (start2 !== end)
61300           return;
61301         var combo = container.selectAll(".combobox");
61302         if (combo.empty() || combo.datum() !== input.node()) {
61303           var tOrig = _tDown;
61304           window.setTimeout(function() {
61305             if (tOrig !== _tDown)
61306               return;
61307             fetchComboData("", function() {
61308               show();
61309               render();
61310             });
61311           }, 250);
61312         } else {
61313           hide();
61314         }
61315       }
61316       function focus() {
61317         fetchComboData("");
61318       }
61319       function blur() {
61320         _comboHideTimerID = window.setTimeout(hide, 75);
61321       }
61322       function show() {
61323         hide();
61324         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) {
61325           d3_event.preventDefault();
61326         });
61327         container.on("scroll.combo-scroll", render, true);
61328       }
61329       function hide() {
61330         if (_comboHideTimerID) {
61331           window.clearTimeout(_comboHideTimerID);
61332           _comboHideTimerID = void 0;
61333         }
61334         container.selectAll(".combobox").remove();
61335         container.on("scroll.combo-scroll", null);
61336       }
61337       function keydown(d3_event) {
61338         var shown = !container.selectAll(".combobox").empty();
61339         var tagName = input.node() ? input.node().tagName.toLowerCase() : "";
61340         switch (d3_event.keyCode) {
61341           case 8:
61342           case 46:
61343             d3_event.stopPropagation();
61344             _selected = null;
61345             render();
61346             input.on("input.combo-input", function() {
61347               var start2 = input.property("selectionStart");
61348               input.node().setSelectionRange(start2, start2);
61349               input.on("input.combo-input", change);
61350               change(false);
61351             });
61352             break;
61353           case 9:
61354             accept(d3_event);
61355             break;
61356           case 13:
61357             d3_event.preventDefault();
61358             d3_event.stopPropagation();
61359             accept(d3_event);
61360             break;
61361           case 38:
61362             if (tagName === "textarea" && !shown)
61363               return;
61364             d3_event.preventDefault();
61365             if (tagName === "input" && !shown) {
61366               show();
61367             }
61368             nav(-1);
61369             break;
61370           case 40:
61371             if (tagName === "textarea" && !shown)
61372               return;
61373             d3_event.preventDefault();
61374             if (tagName === "input" && !shown) {
61375               show();
61376             }
61377             nav(1);
61378             break;
61379         }
61380       }
61381       function keyup(d3_event) {
61382         switch (d3_event.keyCode) {
61383           case 27:
61384             cancel();
61385             break;
61386         }
61387       }
61388       function change(doAutoComplete) {
61389         if (doAutoComplete === void 0)
61390           doAutoComplete = true;
61391         fetchComboData(value(), function(skipAutosuggest) {
61392           _selected = null;
61393           var val = input.property("value");
61394           if (_suggestions.length) {
61395             if (doAutoComplete && !skipAutosuggest && input.property("selectionEnd") === val.length) {
61396               _selected = tryAutocomplete();
61397             }
61398             if (!_selected) {
61399               _selected = val;
61400             }
61401           }
61402           if (val.length) {
61403             var combo = container.selectAll(".combobox");
61404             if (combo.empty()) {
61405               show();
61406             }
61407           } else {
61408             hide();
61409           }
61410           render();
61411         });
61412       }
61413       function nav(dir) {
61414         if (_suggestions.length) {
61415           var index = -1;
61416           for (var i3 = 0; i3 < _suggestions.length; i3++) {
61417             if (_selected && _suggestions[i3].value === _selected) {
61418               index = i3;
61419               break;
61420             }
61421           }
61422           index = Math.max(Math.min(index + dir, _suggestions.length - 1), 0);
61423           _selected = _suggestions[index].value;
61424           utilGetSetValue(input, _selected);
61425           dispatch14.call("update");
61426         }
61427         render();
61428         ensureVisible();
61429       }
61430       function ensureVisible() {
61431         var combo = container.selectAll(".combobox");
61432         if (combo.empty())
61433           return;
61434         var containerRect = container.node().getBoundingClientRect();
61435         var comboRect = combo.node().getBoundingClientRect();
61436         if (comboRect.bottom > containerRect.bottom) {
61437           var node = attachTo ? attachTo.node() : input.node();
61438           node.scrollIntoView({ behavior: "instant", block: "center" });
61439           render();
61440         }
61441         var selected = combo.selectAll(".combobox-option.selected").node();
61442         if (selected) {
61443           selected.scrollIntoView({ behavior: "smooth", block: "nearest" });
61444         }
61445       }
61446       function value() {
61447         var value2 = input.property("value");
61448         var start2 = input.property("selectionStart");
61449         var end = input.property("selectionEnd");
61450         if (start2 && end) {
61451           value2 = value2.substring(0, start2);
61452         }
61453         return value2;
61454       }
61455       function fetchComboData(v2, cb) {
61456         _cancelFetch = false;
61457         _fetcher.call(input, v2, function(results, skipAutosuggest) {
61458           if (_cancelFetch)
61459             return;
61460           _suggestions = results;
61461           results.forEach(function(d2) {
61462             _fetched[d2.value] = d2;
61463           });
61464           if (cb) {
61465             cb(skipAutosuggest);
61466           }
61467         });
61468       }
61469       function tryAutocomplete() {
61470         if (!_canAutocomplete)
61471           return;
61472         var val = _caseSensitive ? value() : value().toLowerCase();
61473         if (!val)
61474           return;
61475         if (isFinite(val))
61476           return;
61477         const suggestionValues = [];
61478         _suggestions.forEach((s2) => {
61479           suggestionValues.push(s2.value);
61480           if (s2.key && s2.key !== s2.value) {
61481             suggestionValues.push(s2.key);
61482           }
61483         });
61484         var bestIndex = -1;
61485         for (var i3 = 0; i3 < suggestionValues.length; i3++) {
61486           var suggestion = suggestionValues[i3];
61487           var compare = _caseSensitive ? suggestion : suggestion.toLowerCase();
61488           if (compare === val) {
61489             bestIndex = i3;
61490             break;
61491           } else if (bestIndex === -1 && compare.indexOf(val) === 0) {
61492             bestIndex = i3;
61493           }
61494         }
61495         if (bestIndex !== -1) {
61496           var bestVal = suggestionValues[bestIndex];
61497           input.property("value", bestVal);
61498           input.node().setSelectionRange(val.length, bestVal.length);
61499           dispatch14.call("update");
61500           return bestVal;
61501         }
61502       }
61503       function render() {
61504         if (_suggestions.length < _minItems || document.activeElement !== input.node()) {
61505           hide();
61506           return;
61507         }
61508         var shown = !container.selectAll(".combobox").empty();
61509         if (!shown)
61510           return;
61511         var combo = container.selectAll(".combobox");
61512         var options2 = combo.selectAll(".combobox-option").data(_suggestions, function(d2) {
61513           return d2.value;
61514         });
61515         options2.exit().remove();
61516         options2.enter().append("a").attr("class", function(d2) {
61517           return "combobox-option " + (d2.klass || "");
61518         }).attr("title", function(d2) {
61519           return d2.title;
61520         }).each(function(d2) {
61521           if (d2.display) {
61522             d2.display(select_default2(this));
61523           } else {
61524             select_default2(this).text(d2.value);
61525           }
61526         }).on("mouseenter", _mouseEnterHandler).on("mouseleave", _mouseLeaveHandler).merge(options2).classed("selected", function(d2) {
61527           return d2.value === _selected || d2.key === _selected;
61528         }).on("click.combo-option", accept).order();
61529         var node = attachTo ? attachTo.node() : input.node();
61530         var containerRect = container.node().getBoundingClientRect();
61531         var rect = node.getBoundingClientRect();
61532         combo.style("left", rect.left + 5 - containerRect.left + "px").style("width", rect.width - 10 + "px").style("top", rect.height + rect.top - containerRect.top + "px");
61533       }
61534       function accept(d3_event, d2) {
61535         _cancelFetch = true;
61536         var thiz = input.node();
61537         if (d2) {
61538           utilGetSetValue(input, d2.value);
61539           utilTriggerEvent(input, "change");
61540         }
61541         var val = utilGetSetValue(input);
61542         thiz.setSelectionRange(val.length, val.length);
61543         d2 = _fetched[val];
61544         dispatch14.call("accept", thiz, d2, val);
61545         hide();
61546       }
61547       function cancel() {
61548         _cancelFetch = true;
61549         var thiz = input.node();
61550         var val = utilGetSetValue(input);
61551         var start2 = input.property("selectionStart");
61552         var end = input.property("selectionEnd");
61553         val = val.slice(0, start2) + val.slice(end);
61554         utilGetSetValue(input, val);
61555         thiz.setSelectionRange(val.length, val.length);
61556         dispatch14.call("cancel", thiz);
61557         hide();
61558       }
61559     };
61560     combobox.canAutocomplete = function(val) {
61561       if (!arguments.length)
61562         return _canAutocomplete;
61563       _canAutocomplete = val;
61564       return combobox;
61565     };
61566     combobox.caseSensitive = function(val) {
61567       if (!arguments.length)
61568         return _caseSensitive;
61569       _caseSensitive = val;
61570       return combobox;
61571     };
61572     combobox.data = function(val) {
61573       if (!arguments.length)
61574         return _data;
61575       _data = val;
61576       return combobox;
61577     };
61578     combobox.fetcher = function(val) {
61579       if (!arguments.length)
61580         return _fetcher;
61581       _fetcher = val;
61582       return combobox;
61583     };
61584     combobox.minItems = function(val) {
61585       if (!arguments.length)
61586         return _minItems;
61587       _minItems = val;
61588       return combobox;
61589     };
61590     combobox.itemsMouseEnter = function(val) {
61591       if (!arguments.length)
61592         return _mouseEnterHandler;
61593       _mouseEnterHandler = val;
61594       return combobox;
61595     };
61596     combobox.itemsMouseLeave = function(val) {
61597       if (!arguments.length)
61598         return _mouseLeaveHandler;
61599       _mouseLeaveHandler = val;
61600       return combobox;
61601     };
61602     return utilRebind(combobox, dispatch14, "on");
61603   }
61604   uiCombobox.off = function(input, context) {
61605     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);
61606     context.container().on("scroll.combo-scroll", null);
61607   };
61608
61609   // modules/ui/disclosure.js
61610   function uiDisclosure(context, key, expandedDefault) {
61611     var dispatch14 = dispatch_default("toggled");
61612     var _expanded;
61613     var _label = utilFunctor("");
61614     var _updatePreference = true;
61615     var _content = function() {
61616     };
61617     var disclosure = function(selection2) {
61618       if (_expanded === void 0 || _expanded === null) {
61619         var preference = corePreferences("disclosure." + key + ".expanded");
61620         _expanded = preference === null ? !!expandedDefault : preference === "true";
61621       }
61622       var hideToggle = selection2.selectAll(".hide-toggle-" + key).data([0]);
61623       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"));
61624       hideToggleEnter.append("span").attr("class", "hide-toggle-text");
61625       hideToggle = hideToggleEnter.merge(hideToggle);
61626       hideToggle.on("click", toggle).attr("title", _t("icons.".concat(_expanded ? "collapse" : "expand"))).attr("aria-expanded", _expanded).classed("expanded", _expanded);
61627       const label = _label();
61628       const labelSelection = hideToggle.selectAll(".hide-toggle-text");
61629       if (typeof label !== "function") {
61630         labelSelection.text(_label());
61631       } else {
61632         labelSelection.text("").call(label);
61633       }
61634       hideToggle.selectAll(".hide-toggle-icon").attr(
61635         "xlink:href",
61636         _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
61637       );
61638       var wrap2 = selection2.selectAll(".disclosure-wrap").data([0]);
61639       wrap2 = wrap2.enter().append("div").attr("class", "disclosure-wrap disclosure-wrap-" + key).merge(wrap2).classed("hide", !_expanded);
61640       if (_expanded) {
61641         wrap2.call(_content);
61642       }
61643       function toggle(d3_event) {
61644         d3_event.preventDefault();
61645         _expanded = !_expanded;
61646         if (_updatePreference) {
61647           corePreferences("disclosure." + key + ".expanded", _expanded);
61648         }
61649         hideToggle.classed("expanded", _expanded).attr("aria-expanded", _expanded).attr("title", _t("icons.".concat(_expanded ? "collapse" : "expand")));
61650         hideToggle.selectAll(".hide-toggle-icon").attr(
61651           "xlink:href",
61652           _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
61653         );
61654         wrap2.call(uiToggle(_expanded));
61655         if (_expanded) {
61656           wrap2.call(_content);
61657         }
61658         dispatch14.call("toggled", this, _expanded);
61659       }
61660     };
61661     disclosure.label = function(val) {
61662       if (!arguments.length)
61663         return _label;
61664       _label = utilFunctor(val);
61665       return disclosure;
61666     };
61667     disclosure.expanded = function(val) {
61668       if (!arguments.length)
61669         return _expanded;
61670       _expanded = val;
61671       return disclosure;
61672     };
61673     disclosure.updatePreference = function(val) {
61674       if (!arguments.length)
61675         return _updatePreference;
61676       _updatePreference = val;
61677       return disclosure;
61678     };
61679     disclosure.content = function(val) {
61680       if (!arguments.length)
61681         return _content;
61682       _content = val;
61683       return disclosure;
61684     };
61685     return utilRebind(disclosure, dispatch14, "on");
61686   }
61687
61688   // modules/ui/section.js
61689   function uiSection(id2, context) {
61690     var _classes = utilFunctor("");
61691     var _shouldDisplay;
61692     var _content;
61693     var _disclosure;
61694     var _label;
61695     var _expandedByDefault = utilFunctor(true);
61696     var _disclosureContent;
61697     var _disclosureExpanded;
61698     var _containerSelection = select_default2(null);
61699     var section = {
61700       id: id2
61701     };
61702     section.classes = function(val) {
61703       if (!arguments.length)
61704         return _classes;
61705       _classes = utilFunctor(val);
61706       return section;
61707     };
61708     section.label = function(val) {
61709       if (!arguments.length)
61710         return _label;
61711       _label = utilFunctor(val);
61712       return section;
61713     };
61714     section.expandedByDefault = function(val) {
61715       if (!arguments.length)
61716         return _expandedByDefault;
61717       _expandedByDefault = utilFunctor(val);
61718       return section;
61719     };
61720     section.shouldDisplay = function(val) {
61721       if (!arguments.length)
61722         return _shouldDisplay;
61723       _shouldDisplay = utilFunctor(val);
61724       return section;
61725     };
61726     section.content = function(val) {
61727       if (!arguments.length)
61728         return _content;
61729       _content = val;
61730       return section;
61731     };
61732     section.disclosureContent = function(val) {
61733       if (!arguments.length)
61734         return _disclosureContent;
61735       _disclosureContent = val;
61736       return section;
61737     };
61738     section.disclosureExpanded = function(val) {
61739       if (!arguments.length)
61740         return _disclosureExpanded;
61741       _disclosureExpanded = val;
61742       return section;
61743     };
61744     section.render = function(selection2) {
61745       _containerSelection = selection2.selectAll(".section-" + id2).data([0]);
61746       var sectionEnter = _containerSelection.enter().append("div").attr("class", "section section-" + id2 + " " + (_classes && _classes() || ""));
61747       _containerSelection = sectionEnter.merge(_containerSelection);
61748       _containerSelection.call(renderContent);
61749     };
61750     section.reRender = function() {
61751       _containerSelection.call(renderContent);
61752     };
61753     section.selection = function() {
61754       return _containerSelection;
61755     };
61756     section.disclosure = function() {
61757       return _disclosure;
61758     };
61759     function renderContent(selection2) {
61760       if (_shouldDisplay) {
61761         var shouldDisplay = _shouldDisplay();
61762         selection2.classed("hide", !shouldDisplay);
61763         if (!shouldDisplay) {
61764           selection2.html("");
61765           return;
61766         }
61767       }
61768       if (_disclosureContent) {
61769         if (!_disclosure) {
61770           _disclosure = uiDisclosure(context, id2.replace(/-/g, "_"), _expandedByDefault()).label(_label || "").content(_disclosureContent);
61771         }
61772         if (_disclosureExpanded !== void 0) {
61773           _disclosure.expanded(_disclosureExpanded);
61774           _disclosureExpanded = void 0;
61775         }
61776         selection2.call(_disclosure);
61777         return;
61778       }
61779       if (_content) {
61780         selection2.call(_content);
61781       }
61782     }
61783     return section;
61784   }
61785
61786   // modules/ui/tag_reference.js
61787   function uiTagReference(what) {
61788     var wikibase = what.qid ? services.wikidata : services.osmWikibase;
61789     var tagReference = {};
61790     var _button = select_default2(null);
61791     var _body = select_default2(null);
61792     var _loaded;
61793     var _showing;
61794     function load() {
61795       if (!wikibase)
61796         return;
61797       _button.classed("tag-reference-loading", true);
61798       wikibase.getDocs(what, gotDocs);
61799     }
61800     function gotDocs(err, docs) {
61801       _body.html("");
61802       if (!docs || !docs.title) {
61803         _body.append("p").attr("class", "tag-reference-description").call(_t.append("inspector.no_documentation_key"));
61804         done();
61805         return;
61806       }
61807       if (docs.imageURL) {
61808         _body.append("img").attr("class", "tag-reference-wiki-image").attr("alt", docs.description).attr("src", docs.imageURL).on("load", function() {
61809           done();
61810         }).on("error", function() {
61811           select_default2(this).remove();
61812           done();
61813         });
61814       } else {
61815         done();
61816       }
61817       var tagReferenceDescription = _body.append("p").attr("class", "tag-reference-description").append("span");
61818       if (docs.description) {
61819         tagReferenceDescription = tagReferenceDescription.attr("class", "localized-text").attr("lang", docs.descriptionLocaleCode || "und").text(docs.description);
61820       } else {
61821         tagReferenceDescription = tagReferenceDescription.call(_t.append("inspector.no_documentation_key"));
61822       }
61823       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"));
61824       if (docs.wiki) {
61825         _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));
61826       }
61827       if (what.key === "comment") {
61828         _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"));
61829       }
61830     }
61831     function done() {
61832       _loaded = true;
61833       _button.classed("tag-reference-loading", false);
61834       _body.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1");
61835       _showing = true;
61836       _button.selectAll("svg.icon use").each(function() {
61837         var iconUse = select_default2(this);
61838         if (iconUse.attr("href") === "#iD-icon-info") {
61839           iconUse.attr("href", "#iD-icon-info-filled");
61840         }
61841       });
61842     }
61843     function hide() {
61844       _body.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
61845         _body.classed("expanded", false);
61846       });
61847       _showing = false;
61848       _button.selectAll("svg.icon use").each(function() {
61849         var iconUse = select_default2(this);
61850         if (iconUse.attr("href") === "#iD-icon-info-filled") {
61851           iconUse.attr("href", "#iD-icon-info");
61852         }
61853       });
61854     }
61855     tagReference.button = function(selection2, klass, iconName) {
61856       _button = selection2.selectAll(".tag-reference-button").data([0]);
61857       _button = _button.enter().append("button").attr("class", "tag-reference-button " + (klass || "")).attr("title", _t("icons.information")).call(svgIcon("#iD-icon-" + (iconName || "inspect"))).merge(_button);
61858       _button.on("click", function(d3_event) {
61859         d3_event.stopPropagation();
61860         d3_event.preventDefault();
61861         this.blur();
61862         if (_showing) {
61863           hide();
61864         } else if (_loaded) {
61865           done();
61866         } else {
61867           load();
61868         }
61869       });
61870     };
61871     tagReference.body = function(selection2) {
61872       var itemID = what.qid || what.key + "-" + (what.value || "");
61873       _body = selection2.selectAll(".tag-reference-body").data([itemID], function(d2) {
61874         return d2;
61875       });
61876       _body.exit().remove();
61877       _body = _body.enter().append("div").attr("class", "tag-reference-body").style("max-height", "0").style("opacity", "0").merge(_body);
61878       if (_showing === false) {
61879         hide();
61880       }
61881     };
61882     tagReference.showing = function(val) {
61883       if (!arguments.length)
61884         return _showing;
61885       _showing = val;
61886       return tagReference;
61887     };
61888     return tagReference;
61889   }
61890
61891   // modules/ui/field_help.js
61892   function uiFieldHelp(context, fieldName) {
61893     var fieldHelp = {};
61894     var _inspector = select_default2(null);
61895     var _wrap = select_default2(null);
61896     var _body = select_default2(null);
61897     var fieldHelpKeys = {
61898       restrictions: [
61899         ["about", [
61900           "about",
61901           "from_via_to",
61902           "maxdist",
61903           "maxvia"
61904         ]],
61905         ["inspecting", [
61906           "about",
61907           "from_shadow",
61908           "allow_shadow",
61909           "restrict_shadow",
61910           "only_shadow",
61911           "restricted",
61912           "only"
61913         ]],
61914         ["modifying", [
61915           "about",
61916           "indicators",
61917           "allow_turn",
61918           "restrict_turn",
61919           "only_turn"
61920         ]],
61921         ["tips", [
61922           "simple",
61923           "simple_example",
61924           "indirect",
61925           "indirect_example",
61926           "indirect_noedit"
61927         ]]
61928       ]
61929     };
61930     var fieldHelpHeadings = {};
61931     var replacements = {
61932       distField: { html: _t.html("restriction.controls.distance") },
61933       viaField: { html: _t.html("restriction.controls.via") },
61934       fromShadow: { html: icon("#iD-turn-shadow", "inline shadow from") },
61935       allowShadow: { html: icon("#iD-turn-shadow", "inline shadow allow") },
61936       restrictShadow: { html: icon("#iD-turn-shadow", "inline shadow restrict") },
61937       onlyShadow: { html: icon("#iD-turn-shadow", "inline shadow only") },
61938       allowTurn: { html: icon("#iD-turn-yes", "inline turn") },
61939       restrictTurn: { html: icon("#iD-turn-no", "inline turn") },
61940       onlyTurn: { html: icon("#iD-turn-only", "inline turn") }
61941     };
61942     var docs = fieldHelpKeys[fieldName].map(function(key) {
61943       var helpkey = "help.field." + fieldName + "." + key[0];
61944       var text2 = key[1].reduce(function(all, part) {
61945         var subkey = helpkey + "." + part;
61946         var depth = fieldHelpHeadings[subkey];
61947         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
61948         return all + hhh + _t.html(subkey, replacements) + "\n\n";
61949       }, "");
61950       return {
61951         key: helpkey,
61952         title: _t.html(helpkey + ".title"),
61953         html: marked(text2.trim())
61954       };
61955     });
61956     function show() {
61957       updatePosition();
61958       _body.classed("hide", false).style("opacity", "0").transition().duration(200).style("opacity", "1");
61959     }
61960     function hide() {
61961       _body.classed("hide", true).transition().duration(200).style("opacity", "0").on("end", function() {
61962         _body.classed("hide", true);
61963       });
61964     }
61965     function clickHelp(index) {
61966       var d2 = docs[index];
61967       var tkeys = fieldHelpKeys[fieldName][index][1];
61968       _body.selectAll(".field-help-nav-item").classed("active", function(d4, i3) {
61969         return i3 === index;
61970       });
61971       var content = _body.selectAll(".field-help-content").html(d2.html);
61972       content.selectAll("p").attr("class", function(d4, i3) {
61973         return tkeys[i3];
61974       });
61975       if (d2.key === "help.field.restrictions.inspecting") {
61976         content.insert("img", "p.from_shadow").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_inspect.gif"));
61977       } else if (d2.key === "help.field.restrictions.modifying") {
61978         content.insert("img", "p.allow_turn").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_modify.gif"));
61979       }
61980     }
61981     fieldHelp.button = function(selection2) {
61982       if (_body.empty())
61983         return;
61984       var button = selection2.selectAll(".field-help-button").data([0]);
61985       button.enter().append("button").attr("class", "field-help-button").call(svgIcon("#iD-icon-help")).merge(button).on("click", function(d3_event) {
61986         d3_event.stopPropagation();
61987         d3_event.preventDefault();
61988         if (_body.classed("hide")) {
61989           show();
61990         } else {
61991           hide();
61992         }
61993       });
61994     };
61995     function updatePosition() {
61996       var wrap2 = _wrap.node();
61997       var inspector = _inspector.node();
61998       var wRect = wrap2.getBoundingClientRect();
61999       var iRect = inspector.getBoundingClientRect();
62000       _body.style("top", wRect.top + inspector.scrollTop - iRect.top + "px");
62001     }
62002     fieldHelp.body = function(selection2) {
62003       _wrap = selection2.selectAll(".form-field-input-wrap");
62004       if (_wrap.empty())
62005         return;
62006       _inspector = context.container().select(".sidebar .entity-editor-pane .inspector-body");
62007       if (_inspector.empty())
62008         return;
62009       _body = _inspector.selectAll(".field-help-body").data([0]);
62010       var enter = _body.enter().append("div").attr("class", "field-help-body hide");
62011       var titleEnter = enter.append("div").attr("class", "field-help-title cf");
62012       titleEnter.append("h2").attr("class", _mainLocalizer.textDirection() === "rtl" ? "fr" : "fl").call(_t.append("help.field." + fieldName + ".title"));
62013       titleEnter.append("button").attr("class", "fr close").attr("title", _t("icons.close")).on("click", function(d3_event) {
62014         d3_event.stopPropagation();
62015         d3_event.preventDefault();
62016         hide();
62017       }).call(svgIcon("#iD-icon-close"));
62018       var navEnter = enter.append("div").attr("class", "field-help-nav cf");
62019       var titles = docs.map(function(d2) {
62020         return d2.title;
62021       });
62022       navEnter.selectAll(".field-help-nav-item").data(titles).enter().append("div").attr("class", "field-help-nav-item").html(function(d2) {
62023         return d2;
62024       }).on("click", function(d3_event, d2) {
62025         d3_event.stopPropagation();
62026         d3_event.preventDefault();
62027         clickHelp(titles.indexOf(d2));
62028       });
62029       enter.append("div").attr("class", "field-help-content");
62030       _body = _body.merge(enter);
62031       clickHelp(0);
62032     };
62033     return fieldHelp;
62034   }
62035
62036   // modules/ui/fields/check.js
62037   function uiFieldCheck(field, context) {
62038     var dispatch14 = dispatch_default("change");
62039     var options2 = field.options;
62040     var values = [];
62041     var texts = [];
62042     var _tags;
62043     var input = select_default2(null);
62044     var text2 = select_default2(null);
62045     var label = select_default2(null);
62046     var reverser = select_default2(null);
62047     var _impliedYes;
62048     var _entityIDs = [];
62049     var _value;
62050     var stringsField = field.resolveReference("stringsCrossReference");
62051     if (!options2 && stringsField.options) {
62052       options2 = stringsField.options;
62053     }
62054     if (options2) {
62055       for (var i3 in options2) {
62056         var v2 = options2[i3];
62057         values.push(v2 === "undefined" ? void 0 : v2);
62058         texts.push(stringsField.t.html("options." + v2, { "default": v2 }));
62059       }
62060     } else {
62061       values = [void 0, "yes"];
62062       texts = [_t.html("inspector.unknown"), _t.html("inspector.check.yes")];
62063       if (field.type !== "defaultCheck") {
62064         values.push("no");
62065         texts.push(_t.html("inspector.check.no"));
62066       }
62067     }
62068     function checkImpliedYes() {
62069       _impliedYes = field.id === "oneway_yes";
62070       if (field.id === "oneway") {
62071         var entity = context.entity(_entityIDs[0]);
62072         for (var key in entity.tags) {
62073           if (key in osmOneWayTags && entity.tags[key] in osmOneWayTags[key]) {
62074             _impliedYes = true;
62075             texts[0] = _t.html("_tagging.presets.fields.oneway_yes.options.undefined");
62076             break;
62077           }
62078         }
62079       }
62080     }
62081     function reverserHidden() {
62082       if (!context.container().select("div.inspector-hover").empty())
62083         return true;
62084       return !(_value === "yes" || _impliedYes && !_value);
62085     }
62086     function reverserSetText(selection2) {
62087       var entity = _entityIDs.length && context.hasEntity(_entityIDs[0]);
62088       if (reverserHidden() || !entity)
62089         return selection2;
62090       var first = entity.first();
62091       var last = entity.isClosed() ? entity.nodes[entity.nodes.length - 2] : entity.last();
62092       var pseudoDirection = first < last;
62093       var icon2 = pseudoDirection ? "#iD-icon-forward" : "#iD-icon-backward";
62094       selection2.selectAll(".reverser-span").html("").call(_t.append("inspector.check.reverser")).call(svgIcon(icon2, "inline"));
62095       return selection2;
62096     }
62097     var check = function(selection2) {
62098       checkImpliedYes();
62099       label = selection2.selectAll(".form-field-input-wrap").data([0]);
62100       var enter = label.enter().append("label").attr("class", "form-field-input-wrap form-field-input-check");
62101       enter.append("input").property("indeterminate", field.type !== "defaultCheck").attr("type", "checkbox").attr("id", field.domId);
62102       enter.append("span").html(texts[0]).attr("class", "value");
62103       if (field.type === "onewayCheck") {
62104         enter.append("button").attr("class", "reverser" + (reverserHidden() ? " hide" : "")).append("span").attr("class", "reverser-span");
62105       }
62106       label = label.merge(enter);
62107       input = label.selectAll("input");
62108       text2 = label.selectAll("span.value");
62109       input.on("click", function(d3_event) {
62110         d3_event.stopPropagation();
62111         var t2 = {};
62112         if (Array.isArray(_tags[field.key])) {
62113           if (values.indexOf("yes") !== -1) {
62114             t2[field.key] = "yes";
62115           } else {
62116             t2[field.key] = values[0];
62117           }
62118         } else {
62119           t2[field.key] = values[(values.indexOf(_value) + 1) % values.length];
62120         }
62121         if (t2[field.key] === "reversible" || t2[field.key] === "alternating") {
62122           t2[field.key] = values[0];
62123         }
62124         dispatch14.call("change", this, t2);
62125       });
62126       if (field.type === "onewayCheck") {
62127         reverser = label.selectAll(".reverser");
62128         reverser.call(reverserSetText).on("click", function(d3_event) {
62129           d3_event.preventDefault();
62130           d3_event.stopPropagation();
62131           context.perform(
62132             function(graph) {
62133               for (var i4 in _entityIDs) {
62134                 graph = actionReverse(_entityIDs[i4])(graph);
62135               }
62136               return graph;
62137             },
62138             _t("operations.reverse.annotation.line", { n: 1 })
62139           );
62140           context.validator().validate();
62141           select_default2(this).call(reverserSetText);
62142         });
62143       }
62144     };
62145     check.entityIDs = function(val) {
62146       if (!arguments.length)
62147         return _entityIDs;
62148       _entityIDs = val;
62149       return check;
62150     };
62151     check.tags = function(tags) {
62152       _tags = tags;
62153       function isChecked(val) {
62154         return val !== "no" && val !== "" && val !== void 0 && val !== null;
62155       }
62156       function textFor(val) {
62157         if (val === "")
62158           val = void 0;
62159         var index = values.indexOf(val);
62160         return index !== -1 ? texts[index] : '"' + val + '"';
62161       }
62162       checkImpliedYes();
62163       var isMixed = Array.isArray(tags[field.key]);
62164       _value = !isMixed && tags[field.key] && tags[field.key].toLowerCase();
62165       if (field.type === "onewayCheck" && (_value === "1" || _value === "-1")) {
62166         _value = "yes";
62167       }
62168       input.property("indeterminate", isMixed || field.type !== "defaultCheck" && !_value).property("checked", isChecked(_value));
62169       text2.html(isMixed ? _t.html("inspector.multiple_values") : textFor(_value)).classed("mixed", isMixed);
62170       label.classed("set", !!_value);
62171       if (field.type === "onewayCheck") {
62172         reverser.classed("hide", reverserHidden()).call(reverserSetText);
62173       }
62174     };
62175     check.focus = function() {
62176       input.node().focus();
62177     };
62178     return utilRebind(check, dispatch14, "on");
62179   }
62180
62181   // modules/ui/length_indicator.js
62182   function uiLengthIndicator(maxChars) {
62183     var _wrap = select_default2(null);
62184     var _tooltip = uiPopover("tooltip max-length-warning").placement("bottom").hasArrow(true).content(() => (selection2) => {
62185       selection2.text("");
62186       selection2.call(svgIcon("#iD-icon-alert", "inline"));
62187       selection2.call(_t.append("inspector.max_length_reached", { maxChars }));
62188     });
62189     var _silent = false;
62190     var lengthIndicator = function(selection2) {
62191       _wrap = selection2.selectAll("span.length-indicator-wrap").data([0]);
62192       _wrap = _wrap.enter().append("span").merge(_wrap).classed("length-indicator-wrap", true);
62193       selection2.call(_tooltip);
62194     };
62195     lengthIndicator.update = function(val) {
62196       const strLen = utilUnicodeCharsCount(utilCleanOsmString(val, Number.POSITIVE_INFINITY));
62197       let indicator = _wrap.selectAll("span.length-indicator").data([strLen]);
62198       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");
62199       if (_silent)
62200         return;
62201       if (strLen > maxChars) {
62202         _tooltip.show();
62203       } else {
62204         _tooltip.hide();
62205       }
62206     };
62207     lengthIndicator.silent = function(val) {
62208       if (!arguments.length)
62209         return _silent;
62210       _silent = val;
62211       return lengthIndicator;
62212     };
62213     return lengthIndicator;
62214   }
62215
62216   // modules/ui/fields/combo.js
62217   function uiFieldCombo(field, context) {
62218     var dispatch14 = dispatch_default("change");
62219     var _isMulti = field.type === "multiCombo" || field.type === "manyCombo";
62220     var _isNetwork = field.type === "networkCombo";
62221     var _isSemi = field.type === "semiCombo";
62222     var _showTagInfoSuggestions = field.type !== "manyCombo" && field.autoSuggestions !== false;
62223     var _allowCustomValues = field.type !== "manyCombo" && field.customValues !== false;
62224     var _snake_case = field.snake_case || field.snake_case === void 0;
62225     var _combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(field.caseSensitive).minItems(1);
62226     var _container = select_default2(null);
62227     var _inputWrap = select_default2(null);
62228     var _input = select_default2(null);
62229     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
62230     var _comboData = [];
62231     var _multiData = [];
62232     var _entityIDs = [];
62233     var _tags;
62234     var _countryCode;
62235     var _staticPlaceholder;
62236     var _dataDeprecated = [];
62237     _mainFileFetcher.get("deprecated").then(function(d2) {
62238       _dataDeprecated = d2;
62239     }).catch(function() {
62240     });
62241     if (_isMulti && field.key && /[^:]$/.test(field.key)) {
62242       field.key += ":";
62243     }
62244     function snake(s2) {
62245       return s2.replace(/\s+/g, "_");
62246     }
62247     function clean2(s2) {
62248       return s2.split(";").map(function(s3) {
62249         return s3.trim();
62250       }).join(";");
62251     }
62252     function tagValue(dval) {
62253       dval = clean2(dval || "");
62254       var found = getOptions(true).find(function(o2) {
62255         return o2.key && clean2(o2.value) === dval;
62256       });
62257       if (found)
62258         return found.key;
62259       if (field.type === "typeCombo" && !dval) {
62260         return "yes";
62261       }
62262       return restrictTagValueSpelling(dval) || void 0;
62263     }
62264     function restrictTagValueSpelling(dval) {
62265       if (_snake_case) {
62266         dval = snake(dval);
62267       }
62268       if (!field.caseSensitive) {
62269         dval = dval.toLowerCase();
62270       }
62271       return dval;
62272     }
62273     function getLabelId(field2, v2) {
62274       return field2.hasTextForStringId("options.".concat(v2, ".title")) ? "options.".concat(v2, ".title") : "options.".concat(v2);
62275     }
62276     function displayValue(tval) {
62277       tval = tval || "";
62278       var stringsField = field.resolveReference("stringsCrossReference");
62279       const labelId = getLabelId(stringsField, tval);
62280       if (stringsField.hasTextForStringId(labelId)) {
62281         return stringsField.t(labelId, { default: tval });
62282       }
62283       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
62284         return "";
62285       }
62286       return tval;
62287     }
62288     function renderValue(tval) {
62289       tval = tval || "";
62290       var stringsField = field.resolveReference("stringsCrossReference");
62291       const labelId = getLabelId(stringsField, tval);
62292       if (stringsField.hasTextForStringId(labelId)) {
62293         return stringsField.t.append(labelId, { default: tval });
62294       }
62295       if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
62296         tval = "";
62297       }
62298       return (selection2) => selection2.text(tval);
62299     }
62300     function objectDifference(a2, b2) {
62301       return a2.filter(function(d1) {
62302         return !b2.some(function(d2) {
62303           return d1.value === d2.value;
62304         });
62305       });
62306     }
62307     function initCombo(selection2, attachTo) {
62308       if (!_allowCustomValues) {
62309         selection2.attr("readonly", "readonly");
62310       }
62311       if (_showTagInfoSuggestions && services.taginfo) {
62312         selection2.call(_combobox.fetcher(setTaginfoValues), attachTo);
62313         setTaginfoValues("", setPlaceholder);
62314       } else {
62315         selection2.call(_combobox, attachTo);
62316         setTimeout(() => setStaticValues(setPlaceholder), 0);
62317       }
62318     }
62319     function getOptions(allOptions) {
62320       var stringsField = field.resolveReference("stringsCrossReference");
62321       if (!(field.options || stringsField.options))
62322         return [];
62323       let options2;
62324       if (allOptions !== true) {
62325         options2 = field.options || stringsField.options;
62326       } else {
62327         options2 = [].concat(field.options, stringsField.options).filter(Boolean);
62328       }
62329       return options2.map(function(v2) {
62330         const labelId = getLabelId(stringsField, v2);
62331         return {
62332           key: v2,
62333           value: stringsField.t(labelId, { default: v2 }),
62334           title: stringsField.t("options.".concat(v2, ".description"), { default: v2 }),
62335           display: addComboboxIcons(stringsField.t.append(labelId, { default: v2 }), v2),
62336           klass: stringsField.hasTextForStringId(labelId) ? "" : "raw-option"
62337         };
62338       });
62339     }
62340     function hasStaticValues() {
62341       return getOptions().length > 0;
62342     }
62343     function setStaticValues(callback, filter2) {
62344       _comboData = getOptions();
62345       if (filter2 !== void 0) {
62346         _comboData = _comboData.filter(filter2);
62347       }
62348       _comboData = objectDifference(_comboData, _multiData);
62349       _combobox.data(_comboData);
62350       if (callback)
62351         callback(_comboData);
62352     }
62353     function setTaginfoValues(q2, callback) {
62354       var queryFilter = (d2) => d2.value.toLowerCase().includes(q2.toLowerCase()) || d2.key.toLowerCase().includes(q2.toLowerCase());
62355       if (hasStaticValues()) {
62356         setStaticValues(callback, queryFilter);
62357       }
62358       var stringsField = field.resolveReference("stringsCrossReference");
62359       var fn = _isMulti ? "multikeys" : "values";
62360       var query = (_isMulti ? field.key : "") + q2;
62361       var hasCountryPrefix = _isNetwork && _countryCode && _countryCode.indexOf(q2.toLowerCase()) === 0;
62362       if (hasCountryPrefix) {
62363         query = _countryCode + ":";
62364       }
62365       var params = {
62366         debounce: q2 !== "",
62367         key: field.key,
62368         query
62369       };
62370       if (_entityIDs.length) {
62371         params.geometry = context.graph().geometry(_entityIDs[0]);
62372       }
62373       services.taginfo[fn](params, function(err, data) {
62374         if (err)
62375           return;
62376         data = data.filter((d2) => field.type !== "typeCombo" || d2.value !== "yes");
62377         data = data.filter((d2) => {
62378           var value = d2.value;
62379           if (_isMulti) {
62380             value = value.slice(field.key.length);
62381           }
62382           return value === restrictTagValueSpelling(value);
62383         });
62384         var deprecatedValues = osmEntity.deprecatedTagValuesByKey(_dataDeprecated)[field.key];
62385         if (deprecatedValues) {
62386           data = data.filter((d2) => !deprecatedValues.includes(d2.value));
62387         }
62388         if (hasCountryPrefix) {
62389           data = data.filter((d2) => d2.value.toLowerCase().indexOf(_countryCode + ":") === 0);
62390         }
62391         const additionalOptions = (field.options || stringsField.options || []).filter((v2) => !data.some((dv) => dv.value === (_isMulti ? field.key + v2 : v2))).map((v2) => ({ value: v2 }));
62392         _container.classed("empty-combobox", data.length === 0);
62393         _comboData = data.concat(additionalOptions).map(function(d2) {
62394           var v2 = d2.value;
62395           if (_isMulti)
62396             v2 = v2.replace(field.key, "");
62397           const labelId = getLabelId(stringsField, v2);
62398           var isLocalizable = stringsField.hasTextForStringId(labelId);
62399           var label = stringsField.t(labelId, { default: v2 });
62400           return {
62401             key: v2,
62402             value: label,
62403             title: stringsField.t("options.".concat(v2, ".description"), { default: isLocalizable ? v2 : d2.title !== label ? d2.title : "" }),
62404             display: addComboboxIcons(stringsField.t.append(labelId, { default: v2 }), v2),
62405             klass: isLocalizable ? "" : "raw-option"
62406           };
62407         });
62408         _comboData = _comboData.filter(queryFilter);
62409         _comboData = objectDifference(_comboData, _multiData);
62410         if (callback)
62411           callback(_comboData, hasStaticValues());
62412       });
62413     }
62414     function addComboboxIcons(disp, value) {
62415       const iconsField = field.resolveReference("iconsCrossReference");
62416       if (iconsField.icons) {
62417         return function(selection2) {
62418           var span = selection2.insert("span", ":first-child").attr("class", "tag-value-icon");
62419           if (iconsField.icons[value]) {
62420             span.call(svgIcon("#".concat(iconsField.icons[value])));
62421           }
62422           disp.call(this, selection2);
62423         };
62424       }
62425       return disp;
62426     }
62427     function setPlaceholder(values) {
62428       if (_isMulti || _isSemi) {
62429         _staticPlaceholder = field.placeholder() || _t("inspector.add");
62430       } else {
62431         var vals = values.map(function(d2) {
62432           return d2.value;
62433         }).filter(function(s2) {
62434           return s2.length < 20;
62435         });
62436         var placeholders = vals.length > 1 ? vals : values.map(function(d2) {
62437           return d2.key;
62438         });
62439         _staticPlaceholder = field.placeholder() || placeholders.slice(0, 3).join(", ");
62440       }
62441       if (!/(…|\.\.\.)$/.test(_staticPlaceholder)) {
62442         _staticPlaceholder += "\u2026";
62443       }
62444       var ph;
62445       if (!_isMulti && !_isSemi && _tags && Array.isArray(_tags[field.key])) {
62446         ph = _t("inspector.multiple_values");
62447       } else {
62448         ph = _staticPlaceholder;
62449       }
62450       _container.selectAll("input").attr("placeholder", ph);
62451       var hideAdd = !_allowCustomValues && !values.length;
62452       _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
62453     }
62454     function change() {
62455       var t2 = {};
62456       var val;
62457       if (_isMulti || _isSemi) {
62458         var vals;
62459         if (_isMulti) {
62460           vals = [tagValue(utilGetSetValue(_input))];
62461         } else if (_isSemi) {
62462           val = tagValue(utilGetSetValue(_input)) || "";
62463           val = val.replace(/,/g, ";");
62464           vals = val.split(";");
62465         }
62466         vals = vals.filter(Boolean);
62467         if (!vals.length)
62468           return;
62469         _container.classed("active", false);
62470         utilGetSetValue(_input, "");
62471         if (_isMulti) {
62472           utilArrayUniq(vals).forEach(function(v2) {
62473             var key = (field.key || "") + v2;
62474             if (_tags) {
62475               var old = _tags[key];
62476               if (typeof old === "string" && old.toLowerCase() !== "no")
62477                 return;
62478             }
62479             key = context.cleanTagKey(key);
62480             field.keys.push(key);
62481             t2[key] = "yes";
62482           });
62483         } else if (_isSemi) {
62484           var arr = _multiData.map(function(d2) {
62485             return d2.key;
62486           });
62487           arr = arr.concat(vals);
62488           t2[field.key] = context.cleanTagValue(utilArrayUniq(arr).filter(Boolean).join(";"));
62489         }
62490         window.setTimeout(function() {
62491           _input.node().focus();
62492         }, 10);
62493       } else {
62494         var rawValue = utilGetSetValue(_input);
62495         if (!rawValue && Array.isArray(_tags[field.key]))
62496           return;
62497         val = context.cleanTagValue(tagValue(rawValue));
62498         t2[field.key] = val || void 0;
62499       }
62500       dispatch14.call("change", this, t2);
62501     }
62502     function removeMultikey(d3_event, d2) {
62503       d3_event.preventDefault();
62504       d3_event.stopPropagation();
62505       var t2 = {};
62506       if (_isMulti) {
62507         t2[d2.key] = void 0;
62508       } else if (_isSemi) {
62509         var arr = _multiData.map(function(md) {
62510           return md.key === d2.key ? null : md.key;
62511         }).filter(Boolean);
62512         arr = utilArrayUniq(arr);
62513         t2[field.key] = arr.length ? arr.join(";") : void 0;
62514         _lengthIndicator.update(t2[field.key]);
62515       }
62516       dispatch14.call("change", this, t2);
62517     }
62518     function invertMultikey(d3_event, d2) {
62519       d3_event.preventDefault();
62520       d3_event.stopPropagation();
62521       var t2 = {};
62522       if (_isMulti) {
62523         t2[d2.key] = _tags[d2.key] === "yes" ? "no" : "yes";
62524       }
62525       dispatch14.call("change", this, t2);
62526     }
62527     function combo(selection2) {
62528       _container = selection2.selectAll(".form-field-input-wrap").data([0]);
62529       var type2 = _isMulti || _isSemi ? "multicombo" : "combo";
62530       _container = _container.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + type2).merge(_container);
62531       if (_isMulti || _isSemi) {
62532         _container = _container.selectAll(".chiplist").data([0]);
62533         var listClass = "chiplist";
62534         if (field.key === "destination" || field.key === "via") {
62535           listClass += " full-line-chips";
62536         }
62537         _container = _container.enter().append("ul").attr("class", listClass).on("click", function() {
62538           window.setTimeout(function() {
62539             _input.node().focus();
62540           }, 10);
62541         }).merge(_container);
62542         _inputWrap = _container.selectAll(".input-wrap").data([0]);
62543         _inputWrap = _inputWrap.enter().append("li").attr("class", "input-wrap").merge(_inputWrap);
62544         var hideAdd = !_allowCustomValues && !_comboData.length;
62545         _inputWrap.style("display", hideAdd ? "none" : null);
62546         _input = _inputWrap.selectAll("input").data([0]);
62547       } else {
62548         _input = _container.selectAll("input").data([0]);
62549       }
62550       _input = _input.enter().append("input").attr("type", "text").attr("id", field.domId).call(utilNoAuto).call(initCombo, _container).merge(_input);
62551       if (_isSemi) {
62552         _inputWrap.call(_lengthIndicator);
62553       } else if (!_isMulti) {
62554         _container.call(_lengthIndicator);
62555       }
62556       if (_isNetwork) {
62557         var extent = combinedEntityExtent();
62558         var countryCode = extent && iso1A2Code(extent.center());
62559         _countryCode = countryCode && countryCode.toLowerCase();
62560       }
62561       _input.on("change", change).on("blur", change).on("input", function() {
62562         let val = utilGetSetValue(_input);
62563         updateIcon(val);
62564         if (_isSemi && _tags[field.key]) {
62565           val += ";" + _tags[field.key];
62566         }
62567         _lengthIndicator.update(val);
62568       });
62569       _input.on("keydown.field", function(d3_event) {
62570         switch (d3_event.keyCode) {
62571           case 13:
62572             _input.node().blur();
62573             d3_event.stopPropagation();
62574             break;
62575         }
62576       });
62577       if (_isMulti || _isSemi) {
62578         _combobox.on("accept", function() {
62579           _input.node().blur();
62580           _input.node().focus();
62581         });
62582         _input.on("focus", function() {
62583           _container.classed("active", true);
62584         });
62585       }
62586       _combobox.on("cancel", function() {
62587         _input.node().blur();
62588       }).on("update", function() {
62589         updateIcon(utilGetSetValue(_input));
62590       });
62591     }
62592     function updateIcon(value) {
62593       value = tagValue(value);
62594       let container = _container;
62595       if (field.type === "multiCombo" || field.type === "semiCombo") {
62596         container = _container.select(".input-wrap");
62597       }
62598       const iconsField = field.resolveReference("iconsCrossReference");
62599       if (iconsField.icons) {
62600         container.selectAll(".tag-value-icon").remove();
62601         if (iconsField.icons[value]) {
62602           container.selectAll(".tag-value-icon").data([value]).enter().insert("div", "input").attr("class", "tag-value-icon").call(svgIcon("#".concat(iconsField.icons[value])));
62603         }
62604       }
62605     }
62606     combo.tags = function(tags) {
62607       _tags = tags;
62608       var stringsField = field.resolveReference("stringsCrossReference");
62609       var isMixed = Array.isArray(tags[field.key]);
62610       var showsValue = (value) => !isMixed && value && !(field.type === "typeCombo" && value === "yes");
62611       var isRawValue = (value) => showsValue(value) && !stringsField.hasTextForStringId("options.".concat(value)) && !stringsField.hasTextForStringId("options.".concat(value, ".title"));
62612       var isKnownValue = (value) => showsValue(value) && !isRawValue(value);
62613       var isReadOnly = !_allowCustomValues;
62614       if (_isMulti || _isSemi) {
62615         _multiData = [];
62616         var maxLength;
62617         if (_isMulti) {
62618           for (var k2 in tags) {
62619             if (field.key && k2.indexOf(field.key) !== 0)
62620               continue;
62621             if (!field.key && field.keys.indexOf(k2) === -1)
62622               continue;
62623             var v2 = tags[k2];
62624             var suffix = field.key ? k2.slice(field.key.length) : k2;
62625             _multiData.push({
62626               key: k2,
62627               value: displayValue(suffix),
62628               display: addComboboxIcons(renderValue(suffix), suffix),
62629               state: typeof v2 === "string" ? v2.toLowerCase() : "",
62630               isMixed: Array.isArray(v2)
62631             });
62632           }
62633           if (field.key) {
62634             field.keys = _multiData.map(function(d2) {
62635               return d2.key;
62636             });
62637             maxLength = context.maxCharsForTagKey() - utilUnicodeCharsCount(field.key);
62638           } else {
62639             maxLength = context.maxCharsForTagKey();
62640           }
62641         } else if (_isSemi) {
62642           var allValues = [];
62643           var commonValues;
62644           if (Array.isArray(tags[field.key])) {
62645             tags[field.key].forEach(function(tagVal) {
62646               var thisVals = utilArrayUniq((tagVal || "").split(";")).filter(Boolean);
62647               allValues = allValues.concat(thisVals);
62648               if (!commonValues) {
62649                 commonValues = thisVals;
62650               } else {
62651                 commonValues = commonValues.filter((value) => thisVals.includes(value));
62652               }
62653             });
62654             allValues = utilArrayUniq(allValues).filter(Boolean);
62655           } else {
62656             allValues = utilArrayUniq((tags[field.key] || "").split(";")).filter(Boolean);
62657             commonValues = allValues;
62658           }
62659           _multiData = allValues.map(function(v3) {
62660             return {
62661               key: v3,
62662               value: displayValue(v3),
62663               display: addComboboxIcons(renderValue(v3), v3),
62664               isMixed: !commonValues.includes(v3)
62665             };
62666           });
62667           var currLength = utilUnicodeCharsCount(commonValues.join(";"));
62668           maxLength = context.maxCharsForTagValue() - currLength;
62669           if (currLength > 0) {
62670             maxLength -= 1;
62671           }
62672         }
62673         maxLength = Math.max(0, maxLength);
62674         var hideAdd = maxLength <= 0 || !_allowCustomValues && !_comboData.length;
62675         _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
62676         var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]);
62677         var chips = _container.selectAll(".chip").data(_multiData);
62678         chips.exit().remove();
62679         var enter = chips.enter().insert("li", ".input-wrap").attr("class", "chip");
62680         enter.append("span");
62681         enter.append("a");
62682         chips = chips.merge(enter).order().classed("raw-value", function(d2) {
62683           var k3 = d2.key;
62684           if (_isMulti)
62685             k3 = k3.replace(field.key, "");
62686           return !stringsField.hasTextForStringId("options." + k3);
62687         }).classed("draggable", allowDragAndDrop).classed("mixed", function(d2) {
62688           return d2.isMixed;
62689         }).attr("title", function(d2) {
62690           if (d2.isMixed) {
62691             return _t("inspector.unshared_value_tooltip");
62692           }
62693           if (!["yes", "no"].includes(d2.state)) {
62694             return d2.state;
62695           }
62696           return null;
62697         }).classed("negated", (d2) => d2.state === "no");
62698         if (!_isSemi) {
62699           chips.selectAll("input[type=checkbox]").remove();
62700           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);
62701         }
62702         if (allowDragAndDrop) {
62703           registerDragAndDrop(chips);
62704         }
62705         chips.select("span").each(function(d2) {
62706           const selection2 = select_default2(this);
62707           if (d2.display) {
62708             selection2.text("");
62709             d2.display(selection2);
62710           } else {
62711             selection2.text(d2.value);
62712           }
62713         });
62714         chips.select("a").attr("href", "#").on("click", removeMultikey).attr("class", "remove").text("\xD7");
62715         updateIcon("");
62716       } else {
62717         var mixedValues = isMixed && tags[field.key].map(function(val) {
62718           return displayValue(val);
62719         }).filter(Boolean);
62720         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) {
62721           if (isReadOnly && isKnownValue(tags[field.key]) && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
62722             d3_event.preventDefault();
62723             d3_event.stopPropagation();
62724             var t2 = {};
62725             t2[field.key] = void 0;
62726             dispatch14.call("change", this, t2);
62727           }
62728         });
62729         if (!Array.isArray(tags[field.key])) {
62730           updateIcon(tags[field.key]);
62731         }
62732         if (!isMixed) {
62733           _lengthIndicator.update(tags[field.key]);
62734         }
62735       }
62736       const refreshStyles = () => {
62737         _input.data([tagValue(utilGetSetValue(_input))]).classed("raw-value", isRawValue).classed("known-value", isKnownValue);
62738       };
62739       _input.on("input.refreshStyles", refreshStyles);
62740       _combobox.on("update.refreshStyles", refreshStyles);
62741       refreshStyles();
62742     };
62743     function registerDragAndDrop(selection2) {
62744       var dragOrigin, targetIndex;
62745       selection2.call(
62746         drag_default().on("start", function(d3_event) {
62747           dragOrigin = {
62748             x: d3_event.x,
62749             y: d3_event.y
62750           };
62751           targetIndex = null;
62752         }).on("drag", function(d3_event) {
62753           var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
62754           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
62755           Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5)
62756             return;
62757           var index = selection2.nodes().indexOf(this);
62758           select_default2(this).classed("dragging", true);
62759           targetIndex = null;
62760           var targetIndexOffsetTop = null;
62761           var draggedTagWidth = select_default2(this).node().offsetWidth;
62762           if (field.key === "destination" || field.key === "via") {
62763             _container.selectAll(".chip").style("transform", function(d2, index2) {
62764               var node = select_default2(this).node();
62765               if (index === index2) {
62766                 return "translate(" + x2 + "px, " + y2 + "px)";
62767               } else if (index2 > index && d3_event.y > node.offsetTop) {
62768                 if (targetIndex === null || index2 > targetIndex) {
62769                   targetIndex = index2;
62770                 }
62771                 return "translateY(-100%)";
62772               } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
62773                 if (targetIndex === null || index2 < targetIndex) {
62774                   targetIndex = index2;
62775                 }
62776                 return "translateY(100%)";
62777               }
62778               return null;
62779             });
62780           } else {
62781             _container.selectAll(".chip").each(function(d2, index2) {
62782               var node = select_default2(this).node();
62783               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) {
62784                 targetIndex = index2;
62785                 targetIndexOffsetTop = node.offsetTop;
62786               }
62787             }).style("transform", function(d2, index2) {
62788               var node = select_default2(this).node();
62789               if (index === index2) {
62790                 return "translate(" + x2 + "px, " + y2 + "px)";
62791               }
62792               if (node.offsetTop === targetIndexOffsetTop) {
62793                 if (index2 < index && index2 >= targetIndex) {
62794                   return "translateX(" + draggedTagWidth + "px)";
62795                 } else if (index2 > index && index2 <= targetIndex) {
62796                   return "translateX(-" + draggedTagWidth + "px)";
62797                 }
62798               }
62799               return null;
62800             });
62801           }
62802         }).on("end", function() {
62803           if (!select_default2(this).classed("dragging")) {
62804             return;
62805           }
62806           var index = selection2.nodes().indexOf(this);
62807           select_default2(this).classed("dragging", false);
62808           _container.selectAll(".chip").style("transform", null);
62809           if (typeof targetIndex === "number") {
62810             var element = _multiData[index];
62811             _multiData.splice(index, 1);
62812             _multiData.splice(targetIndex, 0, element);
62813             var t2 = {};
62814             if (_multiData.length) {
62815               t2[field.key] = _multiData.map(function(element2) {
62816                 return element2.key;
62817               }).join(";");
62818             } else {
62819               t2[field.key] = void 0;
62820             }
62821             dispatch14.call("change", this, t2);
62822           }
62823           dragOrigin = void 0;
62824           targetIndex = void 0;
62825         })
62826       );
62827     }
62828     combo.focus = function() {
62829       _input.node().focus();
62830     };
62831     combo.entityIDs = function(val) {
62832       if (!arguments.length)
62833         return _entityIDs;
62834       _entityIDs = val;
62835       return combo;
62836     };
62837     function combinedEntityExtent() {
62838       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
62839     }
62840     return utilRebind(combo, dispatch14, "on");
62841   }
62842
62843   // modules/ui/fields/input.js
62844   var likelyRawNumberFormat = /^-?(0\.\d*|\d*\.\d{0,2}(\d{4,})?|\d{4,}\.\d{3})$/;
62845   function uiFieldText(field, context) {
62846     var dispatch14 = dispatch_default("change");
62847     var input = select_default2(null);
62848     var outlinkButton = select_default2(null);
62849     var wrap2 = select_default2(null);
62850     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
62851     var _entityIDs = [];
62852     var _tags;
62853     var _phoneFormats = {};
62854     const isDirectionField = field.key.split(":").some((keyPart) => keyPart === "direction");
62855     const formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
62856     const parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
62857     const countDecimalPlaces = _mainLocalizer.decimalPlaceCounter(_mainLocalizer.languageCode());
62858     if (field.type === "tel") {
62859       _mainFileFetcher.get("phone_formats").then(function(d2) {
62860         _phoneFormats = d2;
62861         updatePhonePlaceholder();
62862       }).catch(function() {
62863       });
62864     }
62865     function calcLocked() {
62866       var isLocked = (field.id === "brand" || field.id === "network" || field.id === "operator" || field.id === "flag") && _entityIDs.length && _entityIDs.some(function(entityID) {
62867         var entity = context.graph().hasEntity(entityID);
62868         if (!entity)
62869           return false;
62870         if (entity.tags.wikidata)
62871           return true;
62872         var preset = _mainPresetIndex.match(entity, context.graph());
62873         var isSuggestion = preset && preset.suggestion;
62874         var which = field.id;
62875         return isSuggestion && !!entity.tags[which] && !!entity.tags[which + ":wikidata"];
62876       });
62877       field.locked(isLocked);
62878     }
62879     function i3(selection2) {
62880       calcLocked();
62881       var isLocked = field.locked();
62882       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
62883       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
62884       input = wrap2.selectAll("input").data([0]);
62885       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);
62886       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
62887       wrap2.call(_lengthIndicator);
62888       if (field.type === "tel") {
62889         updatePhonePlaceholder();
62890       } else if (field.type === "number") {
62891         var rtl = _mainLocalizer.textDirection() === "rtl";
62892         input.attr("type", "text");
62893         var inc = field.increment;
62894         var buttons = wrap2.selectAll(".increment, .decrement").data(rtl ? [inc, -inc] : [-inc, inc]);
62895         buttons.enter().append("button").attr("class", function(d2) {
62896           var which = d2 > 0 ? "increment" : "decrement";
62897           return "form-field-button " + which;
62898         }).attr("title", function(d2) {
62899           var which = d2 > 0 ? "increment" : "decrement";
62900           return _t("inspector.".concat(which));
62901         }).merge(buttons).on("click", function(d3_event, d2) {
62902           d3_event.preventDefault();
62903           var isMixed = Array.isArray(_tags[field.key]);
62904           if (isMixed)
62905             return;
62906           var raw_vals = input.node().value || "0";
62907           var vals = raw_vals.split(";");
62908           vals = vals.map(function(v2) {
62909             v2 = v2.trim();
62910             const isRawNumber = likelyRawNumberFormat.test(v2);
62911             var num = isRawNumber ? parseFloat(v2) : parseLocaleFloat(v2);
62912             if (isDirectionField) {
62913               const compassDir = cardinal[v2.toLowerCase()];
62914               if (compassDir !== void 0) {
62915                 num = compassDir;
62916               }
62917             }
62918             if (!isFinite(num))
62919               return v2;
62920             num = parseFloat(num);
62921             if (!isFinite(num))
62922               return v2;
62923             num += d2;
62924             if (isDirectionField) {
62925               num = (num % 360 + 360) % 360;
62926             }
62927             return formatFloat(clamped(num), isRawNumber ? v2.includes(".") ? v2.split(".")[1].length : 0 : countDecimalPlaces(v2));
62928           });
62929           input.node().value = vals.join(";");
62930           change()();
62931         });
62932       } else if (field.type === "identifier" && field.urlFormat && field.pattern) {
62933         input.attr("type", "text");
62934         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
62935         outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", function() {
62936           var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
62937           if (domainResults.length >= 2 && domainResults[1]) {
62938             var domain2 = domainResults[1];
62939             return _t("icons.view_on", { domain: domain2 });
62940           }
62941           return "";
62942         }).on("click", function(d3_event) {
62943           d3_event.preventDefault();
62944           var value = validIdentifierValueForLink();
62945           if (value) {
62946             var url = field.urlFormat.replace(/{value}/, encodeURIComponent(value));
62947             window.open(url, "_blank");
62948           }
62949         }).classed("disabled", () => !validIdentifierValueForLink()).merge(outlinkButton);
62950       } else if (field.type === "url") {
62951         input.attr("type", "text");
62952         outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
62953         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) {
62954           d3_event.preventDefault();
62955           const value = validIdentifierValueForLink();
62956           if (value)
62957             window.open(value, "_blank");
62958         }).merge(outlinkButton);
62959       } else if (field.type === "colour") {
62960         input.attr("type", "text");
62961         updateColourPreview();
62962       } else if (field.type === "date") {
62963         input.attr("type", "text");
62964         updateDateField();
62965       }
62966     }
62967     function updateColourPreview() {
62968       function isColourValid(colour2) {
62969         if (!colour2.match(/^(#([0-9a-fA-F]{3}){1,2}|\w+)$/)) {
62970           return false;
62971         } else if (!CSS.supports("color", colour2) || ["unset", "inherit", "initial", "revert"].includes(colour2)) {
62972           return false;
62973         }
62974         return true;
62975       }
62976       wrap2.selectAll(".colour-preview").remove();
62977       const colour = utilGetSetValue(input);
62978       if (!isColourValid(colour) && colour !== "") {
62979         wrap2.selectAll("input.colour-selector").remove();
62980         wrap2.selectAll(".form-field-button").remove();
62981         return;
62982       }
62983       var colourSelector = wrap2.selectAll(".colour-selector").data([0]);
62984       colourSelector.enter().append("input").attr("type", "color").attr("class", "colour-selector").on("input", debounce_default(function(d3_event) {
62985         d3_event.preventDefault();
62986         var colour2 = this.value;
62987         if (!isColourValid(colour2))
62988           return;
62989         utilGetSetValue(input, this.value);
62990         change()();
62991         updateColourPreview();
62992       }, 100));
62993       wrap2.selectAll("input.colour-selector").attr("value", colour);
62994       var chooserButton = wrap2.selectAll(".colour-preview").data([colour]);
62995       chooserButton = chooserButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d2) => d2).attr("class", "colour-box");
62996       if (colour === "") {
62997         chooserButton = chooserButton.call(svgIcon("#iD-icon-edit"));
62998       }
62999       chooserButton.on("click", () => wrap2.select(".colour-selector").node().showPicker());
63000     }
63001     function updateDateField() {
63002       function isDateValid(date2) {
63003         return date2.match(/^[0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?$/);
63004       }
63005       const date = utilGetSetValue(input);
63006       const now3 = /* @__PURE__ */ new Date();
63007       const today = new Date(now3.getTime() - now3.getTimezoneOffset() * 6e4).toISOString().split("T")[0];
63008       if ((field.key === "check_date" || field.key === "survey:date") && date !== today) {
63009         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", () => {
63010           utilGetSetValue(input, today);
63011           change()();
63012           updateDateField();
63013         });
63014       } else {
63015         wrap2.selectAll(".date-set-today").remove();
63016       }
63017       if (!isDateValid(date) && date !== "") {
63018         wrap2.selectAll("input.date-selector").remove();
63019         wrap2.selectAll(".date-calendar").remove();
63020         return;
63021       }
63022       if (utilDetect().browser !== "Safari") {
63023         var dateSelector = wrap2.selectAll(".date-selector").data([0]);
63024         dateSelector.enter().append("input").attr("type", "date").attr("class", "date-selector").on("input", debounce_default(function(d3_event) {
63025           d3_event.preventDefault();
63026           var date2 = this.value;
63027           if (!isDateValid(date2))
63028             return;
63029           utilGetSetValue(input, this.value);
63030           change()();
63031           updateDateField();
63032         }, 100));
63033         wrap2.selectAll("input.date-selector").attr("value", date);
63034         var calendarButton = wrap2.selectAll(".date-calendar").data([date]);
63035         calendarButton = calendarButton.enter().append("button").attr("class", "form-field-button date-calendar").call(svgIcon("#fas-calendar-days"));
63036         calendarButton.on("click", () => wrap2.select(".date-selector").node().showPicker());
63037       }
63038     }
63039     function updatePhonePlaceholder() {
63040       if (input.empty() || !Object.keys(_phoneFormats).length)
63041         return;
63042       var extent = combinedEntityExtent();
63043       var countryCode = extent && iso1A2Code(extent.center());
63044       var format2 = countryCode && _phoneFormats[countryCode.toLowerCase()];
63045       if (format2)
63046         input.attr("placeholder", format2);
63047     }
63048     function validIdentifierValueForLink() {
63049       var _a;
63050       const value = utilGetSetValue(input).trim();
63051       if (field.type === "url" && value) {
63052         try {
63053           return new URL(value).href;
63054         } catch (e3) {
63055           return null;
63056         }
63057       }
63058       if (field.type === "identifier" && field.pattern) {
63059         return value && ((_a = value.match(new RegExp(field.pattern))) == null ? void 0 : _a[0]);
63060       }
63061       return null;
63062     }
63063     function clamped(num) {
63064       if (field.minValue !== void 0) {
63065         num = Math.max(num, field.minValue);
63066       }
63067       if (field.maxValue !== void 0) {
63068         num = Math.min(num, field.maxValue);
63069       }
63070       return num;
63071     }
63072     function getVals(tags) {
63073       if (field.keys) {
63074         const multiSelection = context.selectedIDs();
63075         tags = multiSelection.length > 1 ? context.selectedIDs().map((id2) => context.graph().entity(id2)).map((entity) => entity.tags) : [tags];
63076         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]));
63077       } else {
63078         return new Set([].concat(tags[field.key]));
63079       }
63080     }
63081     function change(onInput) {
63082       return function() {
63083         var t2 = {};
63084         var val = utilGetSetValue(input);
63085         if (!onInput)
63086           val = context.cleanTagValue(val);
63087         if (!val && getVals(_tags).size > 1)
63088           return;
63089         var displayVal = val;
63090         if (field.type === "number" && val) {
63091           var numbers2 = val.split(";");
63092           numbers2 = numbers2.map(function(v2) {
63093             if (likelyRawNumberFormat.test(v2)) {
63094               return v2;
63095             }
63096             var num = parseLocaleFloat(v2);
63097             const fractionDigits = countDecimalPlaces(v2);
63098             return isFinite(num) ? clamped(num).toFixed(fractionDigits) : v2;
63099           });
63100           val = numbers2.join(";");
63101         }
63102         if (!onInput)
63103           utilGetSetValue(input, displayVal);
63104         t2[field.key] = val || void 0;
63105         if (field.keys) {
63106           dispatch14.call("change", this, (tags) => {
63107             if (field.keys.some((key) => tags[key])) {
63108               field.keys.filter((key) => tags[key]).forEach((key) => {
63109                 tags[key] = val || void 0;
63110               });
63111             } else {
63112               tags[field.key] = val || void 0;
63113             }
63114             return tags;
63115           }, onInput);
63116         } else {
63117           dispatch14.call("change", this, t2, onInput);
63118         }
63119       };
63120     }
63121     i3.entityIDs = function(val) {
63122       if (!arguments.length)
63123         return _entityIDs;
63124       _entityIDs = val;
63125       return i3;
63126     };
63127     i3.tags = function(tags) {
63128       var _a;
63129       _tags = tags;
63130       const vals = getVals(tags);
63131       const isMixed = vals.size > 1;
63132       var val = vals.size === 1 ? (_a = [...vals][0]) != null ? _a : "" : "";
63133       var shouldUpdate;
63134       if (field.type === "number" && val) {
63135         var numbers2 = val.split(";");
63136         var oriNumbers = utilGetSetValue(input).split(";");
63137         if (numbers2.length !== oriNumbers.length)
63138           shouldUpdate = true;
63139         numbers2 = numbers2.map(function(v2) {
63140           v2 = v2.trim();
63141           var num = Number(v2);
63142           if (!isFinite(num) || v2 === "")
63143             return v2;
63144           const fractionDigits = v2.includes(".") ? v2.split(".")[1].length : 0;
63145           return formatFloat(num, fractionDigits);
63146         });
63147         val = numbers2.join(";");
63148         shouldUpdate = (inputValue, setValue) => {
63149           const inputNums = inputValue.split(";").map(
63150             (setVal) => likelyRawNumberFormat.test(setVal) ? parseFloat(setVal) : parseLocaleFloat(setVal)
63151           );
63152           const setNums = setValue.split(";").map(parseLocaleFloat);
63153           return !isEqual_default(inputNums, setNums);
63154         };
63155       }
63156       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);
63157       if (field.type === "number") {
63158         const buttons = wrap2.selectAll(".increment, .decrement");
63159         if (isMixed) {
63160           buttons.attr("disabled", "disabled").classed("disabled", true);
63161         } else {
63162           var raw_vals = tags[field.key] || "0";
63163           const canIncDec = raw_vals.split(";").some((val2) => isFinite(Number(val2)) || isDirectionField && cardinal[val2.trim().toLowerCase()]);
63164           buttons.attr("disabled", canIncDec ? null : "disabled").classed("disabled", !canIncDec);
63165         }
63166       }
63167       if (field.type === "tel")
63168         updatePhonePlaceholder();
63169       if (field.type === "colour")
63170         updateColourPreview();
63171       if (field.type === "date")
63172         updateDateField();
63173       if (outlinkButton && !outlinkButton.empty()) {
63174         var disabled = !validIdentifierValueForLink();
63175         outlinkButton.classed("disabled", disabled);
63176       }
63177       if (!isMixed) {
63178         _lengthIndicator.update(tags[field.key]);
63179       }
63180     };
63181     i3.focus = function() {
63182       var node = input.node();
63183       if (node)
63184         node.focus();
63185     };
63186     function combinedEntityExtent() {
63187       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
63188     }
63189     return utilRebind(i3, dispatch14, "on");
63190   }
63191
63192   // modules/ui/fields/access.js
63193   function uiFieldAccess(field, context) {
63194     var dispatch14 = dispatch_default("change");
63195     var items = select_default2(null);
63196     var _tags;
63197     function access(selection2) {
63198       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
63199       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
63200       var list = wrap2.selectAll("ul").data([0]);
63201       list = list.enter().append("ul").attr("class", "rows").merge(list);
63202       items = list.selectAll("li").data(field.keys);
63203       var enter = items.enter().append("li").attr("class", function(d2) {
63204         return "labeled-input preset-access-" + d2;
63205       });
63206       enter.append("span").attr("class", "label preset-label-access").attr("for", function(d2) {
63207         return "preset-input-access-" + d2;
63208       }).html(function(d2) {
63209         return field.t.html("types." + d2);
63210       });
63211       enter.append("div").attr("class", "preset-input-access-wrap").append("input").attr("type", "text").attr("class", function(d2) {
63212         return "preset-input-access preset-input-access-" + d2;
63213       }).call(utilNoAuto).each(function(d2) {
63214         select_default2(this).call(
63215           uiCombobox(context, "access-" + d2).data(access.options(d2))
63216         );
63217       });
63218       items = items.merge(enter);
63219       wrap2.selectAll(".preset-input-access").on("change", change).on("blur", change);
63220     }
63221     function change(d3_event, d2) {
63222       var tag = {};
63223       var value = context.cleanTagValue(utilGetSetValue(select_default2(this)));
63224       if (!value && typeof _tags[d2] !== "string")
63225         return;
63226       tag[d2] = value || void 0;
63227       dispatch14.call("change", this, tag);
63228     }
63229     access.options = function(type2) {
63230       var options2 = [
63231         "yes",
63232         "no",
63233         "designated",
63234         "permissive",
63235         "destination",
63236         "customers",
63237         "private",
63238         "permit",
63239         "unknown"
63240       ];
63241       if (type2 === "access") {
63242         options2 = options2.filter((v2) => v2 !== "yes" && v2 !== "designated");
63243       }
63244       if (type2 === "bicycle") {
63245         options2.splice(options2.length - 4, 0, "dismount");
63246       }
63247       var stringsField = field.resolveReference("stringsCrossReference");
63248       return options2.map(function(option) {
63249         return {
63250           title: stringsField.t("options." + option + ".description"),
63251           value: option
63252         };
63253       });
63254     };
63255     const placeholdersByTag = {
63256       highway: {
63257         footway: {
63258           foot: "designated",
63259           motor_vehicle: "no"
63260         },
63261         steps: {
63262           foot: "yes",
63263           motor_vehicle: "no",
63264           bicycle: "no",
63265           horse: "no"
63266         },
63267         pedestrian: {
63268           foot: "yes",
63269           motor_vehicle: "no"
63270         },
63271         cycleway: {
63272           motor_vehicle: "no",
63273           bicycle: "designated"
63274         },
63275         bridleway: {
63276           motor_vehicle: "no",
63277           horse: "designated"
63278         },
63279         path: {
63280           foot: "yes",
63281           motor_vehicle: "no",
63282           bicycle: "yes",
63283           horse: "yes"
63284         },
63285         motorway: {
63286           foot: "no",
63287           motor_vehicle: "yes",
63288           bicycle: "no",
63289           horse: "no"
63290         },
63291         trunk: {
63292           motor_vehicle: "yes"
63293         },
63294         primary: {
63295           foot: "yes",
63296           motor_vehicle: "yes",
63297           bicycle: "yes",
63298           horse: "yes"
63299         },
63300         secondary: {
63301           foot: "yes",
63302           motor_vehicle: "yes",
63303           bicycle: "yes",
63304           horse: "yes"
63305         },
63306         tertiary: {
63307           foot: "yes",
63308           motor_vehicle: "yes",
63309           bicycle: "yes",
63310           horse: "yes"
63311         },
63312         residential: {
63313           foot: "yes",
63314           motor_vehicle: "yes",
63315           bicycle: "yes",
63316           horse: "yes"
63317         },
63318         unclassified: {
63319           foot: "yes",
63320           motor_vehicle: "yes",
63321           bicycle: "yes",
63322           horse: "yes"
63323         },
63324         service: {
63325           foot: "yes",
63326           motor_vehicle: "yes",
63327           bicycle: "yes",
63328           horse: "yes"
63329         },
63330         motorway_link: {
63331           foot: "no",
63332           motor_vehicle: "yes",
63333           bicycle: "no",
63334           horse: "no"
63335         },
63336         trunk_link: {
63337           motor_vehicle: "yes"
63338         },
63339         primary_link: {
63340           foot: "yes",
63341           motor_vehicle: "yes",
63342           bicycle: "yes",
63343           horse: "yes"
63344         },
63345         secondary_link: {
63346           foot: "yes",
63347           motor_vehicle: "yes",
63348           bicycle: "yes",
63349           horse: "yes"
63350         },
63351         tertiary_link: {
63352           foot: "yes",
63353           motor_vehicle: "yes",
63354           bicycle: "yes",
63355           horse: "yes"
63356         },
63357         construction: {
63358           access: "no"
63359         }
63360       },
63361       barrier: {
63362         bollard: {
63363           access: "no",
63364           bicycle: "yes",
63365           foot: "yes"
63366         },
63367         bus_trap: {
63368           motor_vehicle: "no",
63369           psv: "yes",
63370           foot: "yes",
63371           bicycle: "yes"
63372         },
63373         city_wall: {
63374           access: "no"
63375         },
63376         coupure: {
63377           access: "yes"
63378         },
63379         cycle_barrier: {
63380           motor_vehicle: "no"
63381         },
63382         ditch: {
63383           access: "no"
63384         },
63385         entrance: {
63386           access: "yes"
63387         },
63388         fence: {
63389           access: "no"
63390         },
63391         hedge: {
63392           access: "no"
63393         },
63394         jersey_barrier: {
63395           access: "no"
63396         },
63397         motorcycle_barrier: {
63398           motor_vehicle: "no"
63399         },
63400         rail_guard: {
63401           access: "no"
63402         }
63403       }
63404     };
63405     access.tags = function(tags) {
63406       _tags = tags;
63407       utilGetSetValue(items.selectAll(".preset-input-access"), function(d2) {
63408         return typeof tags[d2] === "string" ? tags[d2] : "";
63409       }).classed("mixed", function(d2) {
63410         return tags[d2] && Array.isArray(tags[d2]);
63411       }).attr("title", function(d2) {
63412         return tags[d2] && Array.isArray(tags[d2]) && tags[d2].filter(Boolean).join("\n");
63413       }).attr("placeholder", function(d2) {
63414         if (tags[d2] && Array.isArray(tags[d2])) {
63415           return _t("inspector.multiple_values");
63416         }
63417         if (d2 === "bicycle" || d2 === "motor_vehicle") {
63418           if (tags.vehicle && typeof tags.vehicle === "string") {
63419             return tags.vehicle;
63420           }
63421         }
63422         if (tags.access && typeof tags.access === "string") {
63423           return tags.access;
63424         }
63425         function getPlaceholdersByTag(key, placeholdersByKey) {
63426           if (typeof tags[key] === "string") {
63427             if (placeholdersByKey[tags[key]] && placeholdersByKey[tags[key]][d2]) {
63428               return placeholdersByKey[tags[key]][d2];
63429             }
63430           } else {
63431             var impliedAccesses = tags[key].filter(Boolean).map(function(val) {
63432               return placeholdersByKey[val] && placeholdersByKey[val][d2];
63433             }).filter(Boolean);
63434             if (impliedAccesses.length === tags[key].length && new Set(impliedAccesses).size === 1) {
63435               return impliedAccesses[0];
63436             }
63437           }
63438         }
63439         for (const key in placeholdersByTag) {
63440           if (tags[key]) {
63441             const impliedAccess = getPlaceholdersByTag(key, placeholdersByTag[key]);
63442             if (impliedAccess) {
63443               return impliedAccess;
63444             }
63445           }
63446         }
63447         if (d2 === "access" && !tags.barrier) {
63448           return "yes";
63449         }
63450         return field.placeholder();
63451       });
63452     };
63453     access.focus = function() {
63454       items.selectAll(".preset-input-access").node().focus();
63455     };
63456     return utilRebind(access, dispatch14, "on");
63457   }
63458
63459   // modules/ui/fields/address.js
63460   function uiFieldAddress(field, context) {
63461     var dispatch14 = dispatch_default("change");
63462     var _selection = select_default2(null);
63463     var _wrap = select_default2(null);
63464     var addrField = _mainPresetIndex.field("address");
63465     var _entityIDs = [];
63466     var _tags;
63467     var _countryCode;
63468     var _addressFormats = [{
63469       format: [
63470         ["housenumber", "street"],
63471         ["city", "postcode"]
63472       ]
63473     }];
63474     _mainFileFetcher.get("address_formats").then(function(d2) {
63475       _addressFormats = d2;
63476       if (!_selection.empty()) {
63477         _selection.call(address);
63478       }
63479     }).catch(function() {
63480     });
63481     function getNear(isAddressable, type2, searchRadius, resultProp) {
63482       var extent = combinedEntityExtent();
63483       var l2 = extent.center();
63484       var box = geoExtent(l2).padByMeters(searchRadius);
63485       var features = context.history().intersects(box).filter(isAddressable).map((d2) => {
63486         let dist = geoSphericalDistance(d2.extent(context.graph()).center(), l2);
63487         if (d2.geometry(context.graph()) === "line") {
63488           var loc = context.projection([
63489             (extent[0][0] + extent[1][0]) / 2,
63490             (extent[0][1] + extent[1][1]) / 2
63491           ]);
63492           var choice = geoChooseEdge(context.graph().childNodes(d2), loc, context.projection);
63493           dist = geoSphericalDistance(choice.loc, l2);
63494         }
63495         const value = resultProp && d2.tags[resultProp] ? d2.tags[resultProp] : d2.tags.name;
63496         let title = value;
63497         if (type2 === "street") {
63498           title = "".concat(addrField.t("placeholders.street"), ": ").concat(title);
63499         } else if (type2 === "place") {
63500           title = "".concat(addrField.t("placeholders.place"), ": ").concat(title);
63501         }
63502         return {
63503           title,
63504           value,
63505           dist,
63506           type: type2,
63507           klass: "address-".concat(type2)
63508         };
63509       }).sort(function(a2, b2) {
63510         return a2.dist - b2.dist;
63511       });
63512       return utilArrayUniqBy(features, "value");
63513     }
63514     function getNearStreets() {
63515       function isAddressable(d2) {
63516         return d2.tags.highway && d2.tags.name && d2.type === "way";
63517       }
63518       return getNear(isAddressable, "street", 200);
63519     }
63520     function getNearPlaces() {
63521       function isAddressable(d2) {
63522         if (d2.tags.name) {
63523           if (d2.tags.place)
63524             return true;
63525           if (d2.tags.boundary === "administrative" && d2.tags.admin_level > 8)
63526             return true;
63527         }
63528         return false;
63529       }
63530       return getNear(isAddressable, "place", 200);
63531     }
63532     function getNearCities() {
63533       function isAddressable(d2) {
63534         if (d2.tags.name) {
63535           if (d2.tags.boundary === "administrative" && d2.tags.admin_level === "8")
63536             return true;
63537           if (d2.tags.border_type === "city")
63538             return true;
63539           if (d2.tags.place === "city" || d2.tags.place === "town" || d2.tags.place === "village")
63540             return true;
63541         }
63542         if (d2.tags["".concat(field.key, ":city")])
63543           return true;
63544         return false;
63545       }
63546       return getNear(isAddressable, "city", 200, "".concat(field.key, ":city"));
63547     }
63548     function getNearPostcodes() {
63549       return [...new Set([].concat(getNearValues("postcode")).concat(getNear((d2) => d2.tags.postal_code, "postcode", 200, "postal_code")))];
63550     }
63551     function getNearValues(key) {
63552       const tagKey = "".concat(field.key, ":").concat(key);
63553       function hasTag(d2) {
63554         return _entityIDs.indexOf(d2.id) === -1 && d2.tags[tagKey];
63555       }
63556       return getNear(hasTag, key, 200, tagKey);
63557     }
63558     function updateForCountryCode() {
63559       if (!_countryCode)
63560         return;
63561       var addressFormat;
63562       for (var i3 = 0; i3 < _addressFormats.length; i3++) {
63563         var format2 = _addressFormats[i3];
63564         if (!format2.countryCodes) {
63565           addressFormat = format2;
63566         } else if (format2.countryCodes.indexOf(_countryCode) !== -1) {
63567           addressFormat = format2;
63568           break;
63569         }
63570       }
63571       var dropdowns = addressFormat.dropdowns || [
63572         "city",
63573         "county",
63574         "country",
63575         "district",
63576         "hamlet",
63577         "neighbourhood",
63578         "place",
63579         "postcode",
63580         "province",
63581         "quarter",
63582         "state",
63583         "street",
63584         "street+place",
63585         "subdistrict",
63586         "suburb"
63587       ];
63588       var widths = addressFormat.widths || {
63589         housenumber: 1 / 5,
63590         unit: 1 / 5,
63591         street: 1 / 2,
63592         place: 1 / 2,
63593         city: 2 / 3,
63594         state: 1 / 4,
63595         postcode: 1 / 3
63596       };
63597       function row(r2) {
63598         var total = r2.reduce(function(sum, key) {
63599           return sum + (widths[key] || 0.5);
63600         }, 0);
63601         return r2.map(function(key) {
63602           return {
63603             id: key,
63604             width: (widths[key] || 0.5) / total
63605           };
63606         });
63607       }
63608       var rows = _wrap.selectAll(".addr-row").data(addressFormat.format, function(d2) {
63609         return d2.toString();
63610       });
63611       rows.exit().remove();
63612       rows.enter().append("div").attr("class", "addr-row").selectAll("input").data(row).enter().append("input").property("type", "text").call(updatePlaceholder).attr("class", function(d2) {
63613         return "addr-" + d2.id;
63614       }).call(utilNoAuto).each(addDropdown).style("width", function(d2) {
63615         return d2.width * 100 + "%";
63616       });
63617       function addDropdown(d2) {
63618         if (dropdowns.indexOf(d2.id) === -1)
63619           return;
63620         var nearValues;
63621         switch (d2.id) {
63622           case "street":
63623             nearValues = getNearStreets;
63624             break;
63625           case "place":
63626             nearValues = getNearPlaces;
63627             break;
63628           case "street+place":
63629             nearValues = () => [].concat(getNearStreets()).concat(getNearPlaces());
63630             d2.isAutoStreetPlace = true;
63631             d2.id = _tags["".concat(field.key, ":place")] ? "place" : "street";
63632             break;
63633           case "city":
63634             nearValues = getNearCities;
63635             break;
63636           case "postcode":
63637             nearValues = getNearPostcodes;
63638             break;
63639           default:
63640             nearValues = getNearValues;
63641         }
63642         select_default2(this).call(
63643           uiCombobox(context, "address-".concat(d2.isAutoStreetPlace ? "street-place" : d2.id)).minItems(1).caseSensitive(true).fetcher(function(typedValue, callback) {
63644             typedValue = typedValue.toLowerCase();
63645             callback(nearValues(d2.id).filter((v2) => v2.value.toLowerCase().indexOf(typedValue) !== -1));
63646           }).on("accept", function(selected) {
63647             if (d2.isAutoStreetPlace) {
63648               d2.id = selected ? selected.type : "street";
63649             }
63650           })
63651         );
63652       }
63653       _wrap.selectAll("input").on("blur", change()).on("change", change());
63654       _wrap.selectAll("input:not(.combobox-input)").on("input", change(true));
63655       if (_tags)
63656         updateTags(_tags);
63657     }
63658     function address(selection2) {
63659       _selection = selection2;
63660       _wrap = selection2.selectAll(".form-field-input-wrap").data([0]);
63661       _wrap = _wrap.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(_wrap);
63662       var extent = combinedEntityExtent();
63663       if (extent) {
63664         var countryCode;
63665         if (context.inIntro()) {
63666           countryCode = _t("intro.graph.countrycode");
63667         } else {
63668           var center = extent.center();
63669           countryCode = iso1A2Code(center);
63670         }
63671         if (countryCode) {
63672           _countryCode = countryCode.toLowerCase();
63673           updateForCountryCode();
63674         }
63675       }
63676     }
63677     function change(onInput) {
63678       return function() {
63679         setTimeout(() => {
63680           var tags = {};
63681           _wrap.selectAll("input").each(function(subfield) {
63682             var key = field.key + ":" + subfield.id;
63683             var value = this.value;
63684             if (!onInput)
63685               value = context.cleanTagValue(value);
63686             if (Array.isArray(_tags[key]) && !value)
63687               return;
63688             if (subfield.isAutoStreetPlace) {
63689               if (subfield.id === "street") {
63690                 tags["".concat(field.key, ":place")] = void 0;
63691               } else if (subfield.id === "place") {
63692                 tags["".concat(field.key, ":street")] = void 0;
63693               }
63694             }
63695             tags[key] = value || void 0;
63696           });
63697           Object.keys(tags).filter((k2) => tags[k2]).forEach((k2) => _tags[k2] = tags[k2]);
63698           dispatch14.call("change", this, tags, onInput);
63699         }, 0);
63700       };
63701     }
63702     function updatePlaceholder(inputSelection) {
63703       return inputSelection.attr("placeholder", function(subfield) {
63704         if (_tags && Array.isArray(_tags[field.key + ":" + subfield.id])) {
63705           return _t("inspector.multiple_values");
63706         }
63707         if (subfield.isAutoStreetPlace) {
63708           return "".concat(getLocalPlaceholder("street"), " / ").concat(getLocalPlaceholder("place"));
63709         }
63710         return getLocalPlaceholder(subfield.id);
63711       });
63712     }
63713     function getLocalPlaceholder(key) {
63714       if (_countryCode) {
63715         var localkey = key + "!" + _countryCode;
63716         var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : key;
63717         return addrField.t("placeholders." + tkey);
63718       }
63719     }
63720     function updateTags(tags) {
63721       utilGetSetValue(_wrap.selectAll("input"), (subfield) => {
63722         var val;
63723         if (subfield.isAutoStreetPlace) {
63724           const streetKey = "".concat(field.key, ":street");
63725           const placeKey = "".concat(field.key, ":place");
63726           if (tags[streetKey] !== void 0 || tags[placeKey] === void 0) {
63727             val = tags[streetKey];
63728             subfield.id = "street";
63729           } else {
63730             val = tags[placeKey];
63731             subfield.id = "place";
63732           }
63733         } else {
63734           val = tags["".concat(field.key, ":").concat(subfield.id)];
63735         }
63736         return typeof val === "string" ? val : "";
63737       }).attr("title", function(subfield) {
63738         var val = tags[field.key + ":" + subfield.id];
63739         return val && Array.isArray(val) ? val.filter(Boolean).join("\n") : void 0;
63740       }).classed("mixed", function(subfield) {
63741         return Array.isArray(tags[field.key + ":" + subfield.id]);
63742       }).call(updatePlaceholder);
63743     }
63744     function combinedEntityExtent() {
63745       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
63746     }
63747     address.entityIDs = function(val) {
63748       if (!arguments.length)
63749         return _entityIDs;
63750       _entityIDs = val;
63751       return address;
63752     };
63753     address.tags = function(tags) {
63754       _tags = tags;
63755       updateTags(tags);
63756     };
63757     address.focus = function() {
63758       var node = _wrap.selectAll("input").node();
63759       if (node)
63760         node.focus();
63761     };
63762     return utilRebind(address, dispatch14, "on");
63763   }
63764
63765   // modules/ui/fields/directional_combo.js
63766   function uiFieldDirectionalCombo(field, context) {
63767     var dispatch14 = dispatch_default("change");
63768     var items = select_default2(null);
63769     var wrap2 = select_default2(null);
63770     var _tags;
63771     var _combos = {};
63772     if (field.type === "cycleway") {
63773       field = __spreadProps(__spreadValues({}, field), {
63774         key: field.keys[0],
63775         keys: field.keys.slice(1)
63776       });
63777     }
63778     function directionalCombo(selection2) {
63779       function stripcolon(s2) {
63780         return s2.replace(":", "");
63781       }
63782       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
63783       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
63784       var div = wrap2.selectAll("ul").data([0]);
63785       div = div.enter().append("ul").attr("class", "rows").merge(div);
63786       items = div.selectAll("li").data(field.keys);
63787       var enter = items.enter().append("li").attr("class", function(d2) {
63788         return "labeled-input preset-directionalcombo-" + stripcolon(d2);
63789       });
63790       enter.append("span").attr("class", "label preset-label-directionalcombo").attr("for", function(d2) {
63791         return "preset-input-directionalcombo-" + stripcolon(d2);
63792       }).html(function(d2) {
63793         return field.t.html("types." + d2);
63794       });
63795       enter.append("div").attr("class", "preset-input-directionalcombo-wrap form-field-input-wrap").each(function(key) {
63796         const subField = __spreadProps(__spreadValues({}, field), {
63797           type: "combo",
63798           key
63799         });
63800         const combo = uiFieldCombo(subField, context);
63801         combo.on("change", (t2) => change(key, t2[key]));
63802         _combos[key] = combo;
63803         select_default2(this).call(combo);
63804       });
63805       items = items.merge(enter);
63806       wrap2.selectAll(".preset-input-directionalcombo").on("change", change).on("blur", change);
63807     }
63808     function change(key, newValue) {
63809       const commonKey = field.key;
63810       const otherKey = key === field.keys[0] ? field.keys[1] : field.keys[0];
63811       dispatch14.call("change", this, (tags) => {
63812         const otherValue = tags[otherKey] || tags[commonKey];
63813         if (newValue === otherValue) {
63814           tags[commonKey] = newValue;
63815           delete tags[key];
63816           delete tags[otherKey];
63817         } else {
63818           tags[key] = newValue;
63819           delete tags[commonKey];
63820           tags[otherKey] = otherValue;
63821         }
63822         return tags;
63823       });
63824     }
63825     directionalCombo.tags = function(tags) {
63826       _tags = tags;
63827       const commonKey = field.key;
63828       for (let key in _combos) {
63829         const uniqueValues = [...new Set([].concat(_tags[commonKey]).concat(_tags[key]).filter(Boolean))];
63830         _combos[key].tags({ [key]: uniqueValues.length > 1 ? uniqueValues : uniqueValues[0] });
63831       }
63832     };
63833     directionalCombo.focus = function() {
63834       var node = wrap2.selectAll("input").node();
63835       if (node)
63836         node.focus();
63837     };
63838     return utilRebind(directionalCombo, dispatch14, "on");
63839   }
63840
63841   // modules/ui/fields/lanes.js
63842   function uiFieldLanes(field, context) {
63843     var dispatch14 = dispatch_default("change");
63844     var LANE_WIDTH = 40;
63845     var LANE_HEIGHT = 200;
63846     var _entityIDs = [];
63847     function lanes(selection2) {
63848       var lanesData = context.entity(_entityIDs[0]).lanes();
63849       if (!context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode) {
63850         selection2.call(lanes.off);
63851         return;
63852       }
63853       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
63854       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
63855       var surface = wrap2.selectAll(".surface").data([0]);
63856       var d2 = utilGetDimensions(wrap2);
63857       var freeSpace = d2[0] - lanesData.lanes.length * LANE_WIDTH * 1.5 + LANE_WIDTH * 0.5;
63858       surface = surface.enter().append("svg").attr("width", d2[0]).attr("height", 300).attr("class", "surface").merge(surface);
63859       var lanesSelection = surface.selectAll(".lanes").data([0]);
63860       lanesSelection = lanesSelection.enter().append("g").attr("class", "lanes").merge(lanesSelection);
63861       lanesSelection.attr("transform", function() {
63862         return "translate(" + freeSpace / 2 + ", 0)";
63863       });
63864       var lane = lanesSelection.selectAll(".lane").data(lanesData.lanes);
63865       lane.exit().remove();
63866       var enter = lane.enter().append("g").attr("class", "lane");
63867       enter.append("g").append("rect").attr("y", 50).attr("width", LANE_WIDTH).attr("height", LANE_HEIGHT);
63868       enter.append("g").attr("class", "forward").append("text").attr("y", 40).attr("x", 14).text("\u25B2");
63869       enter.append("g").attr("class", "bothways").append("text").attr("y", 40).attr("x", 14).text("\u25B2\u25BC");
63870       enter.append("g").attr("class", "backward").append("text").attr("y", 40).attr("x", 14).text("\u25BC");
63871       lane = lane.merge(enter);
63872       lane.attr("transform", function(d4) {
63873         return "translate(" + LANE_WIDTH * d4.index * 1.5 + ", 0)";
63874       });
63875       lane.select(".forward").style("visibility", function(d4) {
63876         return d4.direction === "forward" ? "visible" : "hidden";
63877       });
63878       lane.select(".bothways").style("visibility", function(d4) {
63879         return d4.direction === "bothways" ? "visible" : "hidden";
63880       });
63881       lane.select(".backward").style("visibility", function(d4) {
63882         return d4.direction === "backward" ? "visible" : "hidden";
63883       });
63884     }
63885     lanes.entityIDs = function(val) {
63886       _entityIDs = val;
63887     };
63888     lanes.tags = function() {
63889     };
63890     lanes.focus = function() {
63891     };
63892     lanes.off = function() {
63893     };
63894     return utilRebind(lanes, dispatch14, "on");
63895   }
63896   uiFieldLanes.supportsMultiselection = false;
63897
63898   // modules/ui/fields/localized.js
63899   var _languagesArray = [];
63900   function uiFieldLocalized(field, context) {
63901     var dispatch14 = dispatch_default("change", "input");
63902     var wikipedia = services.wikipedia;
63903     var input = select_default2(null);
63904     var localizedInputs = select_default2(null);
63905     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
63906     var _countryCode;
63907     var _tags;
63908     _mainFileFetcher.get("languages").then(loadLanguagesArray).catch(function() {
63909     });
63910     var _territoryLanguages = {};
63911     _mainFileFetcher.get("territory_languages").then(function(d2) {
63912       _territoryLanguages = d2;
63913     }).catch(function() {
63914     });
63915     var langCombo = uiCombobox(context, "localized-lang").fetcher(fetchLanguages).minItems(0);
63916     var _selection = select_default2(null);
63917     var _multilingual = [];
63918     var _buttonTip = uiTooltip().title(() => _t.append("translate.translate")).placement("left");
63919     var _wikiTitles;
63920     var _entityIDs = [];
63921     function loadLanguagesArray(dataLanguages) {
63922       if (_languagesArray.length !== 0)
63923         return;
63924       var replacements = {
63925         sr: "sr-Cyrl",
63926         // in OSM, `sr` implies Cyrillic
63927         "sr-Cyrl": false
63928         // `sr-Cyrl` isn't used in OSM
63929       };
63930       for (var code in dataLanguages) {
63931         if (replacements[code] === false)
63932           continue;
63933         var metaCode = code;
63934         if (replacements[code])
63935           metaCode = replacements[code];
63936         _languagesArray.push({
63937           localName: _mainLocalizer.languageName(metaCode, { localOnly: true }),
63938           nativeName: dataLanguages[metaCode].nativeName,
63939           code,
63940           label: _mainLocalizer.languageName(metaCode)
63941         });
63942       }
63943     }
63944     function calcLocked() {
63945       var isLocked = field.id === "name" && _entityIDs.length && _entityIDs.some(function(entityID) {
63946         var entity = context.graph().hasEntity(entityID);
63947         if (!entity)
63948           return false;
63949         if (entity.tags.wikidata)
63950           return true;
63951         if (entity.tags["name:etymology:wikidata"])
63952           return true;
63953         var preset = _mainPresetIndex.match(entity, context.graph());
63954         if (preset) {
63955           var isSuggestion = preset.suggestion;
63956           var fields = preset.fields(entity.extent(context.graph()).center());
63957           var showsBrandField = fields.some(function(d2) {
63958             return d2.id === "brand";
63959           });
63960           var showsOperatorField = fields.some(function(d2) {
63961             return d2.id === "operator";
63962           });
63963           var setsName = preset.addTags.name;
63964           var setsBrandWikidata = preset.addTags["brand:wikidata"];
63965           var setsOperatorWikidata = preset.addTags["operator:wikidata"];
63966           return isSuggestion && setsName && (setsBrandWikidata && !showsBrandField || setsOperatorWikidata && !showsOperatorField);
63967         }
63968         return false;
63969       });
63970       field.locked(isLocked);
63971     }
63972     function calcMultilingual(tags) {
63973       var existingLangsOrdered = _multilingual.map(function(item2) {
63974         return item2.lang;
63975       });
63976       var existingLangs = new Set(existingLangsOrdered.filter(Boolean));
63977       for (var k2 in tags) {
63978         var m2 = k2.match(/^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/);
63979         if (m2 && m2[1] === field.key && m2[2]) {
63980           var item = { lang: m2[2], value: tags[k2] };
63981           if (existingLangs.has(item.lang)) {
63982             _multilingual[existingLangsOrdered.indexOf(item.lang)].value = item.value;
63983             existingLangs.delete(item.lang);
63984           } else {
63985             _multilingual.push(item);
63986           }
63987         }
63988       }
63989       _multilingual.forEach(function(item2) {
63990         if (item2.lang && existingLangs.has(item2.lang)) {
63991           item2.value = "";
63992         }
63993       });
63994     }
63995     function localized(selection2) {
63996       _selection = selection2;
63997       calcLocked();
63998       var isLocked = field.locked();
63999       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
64000       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
64001       input = wrap2.selectAll(".localized-main").data([0]);
64002       input = input.enter().append("input").attr("type", "text").attr("id", field.domId).attr("class", "localized-main").call(utilNoAuto).merge(input);
64003       input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
64004       wrap2.call(_lengthIndicator);
64005       var translateButton = wrap2.selectAll(".localized-add").data([0]);
64006       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);
64007       translateButton.classed("disabled", !!isLocked).call(isLocked ? _buttonTip.destroy : _buttonTip).on("click", addNew);
64008       if (_tags && !_multilingual.length) {
64009         calcMultilingual(_tags);
64010       }
64011       localizedInputs = selection2.selectAll(".localized-multilingual").data([0]);
64012       localizedInputs = localizedInputs.enter().append("div").attr("class", "localized-multilingual").merge(localizedInputs);
64013       localizedInputs.call(renderMultilingual);
64014       localizedInputs.selectAll("button, input").classed("disabled", !!isLocked).attr("readonly", isLocked || null);
64015       selection2.selectAll(".combobox-caret").classed("nope", true);
64016       function addNew(d3_event) {
64017         d3_event.preventDefault();
64018         if (field.locked())
64019           return;
64020         var defaultLang = _mainLocalizer.languageCode().toLowerCase();
64021         var langExists = _multilingual.find(function(datum2) {
64022           return datum2.lang === defaultLang;
64023         });
64024         var isLangEn = defaultLang.indexOf("en") > -1;
64025         if (isLangEn || langExists) {
64026           defaultLang = "";
64027           langExists = _multilingual.find(function(datum2) {
64028             return datum2.lang === defaultLang;
64029           });
64030         }
64031         if (!langExists) {
64032           _multilingual.unshift({ lang: defaultLang, value: "" });
64033           localizedInputs.call(renderMultilingual);
64034         }
64035       }
64036       function change(onInput) {
64037         return function(d3_event) {
64038           if (field.locked()) {
64039             d3_event.preventDefault();
64040             return;
64041           }
64042           var val = utilGetSetValue(select_default2(this));
64043           if (!onInput)
64044             val = context.cleanTagValue(val);
64045           if (!val && Array.isArray(_tags[field.key]))
64046             return;
64047           var t2 = {};
64048           t2[field.key] = val || void 0;
64049           dispatch14.call("change", this, t2, onInput);
64050         };
64051       }
64052     }
64053     function key(lang) {
64054       return field.key + ":" + lang;
64055     }
64056     function changeLang(d3_event, d2) {
64057       var tags = {};
64058       var lang = utilGetSetValue(select_default2(this)).toLowerCase();
64059       var language = _languagesArray.find(function(d4) {
64060         return d4.label.toLowerCase() === lang || d4.localName && d4.localName.toLowerCase() === lang || d4.nativeName && d4.nativeName.toLowerCase() === lang;
64061       });
64062       if (language)
64063         lang = language.code;
64064       if (d2.lang && d2.lang !== lang) {
64065         tags[key(d2.lang)] = void 0;
64066       }
64067       var newKey = lang && context.cleanTagKey(key(lang));
64068       var value = utilGetSetValue(select_default2(this.parentNode).selectAll(".localized-value"));
64069       if (newKey && value) {
64070         tags[newKey] = value;
64071       } else if (newKey && _wikiTitles && _wikiTitles[d2.lang]) {
64072         tags[newKey] = _wikiTitles[d2.lang];
64073       }
64074       d2.lang = lang;
64075       dispatch14.call("change", this, tags);
64076     }
64077     function changeValue(d3_event, d2) {
64078       if (!d2.lang)
64079         return;
64080       var value = context.cleanTagValue(utilGetSetValue(select_default2(this))) || void 0;
64081       if (!value && Array.isArray(d2.value))
64082         return;
64083       var t2 = {};
64084       t2[key(d2.lang)] = value;
64085       d2.value = value;
64086       dispatch14.call("change", this, t2);
64087     }
64088     function fetchLanguages(value, cb) {
64089       var v2 = value.toLowerCase();
64090       var langCodes = [_mainLocalizer.localeCode(), _mainLocalizer.languageCode()];
64091       if (_countryCode && _territoryLanguages[_countryCode]) {
64092         langCodes = langCodes.concat(_territoryLanguages[_countryCode]);
64093       }
64094       var langItems = [];
64095       langCodes.forEach(function(code) {
64096         var langItem = _languagesArray.find(function(item) {
64097           return item.code === code;
64098         });
64099         if (langItem)
64100           langItems.push(langItem);
64101       });
64102       langItems = utilArrayUniq(langItems.concat(_languagesArray));
64103       cb(langItems.filter(function(d2) {
64104         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;
64105       }).map(function(d2) {
64106         return { value: d2.label };
64107       }));
64108     }
64109     function renderMultilingual(selection2) {
64110       var entries = selection2.selectAll("div.entry").data(_multilingual, function(d2) {
64111         return d2.lang;
64112       });
64113       entries.exit().style("top", "0").style("max-height", "240px").transition().duration(200).style("opacity", "0").style("max-height", "0px").remove();
64114       var entriesEnter = entries.enter().append("div").attr("class", "entry").each(function(_2, index) {
64115         var wrap2 = select_default2(this);
64116         var domId = utilUniqueDomId(index);
64117         var label = wrap2.append("label").attr("class", "field-label").attr("for", domId);
64118         var text2 = label.append("span").attr("class", "label-text");
64119         text2.append("span").attr("class", "label-textvalue").call(_t.append("translate.localized_translation_label"));
64120         text2.append("span").attr("class", "label-textannotation");
64121         label.append("button").attr("class", "remove-icon-multilingual").attr("title", _t("icons.remove")).on("click", function(d3_event, d2) {
64122           if (field.locked())
64123             return;
64124           d3_event.preventDefault();
64125           _multilingual.splice(_multilingual.indexOf(d2), 1);
64126           var langKey = d2.lang && key(d2.lang);
64127           if (langKey && langKey in _tags) {
64128             delete _tags[langKey];
64129             var t2 = {};
64130             t2[langKey] = void 0;
64131             dispatch14.call("change", this, t2);
64132             return;
64133           }
64134           renderMultilingual(selection2);
64135         }).call(svgIcon("#iD-operation-delete"));
64136         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);
64137         wrap2.append("input").attr("type", "text").attr("class", "localized-value").on("blur", changeValue).on("change", changeValue);
64138       });
64139       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() {
64140         select_default2(this).style("max-height", "").style("overflow", "visible");
64141       });
64142       entries = entries.merge(entriesEnter);
64143       entries.order();
64144       entries.classed("present", true);
64145       utilGetSetValue(entries.select(".localized-lang"), function(d2) {
64146         var langItem = _languagesArray.find(function(item) {
64147           return item.code === d2.lang;
64148         });
64149         if (langItem)
64150           return langItem.label;
64151         return d2.lang;
64152       });
64153       utilGetSetValue(entries.select(".localized-value"), function(d2) {
64154         return typeof d2.value === "string" ? d2.value : "";
64155       }).attr("title", function(d2) {
64156         return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : null;
64157       }).attr("placeholder", function(d2) {
64158         return Array.isArray(d2.value) ? _t("inspector.multiple_values") : _t("translate.localized_translation_name");
64159       }).classed("mixed", function(d2) {
64160         return Array.isArray(d2.value);
64161       });
64162     }
64163     localized.tags = function(tags) {
64164       _tags = tags;
64165       if (typeof tags.wikipedia === "string" && !_wikiTitles) {
64166         _wikiTitles = {};
64167         var wm = tags.wikipedia.match(/([^:]+):(.+)/);
64168         if (wm && wm[0] && wm[1]) {
64169           wikipedia.translations(wm[1], wm[2], function(err, d2) {
64170             if (err || !d2)
64171               return;
64172             _wikiTitles = d2;
64173           });
64174         }
64175       }
64176       var isMixed = Array.isArray(tags[field.key]);
64177       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);
64178       calcMultilingual(tags);
64179       _selection.call(localized);
64180       if (!isMixed) {
64181         _lengthIndicator.update(tags[field.key]);
64182       }
64183     };
64184     localized.focus = function() {
64185       input.node().focus();
64186     };
64187     localized.entityIDs = function(val) {
64188       if (!arguments.length)
64189         return _entityIDs;
64190       _entityIDs = val;
64191       _multilingual = [];
64192       loadCountryCode();
64193       return localized;
64194     };
64195     function loadCountryCode() {
64196       var extent = combinedEntityExtent();
64197       var countryCode = extent && iso1A2Code(extent.center());
64198       _countryCode = countryCode && countryCode.toLowerCase();
64199     }
64200     function combinedEntityExtent() {
64201       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
64202     }
64203     return utilRebind(localized, dispatch14, "on");
64204   }
64205
64206   // modules/ui/fields/roadheight.js
64207   function uiFieldRoadheight(field, context) {
64208     var dispatch14 = dispatch_default("change");
64209     var primaryUnitInput = select_default2(null);
64210     var primaryInput = select_default2(null);
64211     var secondaryInput = select_default2(null);
64212     var secondaryUnitInput = select_default2(null);
64213     var _entityIDs = [];
64214     var _tags;
64215     var _isImperial;
64216     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
64217     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
64218     var primaryUnits = [
64219       {
64220         value: "m",
64221         title: _t("inspector.roadheight.meter")
64222       },
64223       {
64224         value: "ft",
64225         title: _t("inspector.roadheight.foot")
64226       }
64227     ];
64228     var unitCombo = uiCombobox(context, "roadheight-unit").data(primaryUnits);
64229     function roadheight(selection2) {
64230       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
64231       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
64232       primaryInput = wrap2.selectAll("input.roadheight-number").data([0]);
64233       primaryInput = primaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-number").attr("id", field.domId).call(utilNoAuto).merge(primaryInput);
64234       primaryInput.on("change", change).on("blur", change);
64235       var loc = combinedEntityExtent().center();
64236       _isImperial = roadHeightUnit(loc) === "ft";
64237       primaryUnitInput = wrap2.selectAll("input.roadheight-unit").data([0]);
64238       primaryUnitInput = primaryUnitInput.enter().append("input").attr("type", "text").attr("class", "roadheight-unit").call(unitCombo).merge(primaryUnitInput);
64239       primaryUnitInput.on("blur", changeUnits).on("change", changeUnits);
64240       secondaryInput = wrap2.selectAll("input.roadheight-secondary-number").data([0]);
64241       secondaryInput = secondaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-secondary-number").call(utilNoAuto).merge(secondaryInput);
64242       secondaryInput.on("change", change).on("blur", change);
64243       secondaryUnitInput = wrap2.selectAll("input.roadheight-secondary-unit").data([0]);
64244       secondaryUnitInput = secondaryUnitInput.enter().append("input").attr("type", "text").call(utilNoAuto).classed("disabled", true).classed("roadheight-secondary-unit", true).attr("readonly", "readonly").merge(secondaryUnitInput);
64245       function changeUnits() {
64246         var primaryUnit = utilGetSetValue(primaryUnitInput);
64247         if (primaryUnit === "m") {
64248           _isImperial = false;
64249         } else if (primaryUnit === "ft") {
64250           _isImperial = true;
64251         }
64252         utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
64253         setUnitSuggestions();
64254         change();
64255       }
64256     }
64257     function setUnitSuggestions() {
64258       utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
64259     }
64260     function change() {
64261       var tag = {};
64262       var primaryValue = utilGetSetValue(primaryInput).trim();
64263       var secondaryValue = utilGetSetValue(secondaryInput).trim();
64264       if (!primaryValue && !secondaryValue && Array.isArray(_tags[field.key]))
64265         return;
64266       if (!primaryValue && !secondaryValue) {
64267         tag[field.key] = void 0;
64268       } else {
64269         var rawPrimaryValue = likelyRawNumberFormat.test(primaryValue) ? parseFloat(primaryValue) : parseLocaleFloat(primaryValue);
64270         if (isNaN(rawPrimaryValue))
64271           rawPrimaryValue = primaryValue;
64272         var rawSecondaryValue = likelyRawNumberFormat.test(secondaryValue) ? parseFloat(secondaryValue) : parseLocaleFloat(secondaryValue);
64273         if (isNaN(rawSecondaryValue))
64274           rawSecondaryValue = secondaryValue;
64275         if (isNaN(rawPrimaryValue) || isNaN(rawSecondaryValue) || !_isImperial) {
64276           tag[field.key] = context.cleanTagValue(rawPrimaryValue);
64277         } else {
64278           if (rawPrimaryValue !== "") {
64279             rawPrimaryValue = rawPrimaryValue + "'";
64280           }
64281           if (rawSecondaryValue !== "") {
64282             rawSecondaryValue = rawSecondaryValue + '"';
64283           }
64284           tag[field.key] = context.cleanTagValue(rawPrimaryValue + rawSecondaryValue);
64285         }
64286       }
64287       dispatch14.call("change", this, tag);
64288     }
64289     roadheight.tags = function(tags) {
64290       _tags = tags;
64291       var primaryValue = tags[field.key];
64292       var secondaryValue;
64293       var isMixed = Array.isArray(primaryValue);
64294       if (!isMixed) {
64295         if (primaryValue && (primaryValue.indexOf("'") >= 0 || primaryValue.indexOf('"') >= 0)) {
64296           secondaryValue = primaryValue.match(/(-?[\d.]+)"/);
64297           if (secondaryValue !== null) {
64298             secondaryValue = formatFloat(parseFloat(secondaryValue[1]));
64299           }
64300           primaryValue = primaryValue.match(/(-?[\d.]+)'/);
64301           if (primaryValue !== null) {
64302             primaryValue = formatFloat(parseFloat(primaryValue[1]));
64303           }
64304           _isImperial = true;
64305         } else if (primaryValue) {
64306           var rawValue = primaryValue;
64307           primaryValue = parseFloat(rawValue);
64308           if (isNaN(primaryValue)) {
64309             primaryValue = rawValue;
64310           } else {
64311             primaryValue = formatFloat(primaryValue);
64312           }
64313           _isImperial = false;
64314         }
64315       }
64316       setUnitSuggestions();
64317       var inchesPlaceholder = formatFloat(0);
64318       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);
64319       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");
64320       secondaryUnitInput.attr("value", _isImperial ? _t("inspector.roadheight.inch") : null);
64321     };
64322     roadheight.focus = function() {
64323       primaryInput.node().focus();
64324     };
64325     roadheight.entityIDs = function(val) {
64326       _entityIDs = val;
64327     };
64328     function combinedEntityExtent() {
64329       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
64330     }
64331     return utilRebind(roadheight, dispatch14, "on");
64332   }
64333
64334   // modules/ui/fields/roadspeed.js
64335   function uiFieldRoadspeed(field, context) {
64336     var dispatch14 = dispatch_default("change");
64337     var unitInput = select_default2(null);
64338     var input = select_default2(null);
64339     var _entityIDs = [];
64340     var _tags;
64341     var _isImperial;
64342     var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
64343     var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
64344     var speedCombo = uiCombobox(context, "roadspeed");
64345     var unitCombo = uiCombobox(context, "roadspeed-unit").data(["km/h", "mph"].map(comboValues));
64346     var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
64347     var imperialValues = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80];
64348     function roadspeed(selection2) {
64349       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
64350       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
64351       input = wrap2.selectAll("input.roadspeed-number").data([0]);
64352       input = input.enter().append("input").attr("type", "text").attr("class", "roadspeed-number").attr("id", field.domId).call(utilNoAuto).call(speedCombo).merge(input);
64353       input.on("change", change).on("blur", change);
64354       var loc = combinedEntityExtent().center();
64355       _isImperial = roadSpeedUnit(loc) === "mph";
64356       unitInput = wrap2.selectAll("input.roadspeed-unit").data([0]);
64357       unitInput = unitInput.enter().append("input").attr("type", "text").attr("class", "roadspeed-unit").attr("aria-label", _t("inspector.speed_unit")).call(unitCombo).merge(unitInput);
64358       unitInput.on("blur", changeUnits).on("change", changeUnits);
64359       function changeUnits() {
64360         var unit2 = utilGetSetValue(unitInput);
64361         if (unit2 === "km/h") {
64362           _isImperial = false;
64363         } else if (unit2 === "mph") {
64364           _isImperial = true;
64365         }
64366         utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
64367         setUnitSuggestions();
64368         change();
64369       }
64370     }
64371     function setUnitSuggestions() {
64372       speedCombo.data((_isImperial ? imperialValues : metricValues).map(comboValues));
64373       utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
64374     }
64375     function comboValues(d2) {
64376       return {
64377         value: formatFloat(d2),
64378         title: formatFloat(d2)
64379       };
64380     }
64381     function change() {
64382       var tag = {};
64383       var value = utilGetSetValue(input).trim();
64384       if (!value && Array.isArray(_tags[field.key]))
64385         return;
64386       if (!value) {
64387         tag[field.key] = void 0;
64388       } else {
64389         var rawValue = likelyRawNumberFormat.test(value) ? parseFloat(value) : parseLocaleFloat(value);
64390         if (isNaN(rawValue))
64391           rawValue = value;
64392         if (isNaN(rawValue) || !_isImperial) {
64393           tag[field.key] = context.cleanTagValue(rawValue);
64394         } else {
64395           tag[field.key] = context.cleanTagValue(rawValue + " mph");
64396         }
64397       }
64398       dispatch14.call("change", this, tag);
64399     }
64400     roadspeed.tags = function(tags) {
64401       _tags = tags;
64402       var rawValue = tags[field.key];
64403       var value = rawValue;
64404       var isMixed = Array.isArray(value);
64405       if (!isMixed) {
64406         if (rawValue && rawValue.indexOf("mph") >= 0) {
64407           _isImperial = true;
64408         } else if (rawValue) {
64409           _isImperial = false;
64410         }
64411         value = parseInt(value, 10);
64412         if (isNaN(value)) {
64413           value = rawValue;
64414         } else {
64415           value = formatFloat(value);
64416         }
64417       }
64418       setUnitSuggestions();
64419       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);
64420     };
64421     roadspeed.focus = function() {
64422       input.node().focus();
64423     };
64424     roadspeed.entityIDs = function(val) {
64425       _entityIDs = val;
64426     };
64427     function combinedEntityExtent() {
64428       return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
64429     }
64430     return utilRebind(roadspeed, dispatch14, "on");
64431   }
64432
64433   // modules/ui/fields/radio.js
64434   function uiFieldRadio(field, context) {
64435     var dispatch14 = dispatch_default("change");
64436     var placeholder = select_default2(null);
64437     var wrap2 = select_default2(null);
64438     var labels = select_default2(null);
64439     var radios = select_default2(null);
64440     var radioData = (field.options || field.keys).slice();
64441     var typeField;
64442     var layerField;
64443     var _oldType = {};
64444     var _entityIDs = [];
64445     function selectedKey() {
64446       var node = wrap2.selectAll(".form-field-input-radio label.active input");
64447       return !node.empty() && node.datum();
64448     }
64449     function radio(selection2) {
64450       selection2.classed("preset-radio", true);
64451       wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
64452       var enter = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-radio");
64453       enter.append("span").attr("class", "placeholder");
64454       wrap2 = wrap2.merge(enter);
64455       placeholder = wrap2.selectAll(".placeholder");
64456       labels = wrap2.selectAll("label").data(radioData);
64457       enter = labels.enter().append("label");
64458       var stringsField = field.resolveReference("stringsCrossReference");
64459       enter.append("input").attr("type", "radio").attr("name", field.id).attr("value", function(d2) {
64460         return stringsField.t("options." + d2, { "default": d2 });
64461       }).attr("checked", false);
64462       enter.append("span").each(function(d2) {
64463         stringsField.t.append("options." + d2, { "default": d2 })(select_default2(this));
64464       });
64465       labels = labels.merge(enter);
64466       radios = labels.selectAll("input").on("change", changeRadio);
64467     }
64468     function structureExtras(selection2, tags) {
64469       var selected = selectedKey() || tags.layer !== void 0;
64470       var type2 = _mainPresetIndex.field(selected);
64471       var layer = _mainPresetIndex.field("layer");
64472       var showLayer = selected === "bridge" || selected === "tunnel" || tags.layer !== void 0;
64473       var extrasWrap = selection2.selectAll(".structure-extras-wrap").data(selected ? [0] : []);
64474       extrasWrap.exit().remove();
64475       extrasWrap = extrasWrap.enter().append("div").attr("class", "structure-extras-wrap").merge(extrasWrap);
64476       var list = extrasWrap.selectAll("ul").data([0]);
64477       list = list.enter().append("ul").attr("class", "rows").merge(list);
64478       if (type2) {
64479         if (!typeField || typeField.id !== selected) {
64480           typeField = uiField(context, type2, _entityIDs, { wrap: false }).on("change", changeType);
64481         }
64482         typeField.tags(tags);
64483       } else {
64484         typeField = null;
64485       }
64486       var typeItem = list.selectAll(".structure-type-item").data(typeField ? [typeField] : [], function(d2) {
64487         return d2.id;
64488       });
64489       typeItem.exit().remove();
64490       var typeEnter = typeItem.enter().insert("li", ":first-child").attr("class", "labeled-input structure-type-item");
64491       typeEnter.append("span").attr("class", "label structure-label-type").attr("for", "preset-input-" + selected).call(_t.append("inspector.radio.structure.type"));
64492       typeEnter.append("div").attr("class", "structure-input-type-wrap");
64493       typeItem = typeItem.merge(typeEnter);
64494       if (typeField) {
64495         typeItem.selectAll(".structure-input-type-wrap").call(typeField.render);
64496       }
64497       if (layer && showLayer) {
64498         if (!layerField) {
64499           layerField = uiField(context, layer, _entityIDs, { wrap: false }).on("change", changeLayer);
64500         }
64501         layerField.tags(tags);
64502         field.keys = utilArrayUnion(field.keys, ["layer"]);
64503       } else {
64504         layerField = null;
64505         field.keys = field.keys.filter(function(k2) {
64506           return k2 !== "layer";
64507         });
64508       }
64509       var layerItem = list.selectAll(".structure-layer-item").data(layerField ? [layerField] : []);
64510       layerItem.exit().remove();
64511       var layerEnter = layerItem.enter().append("li").attr("class", "labeled-input structure-layer-item");
64512       layerEnter.append("span").attr("class", "label structure-label-layer").attr("for", "preset-input-layer").call(_t.append("inspector.radio.structure.layer"));
64513       layerEnter.append("div").attr("class", "structure-input-layer-wrap");
64514       layerItem = layerItem.merge(layerEnter);
64515       if (layerField) {
64516         layerItem.selectAll(".structure-input-layer-wrap").call(layerField.render);
64517       }
64518     }
64519     function changeType(t2, onInput) {
64520       var key = selectedKey();
64521       if (!key)
64522         return;
64523       var val = t2[key];
64524       if (val !== "no") {
64525         _oldType[key] = val;
64526       }
64527       if (field.type === "structureRadio") {
64528         if (val === "no" || key !== "bridge" && key !== "tunnel" || key === "tunnel" && val === "building_passage") {
64529           t2.layer = void 0;
64530         }
64531         if (t2.layer === void 0) {
64532           if (key === "bridge" && val !== "no") {
64533             t2.layer = "1";
64534           }
64535           if (key === "tunnel" && val !== "no" && val !== "building_passage") {
64536             t2.layer = "-1";
64537           }
64538         }
64539       }
64540       dispatch14.call("change", this, t2, onInput);
64541     }
64542     function changeLayer(t2, onInput) {
64543       if (t2.layer === "0") {
64544         t2.layer = void 0;
64545       }
64546       dispatch14.call("change", this, t2, onInput);
64547     }
64548     function changeRadio() {
64549       var t2 = {};
64550       var activeKey;
64551       if (field.key) {
64552         t2[field.key] = void 0;
64553       }
64554       radios.each(function(d2) {
64555         var active = select_default2(this).property("checked");
64556         if (active)
64557           activeKey = d2;
64558         if (field.key) {
64559           if (active)
64560             t2[field.key] = d2;
64561         } else {
64562           var val = _oldType[activeKey] || "yes";
64563           t2[d2] = active ? val : void 0;
64564         }
64565       });
64566       if (field.type === "structureRadio") {
64567         if (activeKey === "bridge") {
64568           t2.layer = "1";
64569         } else if (activeKey === "tunnel" && t2.tunnel !== "building_passage") {
64570           t2.layer = "-1";
64571         } else {
64572           t2.layer = void 0;
64573         }
64574       }
64575       dispatch14.call("change", this, t2);
64576     }
64577     radio.tags = function(tags) {
64578       function isOptionChecked(d2) {
64579         if (field.key) {
64580           return tags[field.key] === d2;
64581         }
64582         return !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
64583       }
64584       function isMixed(d2) {
64585         if (field.key) {
64586           return Array.isArray(tags[field.key]) && tags[field.key].includes(d2);
64587         }
64588         return Array.isArray(tags[d2]);
64589       }
64590       radios.property("checked", function(d2) {
64591         return isOptionChecked(d2) && (field.key || field.options.filter(isOptionChecked).length === 1);
64592       });
64593       labels.classed("active", function(d2) {
64594         if (field.key) {
64595           return Array.isArray(tags[field.key]) && tags[field.key].includes(d2) || tags[field.key] === d2;
64596         }
64597         return Array.isArray(tags[d2]) && tags[d2].some((v2) => typeof v2 === "string" && v2.toLowerCase() !== "no") || !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
64598       }).classed("mixed", isMixed).attr("title", function(d2) {
64599         return isMixed(d2) ? _t("inspector.unshared_value_tooltip") : null;
64600       });
64601       var selection2 = radios.filter(function() {
64602         return this.checked;
64603       });
64604       if (selection2.empty()) {
64605         placeholder.text("");
64606         placeholder.call(_t.append("inspector.none"));
64607       } else {
64608         placeholder.text(selection2.attr("value"));
64609         _oldType[selection2.datum()] = tags[selection2.datum()];
64610       }
64611       if (field.type === "structureRadio") {
64612         if (!!tags.waterway && !_oldType.tunnel) {
64613           _oldType.tunnel = "culvert";
64614         }
64615         wrap2.call(structureExtras, tags);
64616       }
64617     };
64618     radio.focus = function() {
64619       radios.node().focus();
64620     };
64621     radio.entityIDs = function(val) {
64622       if (!arguments.length)
64623         return _entityIDs;
64624       _entityIDs = val;
64625       _oldType = {};
64626       return radio;
64627     };
64628     radio.isAllowed = function() {
64629       return _entityIDs.length === 1;
64630     };
64631     return utilRebind(radio, dispatch14, "on");
64632   }
64633
64634   // modules/ui/fields/restrictions.js
64635   function uiFieldRestrictions(field, context) {
64636     var dispatch14 = dispatch_default("change");
64637     var breathe = behaviorBreathe(context);
64638     corePreferences("turn-restriction-via-way", null);
64639     var storedViaWay = corePreferences("turn-restriction-via-way0");
64640     var storedDistance = corePreferences("turn-restriction-distance");
64641     var _maxViaWay = storedViaWay !== null ? +storedViaWay : 0;
64642     var _maxDistance = storedDistance ? +storedDistance : 30;
64643     var _initialized3 = false;
64644     var _parent = select_default2(null);
64645     var _container = select_default2(null);
64646     var _oldTurns;
64647     var _graph;
64648     var _vertexID;
64649     var _intersection;
64650     var _fromWayID;
64651     var _lastXPos;
64652     function restrictions(selection2) {
64653       _parent = selection2;
64654       if (_vertexID && (context.graph() !== _graph || !_intersection)) {
64655         _graph = context.graph();
64656         _intersection = osmIntersection(_graph, _vertexID, _maxDistance);
64657       }
64658       var isOK = _intersection && _intersection.vertices.length && // has vertices
64659       _intersection.vertices.filter(function(vertex) {
64660         return vertex.id === _vertexID;
64661       }).length && _intersection.ways.length > 2 && // has more than 2 ways
64662       _intersection.ways.filter(function(way) {
64663         return way.__to;
64664       }).length > 1;
64665       select_default2(selection2.node().parentNode).classed("hide", !isOK);
64666       if (!isOK || !context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode || !selection2.node().parentNode.parentNode) {
64667         selection2.call(restrictions.off);
64668         return;
64669       }
64670       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
64671       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
64672       var container = wrap2.selectAll(".restriction-container").data([0]);
64673       var containerEnter = container.enter().append("div").attr("class", "restriction-container");
64674       containerEnter.append("div").attr("class", "restriction-help");
64675       _container = containerEnter.merge(container).call(renderViewer);
64676       var controls = wrap2.selectAll(".restriction-controls").data([0]);
64677       controls.enter().append("div").attr("class", "restriction-controls-container").append("div").attr("class", "restriction-controls").merge(controls).call(renderControls);
64678     }
64679     function renderControls(selection2) {
64680       var distControl = selection2.selectAll(".restriction-distance").data([0]);
64681       distControl.exit().remove();
64682       var distControlEnter = distControl.enter().append("div").attr("class", "restriction-control restriction-distance");
64683       distControlEnter.append("span").attr("class", "restriction-control-label restriction-distance-label").call(_t.append("restriction.controls.distance", { suffix: ":" }));
64684       distControlEnter.append("input").attr("class", "restriction-distance-input").attr("type", "range").attr("min", "20").attr("max", "50").attr("step", "5");
64685       distControlEnter.append("span").attr("class", "restriction-distance-text");
64686       selection2.selectAll(".restriction-distance-input").property("value", _maxDistance).on("input", function() {
64687         var val = select_default2(this).property("value");
64688         _maxDistance = +val;
64689         _intersection = null;
64690         _container.selectAll(".layer-osm .layer-turns *").remove();
64691         corePreferences("turn-restriction-distance", _maxDistance);
64692         _parent.call(restrictions);
64693       });
64694       selection2.selectAll(".restriction-distance-text").call(displayMaxDistance(_maxDistance));
64695       var viaControl = selection2.selectAll(".restriction-via-way").data([0]);
64696       viaControl.exit().remove();
64697       var viaControlEnter = viaControl.enter().append("div").attr("class", "restriction-control restriction-via-way");
64698       viaControlEnter.append("span").attr("class", "restriction-control-label restriction-via-way-label").call(_t.append("restriction.controls.via", { suffix: ":" }));
64699       viaControlEnter.append("input").attr("class", "restriction-via-way-input").attr("type", "range").attr("min", "0").attr("max", "2").attr("step", "1");
64700       viaControlEnter.append("span").attr("class", "restriction-via-way-text");
64701       selection2.selectAll(".restriction-via-way-input").property("value", _maxViaWay).on("input", function() {
64702         var val = select_default2(this).property("value");
64703         _maxViaWay = +val;
64704         _container.selectAll(".layer-osm .layer-turns *").remove();
64705         corePreferences("turn-restriction-via-way0", _maxViaWay);
64706         _parent.call(restrictions);
64707       });
64708       selection2.selectAll(".restriction-via-way-text").call(displayMaxVia(_maxViaWay));
64709     }
64710     function renderViewer(selection2) {
64711       if (!_intersection)
64712         return;
64713       var vgraph = _intersection.graph;
64714       var filter2 = utilFunctor(true);
64715       var projection2 = geoRawMercator();
64716       var sdims = utilGetDimensions(context.container().select(".sidebar"));
64717       var d2 = [sdims[0] - 50, 370];
64718       var c2 = geoVecScale(d2, 0.5);
64719       var z2 = 22;
64720       projection2.scale(geoZoomToScale(z2));
64721       var extent = geoExtent();
64722       for (var i3 = 0; i3 < _intersection.vertices.length; i3++) {
64723         extent._extend(_intersection.vertices[i3].extent());
64724       }
64725       var padTop = 35;
64726       if (_intersection.vertices.length > 1) {
64727         var hPadding = Math.min(160, Math.max(110, d2[0] * 0.4));
64728         var vPadding = 160;
64729         var tl = projection2([extent[0][0], extent[1][1]]);
64730         var br = projection2([extent[1][0], extent[0][1]]);
64731         var hFactor = (br[0] - tl[0]) / (d2[0] - hPadding);
64732         var vFactor = (br[1] - tl[1]) / (d2[1] - vPadding - padTop);
64733         var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
64734         var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
64735         z2 = z2 - Math.max(hZoomDiff, vZoomDiff);
64736         projection2.scale(geoZoomToScale(z2));
64737       }
64738       var extentCenter = projection2(extent.center());
64739       extentCenter[1] = extentCenter[1] - padTop / 2;
64740       projection2.translate(geoVecSubtract(c2, extentCenter)).clipExtent([[0, 0], d2]);
64741       var drawLayers = svgLayers(projection2, context).only(["osm", "touch"]).dimensions(d2);
64742       var drawVertices = svgVertices(projection2, context);
64743       var drawLines = svgLines(projection2, context);
64744       var drawTurns = svgTurns(projection2, context);
64745       var firstTime = selection2.selectAll(".surface").empty();
64746       selection2.call(drawLayers);
64747       var surface = selection2.selectAll(".surface").classed("tr", true);
64748       if (firstTime) {
64749         _initialized3 = true;
64750         surface.call(breathe);
64751       }
64752       if (_fromWayID && !vgraph.hasEntity(_fromWayID)) {
64753         _fromWayID = null;
64754         _oldTurns = null;
64755       }
64756       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));
64757       surface.on("click.restrictions", click).on("mouseover.restrictions", mouseover);
64758       surface.selectAll(".selected").classed("selected", false);
64759       surface.selectAll(".related").classed("related", false);
64760       var way;
64761       if (_fromWayID) {
64762         way = vgraph.entity(_fromWayID);
64763         surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
64764       }
64765       document.addEventListener("resizeWindow", function() {
64766         utilSetDimensions(_container, null);
64767         redraw(1);
64768       }, false);
64769       updateHints(null);
64770       function click(d3_event) {
64771         surface.call(breathe.off).call(breathe);
64772         var datum2 = d3_event.target.__data__;
64773         var entity = datum2 && datum2.properties && datum2.properties.entity;
64774         if (entity) {
64775           datum2 = entity;
64776         }
64777         if (datum2 instanceof osmWay && (datum2.__from || datum2.__via)) {
64778           _fromWayID = datum2.id;
64779           _oldTurns = null;
64780           redraw();
64781         } else if (datum2 instanceof osmTurn) {
64782           var actions, extraActions, turns, i4;
64783           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
64784           if (datum2.restrictionID && !datum2.direct) {
64785             return;
64786           } else if (datum2.restrictionID && !datum2.only) {
64787             var seen = {};
64788             var datumOnly = JSON.parse(JSON.stringify(datum2));
64789             datumOnly.only = true;
64790             restrictionType = restrictionType.replace(/^no/, "only");
64791             turns = _intersection.turns(_fromWayID, 2);
64792             extraActions = [];
64793             _oldTurns = [];
64794             for (i4 = 0; i4 < turns.length; i4++) {
64795               var turn = turns[i4];
64796               if (seen[turn.restrictionID])
64797                 continue;
64798               if (turn.direct && turn.path[1] === datum2.path[1]) {
64799                 seen[turns[i4].restrictionID] = true;
64800                 turn.restrictionType = osmInferRestriction(vgraph, turn, projection2);
64801                 _oldTurns.push(turn);
64802                 extraActions.push(actionUnrestrictTurn(turn));
64803               }
64804             }
64805             actions = _intersection.actions.concat(extraActions, [
64806               actionRestrictTurn(datumOnly, restrictionType),
64807               _t("operations.restriction.annotation.create")
64808             ]);
64809           } else if (datum2.restrictionID) {
64810             turns = _oldTurns || [];
64811             extraActions = [];
64812             for (i4 = 0; i4 < turns.length; i4++) {
64813               if (turns[i4].key !== datum2.key) {
64814                 extraActions.push(actionRestrictTurn(turns[i4], turns[i4].restrictionType));
64815               }
64816             }
64817             _oldTurns = null;
64818             actions = _intersection.actions.concat(extraActions, [
64819               actionUnrestrictTurn(datum2),
64820               _t("operations.restriction.annotation.delete")
64821             ]);
64822           } else {
64823             actions = _intersection.actions.concat([
64824               actionRestrictTurn(datum2, restrictionType),
64825               _t("operations.restriction.annotation.create")
64826             ]);
64827           }
64828           context.perform.apply(context, actions);
64829           var s2 = surface.selectAll("." + datum2.key);
64830           datum2 = s2.empty() ? null : s2.datum();
64831           updateHints(datum2);
64832         } else {
64833           _fromWayID = null;
64834           _oldTurns = null;
64835           redraw();
64836         }
64837       }
64838       function mouseover(d3_event) {
64839         var datum2 = d3_event.target.__data__;
64840         updateHints(datum2);
64841       }
64842       _lastXPos = _lastXPos || sdims[0];
64843       function redraw(minChange) {
64844         var xPos = -1;
64845         if (minChange) {
64846           xPos = utilGetDimensions(context.container().select(".sidebar"))[0];
64847         }
64848         if (!minChange || minChange && Math.abs(xPos - _lastXPos) >= minChange) {
64849           if (context.hasEntity(_vertexID)) {
64850             _lastXPos = xPos;
64851             _container.call(renderViewer);
64852           }
64853         }
64854       }
64855       function highlightPathsFrom(wayID) {
64856         surface.selectAll(".related").classed("related", false).classed("allow", false).classed("restrict", false).classed("only", false);
64857         surface.selectAll("." + wayID).classed("related", true);
64858         if (wayID) {
64859           var turns = _intersection.turns(wayID, _maxViaWay);
64860           for (var i4 = 0; i4 < turns.length; i4++) {
64861             var turn = turns[i4];
64862             var ids = [turn.to.way];
64863             var klass = turn.no ? "restrict" : turn.only ? "only" : "allow";
64864             if (turn.only || turns.length === 1) {
64865               if (turn.via.ways) {
64866                 ids = ids.concat(turn.via.ways);
64867               }
64868             } else if (turn.to.way === wayID) {
64869               continue;
64870             }
64871             surface.selectAll(utilEntitySelector(ids)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
64872           }
64873         }
64874       }
64875       function updateHints(datum2) {
64876         var help = _container.selectAll(".restriction-help").html("");
64877         var placeholders = {};
64878         ["from", "via", "to"].forEach(function(k2) {
64879           placeholders[k2] = { html: '<span class="qualifier">' + _t("restriction.help." + k2) + "</span>" };
64880         });
64881         var entity = datum2 && datum2.properties && datum2.properties.entity;
64882         if (entity) {
64883           datum2 = entity;
64884         }
64885         if (_fromWayID) {
64886           way = vgraph.entity(_fromWayID);
64887           surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
64888         }
64889         if (datum2 instanceof osmWay && datum2.__from) {
64890           way = datum2;
64891           highlightPathsFrom(_fromWayID ? null : way.id);
64892           surface.selectAll("." + way.id).classed("related", true);
64893           var clickSelect = !_fromWayID || _fromWayID !== way.id;
64894           help.append("div").html(_t.html("restriction.help." + (clickSelect ? "select_from_name" : "from_name"), {
64895             from: placeholders.from,
64896             fromName: displayName(way.id, vgraph)
64897           }));
64898         } else if (datum2 instanceof osmTurn) {
64899           var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
64900           var turnType = restrictionType.replace(/^(only|no)\_/, "");
64901           var indirect = datum2.direct === false ? _t.html("restriction.help.indirect") : "";
64902           var klass, turnText, nextText;
64903           if (datum2.no) {
64904             klass = "restrict";
64905             turnText = _t.html("restriction.help.turn.no_" + turnType, { indirect: { html: indirect } });
64906             nextText = _t.html("restriction.help.turn.only_" + turnType, { indirect: "" });
64907           } else if (datum2.only) {
64908             klass = "only";
64909             turnText = _t.html("restriction.help.turn.only_" + turnType, { indirect: { html: indirect } });
64910             nextText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: "" });
64911           } else {
64912             klass = "allow";
64913             turnText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: { html: indirect } });
64914             nextText = _t.html("restriction.help.turn.no_" + turnType, { indirect: "" });
64915           }
64916           help.append("div").attr("class", "qualifier " + klass).html(turnText);
64917           help.append("div").html(_t.html("restriction.help.from_name_to_name", {
64918             from: placeholders.from,
64919             fromName: displayName(datum2.from.way, vgraph),
64920             to: placeholders.to,
64921             toName: displayName(datum2.to.way, vgraph)
64922           }));
64923           if (datum2.via.ways && datum2.via.ways.length) {
64924             var names = [];
64925             for (var i4 = 0; i4 < datum2.via.ways.length; i4++) {
64926               var prev = names[names.length - 1];
64927               var curr = displayName(datum2.via.ways[i4], vgraph);
64928               if (!prev || curr !== prev) {
64929                 names.push(curr);
64930               }
64931             }
64932             help.append("div").html(_t.html("restriction.help.via_names", {
64933               via: placeholders.via,
64934               viaNames: names.join(", ")
64935             }));
64936           }
64937           if (!indirect) {
64938             help.append("div").html(_t.html("restriction.help.toggle", { turn: { html: nextText.trim() } }));
64939           }
64940           highlightPathsFrom(null);
64941           var alongIDs = datum2.path.slice();
64942           surface.selectAll(utilEntitySelector(alongIDs)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
64943         } else {
64944           highlightPathsFrom(null);
64945           if (_fromWayID) {
64946             help.append("div").html(_t.html("restriction.help.from_name", {
64947               from: placeholders.from,
64948               fromName: displayName(_fromWayID, vgraph)
64949             }));
64950           } else {
64951             help.append("div").html(_t.html("restriction.help.select_from", {
64952               from: placeholders.from
64953             }));
64954           }
64955         }
64956       }
64957     }
64958     function displayMaxDistance(maxDist) {
64959       return (selection2) => {
64960         var isImperial = !_mainLocalizer.usesMetric();
64961         var opts;
64962         if (isImperial) {
64963           var distToFeet = {
64964             // imprecise conversion for prettier display
64965             20: 70,
64966             25: 85,
64967             30: 100,
64968             35: 115,
64969             40: 130,
64970             45: 145,
64971             50: 160
64972           }[maxDist];
64973           opts = { distance: _t("units.feet", { quantity: distToFeet }) };
64974         } else {
64975           opts = { distance: _t("units.meters", { quantity: maxDist }) };
64976         }
64977         return selection2.html("").call(_t.append("restriction.controls.distance_up_to", opts));
64978       };
64979     }
64980     function displayMaxVia(maxVia) {
64981       return (selection2) => {
64982         selection2 = selection2.html("");
64983         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"));
64984       };
64985     }
64986     function displayName(entityID, graph) {
64987       var entity = graph.entity(entityID);
64988       var name = utilDisplayName(entity) || "";
64989       var matched = _mainPresetIndex.match(entity, graph);
64990       var type2 = matched && matched.name() || utilDisplayType(entity.id);
64991       return name || type2;
64992     }
64993     restrictions.entityIDs = function(val) {
64994       _intersection = null;
64995       _fromWayID = null;
64996       _oldTurns = null;
64997       _vertexID = val[0];
64998     };
64999     restrictions.tags = function() {
65000     };
65001     restrictions.focus = function() {
65002     };
65003     restrictions.off = function(selection2) {
65004       if (!_initialized3)
65005         return;
65006       selection2.selectAll(".surface").call(breathe.off).on("click.restrictions", null).on("mouseover.restrictions", null);
65007       select_default2(window).on("resize.restrictions", null);
65008     };
65009     return utilRebind(restrictions, dispatch14, "on");
65010   }
65011   uiFieldRestrictions.supportsMultiselection = false;
65012
65013   // modules/ui/fields/textarea.js
65014   function uiFieldTextarea(field, context) {
65015     var dispatch14 = dispatch_default("change");
65016     var input = select_default2(null);
65017     var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue()).silent(field.usage === "changeset" && field.key === "comment");
65018     var _tags;
65019     function textarea(selection2) {
65020       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
65021       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).style("position", "relative").merge(wrap2);
65022       input = wrap2.selectAll("textarea").data([0]);
65023       input = input.enter().append("textarea").attr("id", field.domId).call(utilNoAuto).on("input", change(true)).on("blur", change()).on("change", change()).merge(input);
65024       wrap2.call(_lengthIndicator);
65025       function change(onInput) {
65026         return function() {
65027           var val = utilGetSetValue(input);
65028           if (!onInput)
65029             val = context.cleanTagValue(val);
65030           if (!val && Array.isArray(_tags[field.key]))
65031             return;
65032           var t2 = {};
65033           t2[field.key] = val || void 0;
65034           dispatch14.call("change", this, t2, onInput);
65035         };
65036       }
65037     }
65038     textarea.tags = function(tags) {
65039       _tags = tags;
65040       var isMixed = Array.isArray(tags[field.key]);
65041       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);
65042       if (!isMixed) {
65043         _lengthIndicator.update(tags[field.key]);
65044       }
65045     };
65046     textarea.focus = function() {
65047       input.node().focus();
65048     };
65049     return utilRebind(textarea, dispatch14, "on");
65050   }
65051
65052   // modules/ui/fields/wikidata.js
65053   function uiFieldWikidata(field, context) {
65054     var wikidata = services.wikidata;
65055     var dispatch14 = dispatch_default("change");
65056     var _selection = select_default2(null);
65057     var _searchInput = select_default2(null);
65058     var _qid = null;
65059     var _wikidataEntity = null;
65060     var _wikiURL = "";
65061     var _entityIDs = [];
65062     var _wikipediaKey = field.keys && field.keys.find(function(key) {
65063       return key.includes("wikipedia");
65064     });
65065     var _hintKey = field.key === "wikidata" ? "name" : field.key.split(":")[0];
65066     var combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(true).minItems(1);
65067     function wiki(selection2) {
65068       _selection = selection2;
65069       var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
65070       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
65071       var list = wrap2.selectAll("ul").data([0]);
65072       list = list.enter().append("ul").attr("class", "rows").merge(list);
65073       var searchRow = list.selectAll("li.wikidata-search").data([0]);
65074       var searchRowEnter = searchRow.enter().append("li").attr("class", "wikidata-search");
65075       searchRowEnter.append("input").attr("type", "text").attr("id", field.domId).style("flex", "1").call(utilNoAuto).on("focus", function() {
65076         var node = select_default2(this).node();
65077         node.setSelectionRange(0, node.value.length);
65078       }).on("blur", function() {
65079         setLabelForEntity();
65080       }).call(combobox.fetcher(fetchWikidataItems));
65081       combobox.on("accept", function(d2) {
65082         if (d2) {
65083           _qid = d2.id;
65084           change();
65085         }
65086       }).on("cancel", function() {
65087         setLabelForEntity();
65088       });
65089       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) {
65090         d3_event.preventDefault();
65091         if (_wikiURL)
65092           window.open(_wikiURL, "_blank");
65093       });
65094       searchRow = searchRow.merge(searchRowEnter);
65095       _searchInput = searchRow.select("input");
65096       var wikidataProperties = ["description", "identifier"];
65097       var items = list.selectAll("li.labeled-input").data(wikidataProperties);
65098       var enter = items.enter().append("li").attr("class", function(d2) {
65099         return "labeled-input preset-wikidata-" + d2;
65100       });
65101       enter.append("span").attr("class", "label").html(function(d2) {
65102         return _t.html("wikidata." + d2);
65103       });
65104       enter.append("input").attr("type", "text").call(utilNoAuto).classed("disabled", "true").attr("readonly", "true");
65105       enter.append("button").attr("class", "form-field-button").attr("title", _t("icons.copy")).call(svgIcon("#iD-operation-copy")).on("click", function(d3_event) {
65106         d3_event.preventDefault();
65107         select_default2(this.parentNode).select("input").node().select();
65108         document.execCommand("copy");
65109       });
65110     }
65111     function fetchWikidataItems(q2, callback) {
65112       if (!q2 && _hintKey) {
65113         for (var i3 in _entityIDs) {
65114           var entity = context.hasEntity(_entityIDs[i3]);
65115           if (entity.tags[_hintKey]) {
65116             q2 = entity.tags[_hintKey];
65117             break;
65118           }
65119         }
65120       }
65121       wikidata.itemsForSearchQuery(q2, function(err, data) {
65122         if (err) {
65123           if (err !== "No query")
65124             console.error(err);
65125           return;
65126         }
65127         var result = data.map(function(item) {
65128           return {
65129             id: item.id,
65130             value: item.display.label.value + " (" + item.id + ")",
65131             display: (selection2) => selection2.append("span").attr("class", "localized-text").attr("lang", item.display.label.language).text(item.display.label.value),
65132             title: item.display.description && item.display.description.value,
65133             terms: item.aliases
65134           };
65135         });
65136         if (callback)
65137           callback(result);
65138       });
65139     }
65140     function change() {
65141       var syncTags = {};
65142       syncTags[field.key] = _qid;
65143       dispatch14.call("change", this, syncTags);
65144       var initGraph = context.graph();
65145       var initEntityIDs = _entityIDs;
65146       wikidata.entityByQID(_qid, function(err, entity) {
65147         if (err)
65148           return;
65149         if (context.graph() !== initGraph)
65150           return;
65151         if (!entity.sitelinks)
65152           return;
65153         var langs = wikidata.languagesToQuery();
65154         ["labels", "descriptions"].forEach(function(key) {
65155           if (!entity[key])
65156             return;
65157           var valueLangs = Object.keys(entity[key]);
65158           if (valueLangs.length === 0)
65159             return;
65160           var valueLang = valueLangs[0];
65161           if (langs.indexOf(valueLang) === -1) {
65162             langs.push(valueLang);
65163           }
65164         });
65165         var newWikipediaValue;
65166         if (_wikipediaKey) {
65167           var foundPreferred;
65168           for (var i3 in langs) {
65169             var lang = langs[i3];
65170             var siteID = lang.replace("-", "_") + "wiki";
65171             if (entity.sitelinks[siteID]) {
65172               foundPreferred = true;
65173               newWikipediaValue = lang + ":" + entity.sitelinks[siteID].title;
65174               break;
65175             }
65176           }
65177           if (!foundPreferred) {
65178             var wikiSiteKeys = Object.keys(entity.sitelinks).filter(function(site) {
65179               return site.endsWith("wiki");
65180             });
65181             if (wikiSiteKeys.length === 0) {
65182               newWikipediaValue = null;
65183             } else {
65184               var wikiLang = wikiSiteKeys[0].slice(0, -4).replace("_", "-");
65185               var wikiTitle = entity.sitelinks[wikiSiteKeys[0]].title;
65186               newWikipediaValue = wikiLang + ":" + wikiTitle;
65187             }
65188           }
65189         }
65190         if (newWikipediaValue) {
65191           newWikipediaValue = context.cleanTagValue(newWikipediaValue);
65192         }
65193         if (typeof newWikipediaValue === "undefined")
65194           return;
65195         var actions = initEntityIDs.map(function(entityID) {
65196           var entity2 = context.hasEntity(entityID);
65197           if (!entity2)
65198             return null;
65199           var currTags = Object.assign({}, entity2.tags);
65200           if (newWikipediaValue === null) {
65201             if (!currTags[_wikipediaKey])
65202               return null;
65203             delete currTags[_wikipediaKey];
65204           } else {
65205             currTags[_wikipediaKey] = newWikipediaValue;
65206           }
65207           return actionChangeTags(entityID, currTags);
65208         }).filter(Boolean);
65209         if (!actions.length)
65210           return;
65211         context.overwrite(
65212           function actionUpdateWikipediaTags(graph) {
65213             actions.forEach(function(action) {
65214               graph = action(graph);
65215             });
65216             return graph;
65217           },
65218           context.history().undoAnnotation()
65219         );
65220       });
65221     }
65222     function setLabelForEntity() {
65223       var label = "";
65224       if (_wikidataEntity) {
65225         label = entityPropertyForDisplay(_wikidataEntity, "labels");
65226         if (label.length === 0) {
65227           label = _wikidataEntity.id.toString();
65228         }
65229       }
65230       utilGetSetValue(_searchInput, label);
65231     }
65232     wiki.tags = function(tags) {
65233       var isMixed = Array.isArray(tags[field.key]);
65234       _searchInput.attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : "").classed("mixed", isMixed);
65235       _qid = typeof tags[field.key] === "string" && tags[field.key] || "";
65236       if (!/^Q[0-9]*$/.test(_qid)) {
65237         unrecognized();
65238         return;
65239       }
65240       _wikiURL = "https://wikidata.org/wiki/" + _qid;
65241       wikidata.entityByQID(_qid, function(err, entity) {
65242         if (err) {
65243           unrecognized();
65244           return;
65245         }
65246         _wikidataEntity = entity;
65247         setLabelForEntity();
65248         var description = entityPropertyForDisplay(entity, "descriptions");
65249         _selection.select("button.wiki-link").classed("disabled", false);
65250         _selection.select(".preset-wikidata-description").style("display", function() {
65251           return description.length > 0 ? "flex" : "none";
65252         }).select("input").attr("value", description);
65253         _selection.select(".preset-wikidata-identifier").style("display", function() {
65254           return entity.id ? "flex" : "none";
65255         }).select("input").attr("value", entity.id);
65256       });
65257       function unrecognized() {
65258         _wikidataEntity = null;
65259         setLabelForEntity();
65260         _selection.select(".preset-wikidata-description").style("display", "none");
65261         _selection.select(".preset-wikidata-identifier").style("display", "none");
65262         _selection.select("button.wiki-link").classed("disabled", true);
65263         if (_qid && _qid !== "") {
65264           _wikiURL = "https://wikidata.org/wiki/Special:Search?search=" + _qid;
65265         } else {
65266           _wikiURL = "";
65267         }
65268       }
65269     };
65270     function entityPropertyForDisplay(wikidataEntity, propKey) {
65271       if (!wikidataEntity[propKey])
65272         return "";
65273       var propObj = wikidataEntity[propKey];
65274       var langKeys = Object.keys(propObj);
65275       if (langKeys.length === 0)
65276         return "";
65277       var langs = wikidata.languagesToQuery();
65278       for (var i3 in langs) {
65279         var lang = langs[i3];
65280         var valueObj = propObj[lang];
65281         if (valueObj && valueObj.value && valueObj.value.length > 0)
65282           return valueObj.value;
65283       }
65284       return propObj[langKeys[0]].value;
65285     }
65286     wiki.entityIDs = function(val) {
65287       if (!arguments.length)
65288         return _entityIDs;
65289       _entityIDs = val;
65290       return wiki;
65291     };
65292     wiki.focus = function() {
65293       _searchInput.node().focus();
65294     };
65295     return utilRebind(wiki, dispatch14, "on");
65296   }
65297
65298   // modules/ui/fields/wikipedia.js
65299   function uiFieldWikipedia(field, context) {
65300     const dispatch14 = dispatch_default("change");
65301     const wikipedia = services.wikipedia;
65302     const wikidata = services.wikidata;
65303     let _langInput = select_default2(null);
65304     let _titleInput = select_default2(null);
65305     let _wikiURL = "";
65306     let _entityIDs;
65307     let _tags;
65308     let _dataWikipedia = [];
65309     _mainFileFetcher.get("wmf_sitematrix").then((d2) => {
65310       _dataWikipedia = d2;
65311       if (_tags)
65312         updateForTags(_tags);
65313     }).catch(() => {
65314     });
65315     const langCombo = uiCombobox(context, "wikipedia-lang").fetcher((value, callback) => {
65316       const v2 = value.toLowerCase();
65317       callback(
65318         _dataWikipedia.filter((d2) => {
65319           return d2[0].toLowerCase().indexOf(v2) >= 0 || d2[1].toLowerCase().indexOf(v2) >= 0 || d2[2].toLowerCase().indexOf(v2) >= 0;
65320         }).map((d2) => ({ value: d2[1] }))
65321       );
65322     });
65323     const titleCombo = uiCombobox(context, "wikipedia-title").fetcher((value, callback) => {
65324       if (!value) {
65325         value = "";
65326         for (let i3 in _entityIDs) {
65327           let entity = context.hasEntity(_entityIDs[i3]);
65328           if (entity.tags.name) {
65329             value = entity.tags.name;
65330             break;
65331           }
65332         }
65333       }
65334       const searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions;
65335       searchfn(language()[2], value, (query, data) => {
65336         callback(data.map((d2) => ({ value: d2 })));
65337       });
65338     });
65339     function wiki(selection2) {
65340       let wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
65341       wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-".concat(field.type)).merge(wrap2);
65342       let langContainer = wrap2.selectAll(".wiki-lang-container").data([0]);
65343       langContainer = langContainer.enter().append("div").attr("class", "wiki-lang-container").merge(langContainer);
65344       _langInput = langContainer.selectAll("input.wiki-lang").data([0]);
65345       _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);
65346       _langInput.on("blur", changeLang).on("change", changeLang);
65347       let titleContainer = wrap2.selectAll(".wiki-title-container").data([0]);
65348       titleContainer = titleContainer.enter().append("div").attr("class", "wiki-title-container").merge(titleContainer);
65349       _titleInput = titleContainer.selectAll("input.wiki-title").data([0]);
65350       _titleInput = _titleInput.enter().append("input").attr("type", "text").attr("class", "wiki-title").attr("id", field.domId).call(utilNoAuto).call(titleCombo).merge(_titleInput);
65351       _titleInput.on("blur", function() {
65352         change(true);
65353       }).on("change", function() {
65354         change(false);
65355       });
65356       let link2 = titleContainer.selectAll(".wiki-link").data([0]);
65357       link2 = link2.enter().append("button").attr("class", "form-field-button wiki-link").attr("title", _t("icons.view_on", { domain: "wikipedia.org" })).call(svgIcon("#iD-icon-out-link")).merge(link2);
65358       link2.on("click", (d3_event) => {
65359         d3_event.preventDefault();
65360         if (_wikiURL)
65361           window.open(_wikiURL, "_blank");
65362       });
65363     }
65364     function defaultLanguageInfo(skipEnglishFallback) {
65365       const langCode = _mainLocalizer.languageCode().toLowerCase();
65366       for (let i3 in _dataWikipedia) {
65367         let d2 = _dataWikipedia[i3];
65368         if (d2[2] === langCode)
65369           return d2;
65370       }
65371       return skipEnglishFallback ? ["", "", ""] : ["English", "English", "en"];
65372     }
65373     function language(skipEnglishFallback) {
65374       const value = utilGetSetValue(_langInput).toLowerCase();
65375       for (let i3 in _dataWikipedia) {
65376         let d2 = _dataWikipedia[i3];
65377         if (d2[0].toLowerCase() === value || d2[1].toLowerCase() === value || d2[2] === value)
65378           return d2;
65379       }
65380       return defaultLanguageInfo(skipEnglishFallback);
65381     }
65382     function changeLang() {
65383       utilGetSetValue(_langInput, language()[1]);
65384       change(true);
65385     }
65386     function change(skipWikidata) {
65387       let value = utilGetSetValue(_titleInput);
65388       const m2 = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/);
65389       const langInfo = m2 && _dataWikipedia.find((d2) => m2[1] === d2[2]);
65390       let syncTags = {};
65391       if (langInfo) {
65392         const nativeLangName = langInfo[1];
65393         value = decodeURIComponent(m2[2]).replace(/_/g, " ");
65394         if (m2[3]) {
65395           let anchor;
65396           anchor = decodeURIComponent(m2[3]);
65397           value += "#" + anchor.replace(/_/g, " ");
65398         }
65399         value = value.slice(0, 1).toUpperCase() + value.slice(1);
65400         utilGetSetValue(_langInput, nativeLangName);
65401         utilGetSetValue(_titleInput, value);
65402       }
65403       if (value) {
65404         syncTags.wikipedia = context.cleanTagValue(language()[2] + ":" + value);
65405       } else {
65406         syncTags.wikipedia = void 0;
65407       }
65408       dispatch14.call("change", this, syncTags);
65409       if (skipWikidata || !value || !language()[2])
65410         return;
65411       const initGraph = context.graph();
65412       const initEntityIDs = _entityIDs;
65413       wikidata.itemsByTitle(language()[2], value, (err, data) => {
65414         if (err || !data || !Object.keys(data).length)
65415           return;
65416         if (context.graph() !== initGraph)
65417           return;
65418         const qids = Object.keys(data);
65419         const value2 = qids && qids.find((id2) => id2.match(/^Q\d+$/));
65420         let actions = initEntityIDs.map((entityID) => {
65421           let entity = context.entity(entityID).tags;
65422           let currTags = Object.assign({}, entity);
65423           if (currTags.wikidata !== value2) {
65424             currTags.wikidata = value2;
65425             return actionChangeTags(entityID, currTags);
65426           }
65427           return null;
65428         }).filter(Boolean);
65429         if (!actions.length)
65430           return;
65431         context.overwrite(
65432           function actionUpdateWikidataTags(graph) {
65433             actions.forEach(function(action) {
65434               graph = action(graph);
65435             });
65436             return graph;
65437           },
65438           context.history().undoAnnotation()
65439         );
65440       });
65441     }
65442     wiki.tags = (tags) => {
65443       _tags = tags;
65444       updateForTags(tags);
65445     };
65446     function updateForTags(tags) {
65447       const value = typeof tags[field.key] === "string" ? tags[field.key] : "";
65448       const m2 = value.match(/([^:]+):([^#]+)(?:#(.+))?/);
65449       const tagLang = m2 && m2[1];
65450       const tagArticleTitle = m2 && m2[2];
65451       let anchor = m2 && m2[3];
65452       const tagLangInfo = tagLang && _dataWikipedia.find((d2) => tagLang === d2[2]);
65453       if (tagLangInfo) {
65454         const nativeLangName = tagLangInfo[1];
65455         utilGetSetValue(_langInput, nativeLangName);
65456         utilGetSetValue(_titleInput, tagArticleTitle + (anchor ? "#" + anchor : ""));
65457         if (anchor) {
65458           try {
65459             anchor = encodeURIComponent(anchor.replace(/ /g, "_")).replace(/%/g, ".");
65460           } catch (e3) {
65461             anchor = anchor.replace(/ /g, "_");
65462           }
65463         }
65464         _wikiURL = "https://" + tagLang + ".wikipedia.org/wiki/" + tagArticleTitle.replace(/ /g, "_") + (anchor ? "#" + anchor : "");
65465       } else {
65466         utilGetSetValue(_titleInput, value);
65467         if (value && value !== "") {
65468           utilGetSetValue(_langInput, "");
65469           const defaultLangInfo = defaultLanguageInfo();
65470           _wikiURL = "https://".concat(defaultLangInfo[2], ".wikipedia.org/w/index.php?fulltext=1&search=").concat(value);
65471         } else {
65472           const shownOrDefaultLangInfo = language(
65473             true
65474             /* skipEnglishFallback */
65475           );
65476           utilGetSetValue(_langInput, shownOrDefaultLangInfo[1]);
65477           _wikiURL = "";
65478         }
65479       }
65480     }
65481     wiki.entityIDs = (val) => {
65482       if (!arguments.length)
65483         return _entityIDs;
65484       _entityIDs = val;
65485       return wiki;
65486     };
65487     wiki.focus = () => {
65488       _titleInput.node().focus();
65489     };
65490     return utilRebind(wiki, dispatch14, "on");
65491   }
65492   uiFieldWikipedia.supportsMultiselection = false;
65493
65494   // modules/ui/fields/index.js
65495   var uiFields = {
65496     access: uiFieldAccess,
65497     address: uiFieldAddress,
65498     check: uiFieldCheck,
65499     colour: uiFieldText,
65500     combo: uiFieldCombo,
65501     cycleway: uiFieldDirectionalCombo,
65502     date: uiFieldText,
65503     defaultCheck: uiFieldCheck,
65504     directionalCombo: uiFieldDirectionalCombo,
65505     email: uiFieldText,
65506     identifier: uiFieldText,
65507     lanes: uiFieldLanes,
65508     localized: uiFieldLocalized,
65509     roadheight: uiFieldRoadheight,
65510     roadspeed: uiFieldRoadspeed,
65511     manyCombo: uiFieldCombo,
65512     multiCombo: uiFieldCombo,
65513     networkCombo: uiFieldCombo,
65514     number: uiFieldText,
65515     onewayCheck: uiFieldCheck,
65516     radio: uiFieldRadio,
65517     restrictions: uiFieldRestrictions,
65518     semiCombo: uiFieldCombo,
65519     structureRadio: uiFieldRadio,
65520     tel: uiFieldText,
65521     text: uiFieldText,
65522     textarea: uiFieldTextarea,
65523     typeCombo: uiFieldCombo,
65524     url: uiFieldText,
65525     wikidata: uiFieldWikidata,
65526     wikipedia: uiFieldWikipedia
65527   };
65528
65529   // modules/ui/field.js
65530   function uiField(context, presetField2, entityIDs, options2) {
65531     options2 = Object.assign({
65532       show: true,
65533       wrap: true,
65534       remove: true,
65535       revert: true,
65536       info: true
65537     }, options2);
65538     var dispatch14 = dispatch_default("change", "revert");
65539     var field = Object.assign({}, presetField2);
65540     field.domId = utilUniqueDomId("form-field-" + field.safeid);
65541     var _show = options2.show;
65542     var _state = "";
65543     var _tags = {};
65544     var _entityExtent;
65545     if (entityIDs && entityIDs.length) {
65546       _entityExtent = entityIDs.reduce(function(extent, entityID) {
65547         var entity = context.graph().entity(entityID);
65548         return extent.extend(entity.extent(context.graph()));
65549       }, geoExtent());
65550     }
65551     var _locked = false;
65552     var _lockedTip = uiTooltip().title(() => _t.append("inspector.lock.suggestion", { label: field.title })).placement("bottom");
65553     if (_show && !field.impl) {
65554       createField();
65555     }
65556     function createField() {
65557       field.impl = uiFields[field.type](field, context).on("change", function(t2, onInput) {
65558         dispatch14.call("change", field, t2, onInput);
65559       });
65560       if (entityIDs) {
65561         field.entityIDs = entityIDs;
65562         if (field.impl.entityIDs) {
65563           field.impl.entityIDs(entityIDs);
65564         }
65565       }
65566     }
65567     function allKeys() {
65568       let keys2 = field.keys || [field.key];
65569       if (field.type === "directionalCombo" && field.key) {
65570         keys2 = keys2.concat(field.key);
65571       }
65572       return keys2;
65573     }
65574     function isModified() {
65575       if (!entityIDs || !entityIDs.length)
65576         return false;
65577       return entityIDs.some(function(entityID) {
65578         var original = context.graph().base().entities[entityID];
65579         var latest = context.graph().entity(entityID);
65580         return allKeys().some(function(key) {
65581           return original ? latest.tags[key] !== original.tags[key] : latest.tags[key];
65582         });
65583       });
65584     }
65585     function tagsContainFieldKey() {
65586       return allKeys().some(function(key) {
65587         if (field.type === "multiCombo") {
65588           for (var tagKey in _tags) {
65589             if (tagKey.indexOf(key) === 0) {
65590               return true;
65591             }
65592           }
65593           return false;
65594         }
65595         return _tags[key] !== void 0;
65596       });
65597     }
65598     function revert(d3_event, d2) {
65599       d3_event.stopPropagation();
65600       d3_event.preventDefault();
65601       if (!entityIDs || _locked)
65602         return;
65603       dispatch14.call("revert", d2, allKeys());
65604     }
65605     function remove2(d3_event, d2) {
65606       d3_event.stopPropagation();
65607       d3_event.preventDefault();
65608       if (_locked)
65609         return;
65610       var t2 = {};
65611       allKeys().forEach(function(key) {
65612         t2[key] = void 0;
65613       });
65614       dispatch14.call("change", d2, t2);
65615     }
65616     field.render = function(selection2) {
65617       var container = selection2.selectAll(".form-field").data([field]);
65618       var enter = container.enter().append("div").attr("class", function(d2) {
65619         return "form-field form-field-" + d2.safeid;
65620       }).classed("nowrap", !options2.wrap);
65621       if (options2.wrap) {
65622         var labelEnter = enter.append("label").attr("class", "field-label").attr("for", function(d2) {
65623           return d2.domId;
65624         });
65625         var textEnter = labelEnter.append("span").attr("class", "label-text");
65626         textEnter.append("span").attr("class", "label-textvalue").each(function(d2) {
65627           d2.label()(select_default2(this));
65628         });
65629         textEnter.append("span").attr("class", "label-textannotation");
65630         if (options2.remove) {
65631           labelEnter.append("button").attr("class", "remove-icon").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
65632         }
65633         if (options2.revert) {
65634           labelEnter.append("button").attr("class", "modified-icon").attr("title", _t("icons.undo")).call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo"));
65635         }
65636       }
65637       container = container.merge(enter);
65638       container.select(".field-label > .remove-icon").on("click", remove2);
65639       container.select(".field-label > .modified-icon").on("click", revert);
65640       container.each(function(d2) {
65641         var selection3 = select_default2(this);
65642         if (!d2.impl) {
65643           createField();
65644         }
65645         var reference, help;
65646         if (options2.wrap && field.type === "restrictions") {
65647           help = uiFieldHelp(context, "restrictions");
65648         }
65649         if (options2.wrap && options2.info) {
65650           var referenceKey = d2.key || "";
65651           if (d2.type === "multiCombo") {
65652             referenceKey = referenceKey.replace(/:$/, "");
65653           }
65654           var referenceOptions = d2.reference || {
65655             key: referenceKey,
65656             value: _tags[referenceKey]
65657           };
65658           reference = uiTagReference(referenceOptions, context);
65659           if (_state === "hover") {
65660             reference.showing(false);
65661           }
65662         }
65663         selection3.call(d2.impl);
65664         if (help) {
65665           selection3.call(help.body).select(".field-label").call(help.button);
65666         }
65667         if (reference) {
65668           selection3.call(reference.body).select(".field-label").call(reference.button);
65669         }
65670         d2.impl.tags(_tags);
65671       });
65672       container.classed("locked", _locked).classed("modified", isModified()).classed("present", tagsContainFieldKey());
65673       var annotation = container.selectAll(".field-label .label-textannotation");
65674       var icon2 = annotation.selectAll(".icon").data(_locked ? [0] : []);
65675       icon2.exit().remove();
65676       icon2.enter().append("svg").attr("class", "icon").append("use").attr("xlink:href", "#fas-lock");
65677       container.call(_locked ? _lockedTip : _lockedTip.destroy);
65678     };
65679     field.state = function(val) {
65680       if (!arguments.length)
65681         return _state;
65682       _state = val;
65683       return field;
65684     };
65685     field.tags = function(val) {
65686       if (!arguments.length)
65687         return _tags;
65688       _tags = val;
65689       if (tagsContainFieldKey() && !_show) {
65690         _show = true;
65691         if (!field.impl) {
65692           createField();
65693         }
65694       }
65695       return field;
65696     };
65697     field.locked = function(val) {
65698       if (!arguments.length)
65699         return _locked;
65700       _locked = val;
65701       return field;
65702     };
65703     field.show = function() {
65704       _show = true;
65705       if (!field.impl) {
65706         createField();
65707       }
65708       if (field.default && field.key && _tags[field.key] !== field.default) {
65709         var t2 = {};
65710         t2[field.key] = field.default;
65711         dispatch14.call("change", this, t2);
65712       }
65713     };
65714     field.isShown = function() {
65715       return _show;
65716     };
65717     field.isAllowed = function() {
65718       if (entityIDs && entityIDs.length > 1 && uiFields[field.type].supportsMultiselection === false)
65719         return false;
65720       if (field.geometry && !entityIDs.every(function(entityID) {
65721         return field.matchGeometry(context.graph().geometry(entityID));
65722       }))
65723         return false;
65724       if (entityIDs && _entityExtent && field.locationSetID) {
65725         var validHere = _sharedLocationManager.locationSetsAt(_entityExtent.center());
65726         if (!validHere[field.locationSetID])
65727           return false;
65728       }
65729       var prerequisiteTag = field.prerequisiteTag;
65730       if (entityIDs && !tagsContainFieldKey() && // ignore tagging prerequisites if a value is already present
65731       prerequisiteTag) {
65732         if (!entityIDs.every(function(entityID) {
65733           var entity = context.graph().entity(entityID);
65734           if (prerequisiteTag.key) {
65735             var value = entity.tags[prerequisiteTag.key];
65736             if (!value)
65737               return false;
65738             if (prerequisiteTag.valueNot) {
65739               return prerequisiteTag.valueNot !== value;
65740             }
65741             if (prerequisiteTag.value) {
65742               return prerequisiteTag.value === value;
65743             }
65744           } else if (prerequisiteTag.keyNot) {
65745             if (entity.tags[prerequisiteTag.keyNot])
65746               return false;
65747           }
65748           return true;
65749         }))
65750           return false;
65751       }
65752       return true;
65753     };
65754     field.focus = function() {
65755       if (field.impl) {
65756         field.impl.focus();
65757       }
65758     };
65759     return utilRebind(field, dispatch14, "on");
65760   }
65761
65762   // modules/ui/form_fields.js
65763   function uiFormFields(context) {
65764     var moreCombo = uiCombobox(context, "more-fields").minItems(1);
65765     var _fieldsArr = [];
65766     var _lastPlaceholder = "";
65767     var _state = "";
65768     var _klass = "";
65769     function formFields(selection2) {
65770       var allowedFields = _fieldsArr.filter(function(field) {
65771         return field.isAllowed();
65772       });
65773       var shown = allowedFields.filter(function(field) {
65774         return field.isShown();
65775       });
65776       var notShown = allowedFields.filter(function(field) {
65777         return !field.isShown();
65778       });
65779       var container = selection2.selectAll(".form-fields-container").data([0]);
65780       container = container.enter().append("div").attr("class", "form-fields-container " + (_klass || "")).merge(container);
65781       var fields = container.selectAll(".wrap-form-field").data(shown, function(d2) {
65782         return d2.id + (d2.entityIDs ? d2.entityIDs.join() : "");
65783       });
65784       fields.exit().remove();
65785       var enter = fields.enter().append("div").attr("class", function(d2) {
65786         return "wrap-form-field wrap-form-field-" + d2.safeid;
65787       });
65788       fields = fields.merge(enter);
65789       fields.order().each(function(d2) {
65790         select_default2(this).call(d2.render);
65791       });
65792       var titles = [];
65793       var moreFields = notShown.map(function(field) {
65794         var title = field.title();
65795         titles.push(title);
65796         var terms = field.terms();
65797         if (field.key)
65798           terms.push(field.key);
65799         if (field.keys)
65800           terms = terms.concat(field.keys);
65801         return {
65802           display: field.label(),
65803           value: title,
65804           title,
65805           field,
65806           terms
65807         };
65808       });
65809       var placeholder = titles.slice(0, 3).join(", ") + (titles.length > 3 ? "\u2026" : "");
65810       var more = selection2.selectAll(".more-fields").data(_state === "hover" || moreFields.length === 0 ? [] : [0]);
65811       more.exit().remove();
65812       var moreEnter = more.enter().append("div").attr("class", "more-fields").append("label");
65813       moreEnter.append("span").call(_t.append("inspector.add_fields"));
65814       more = moreEnter.merge(more);
65815       var input = more.selectAll(".value").data([0]);
65816       input.exit().remove();
65817       input = input.enter().append("input").attr("class", "value").attr("type", "text").attr("placeholder", placeholder).call(utilNoAuto).merge(input);
65818       input.call(utilGetSetValue, "").call(
65819         moreCombo.data(moreFields).on("accept", function(d2) {
65820           if (!d2)
65821             return;
65822           var field = d2.field;
65823           field.show();
65824           selection2.call(formFields);
65825           field.focus();
65826         })
65827       );
65828       if (_lastPlaceholder !== placeholder) {
65829         input.attr("placeholder", placeholder);
65830         _lastPlaceholder = placeholder;
65831       }
65832     }
65833     formFields.fieldsArr = function(val) {
65834       if (!arguments.length)
65835         return _fieldsArr;
65836       _fieldsArr = val || [];
65837       return formFields;
65838     };
65839     formFields.state = function(val) {
65840       if (!arguments.length)
65841         return _state;
65842       _state = val;
65843       return formFields;
65844     };
65845     formFields.klass = function(val) {
65846       if (!arguments.length)
65847         return _klass;
65848       _klass = val;
65849       return formFields;
65850     };
65851     return formFields;
65852   }
65853
65854   // modules/ui/changeset_editor.js
65855   function uiChangesetEditor(context) {
65856     var dispatch14 = dispatch_default("change");
65857     var formFields = uiFormFields(context);
65858     var commentCombo = uiCombobox(context, "comment").caseSensitive(true);
65859     var _fieldsArr;
65860     var _tags;
65861     var _changesetID;
65862     function changesetEditor(selection2) {
65863       render(selection2);
65864     }
65865     function render(selection2) {
65866       var initial = false;
65867       if (!_fieldsArr) {
65868         initial = true;
65869         var presets = _mainPresetIndex;
65870         _fieldsArr = [
65871           uiField(context, presets.field("comment"), null, { show: true, revert: false }),
65872           uiField(context, presets.field("source"), null, { show: true, revert: false }),
65873           uiField(context, presets.field("hashtags"), null, { show: false, revert: false })
65874         ];
65875         _fieldsArr.forEach(function(field) {
65876           field.on("change", function(t2, onInput) {
65877             dispatch14.call("change", field, void 0, t2, onInput);
65878           });
65879         });
65880       }
65881       _fieldsArr.forEach(function(field) {
65882         field.tags(_tags);
65883       });
65884       selection2.call(formFields.fieldsArr(_fieldsArr));
65885       if (initial) {
65886         var commentField = selection2.select(".form-field-comment textarea");
65887         var commentNode = commentField.node();
65888         if (commentNode) {
65889           commentNode.focus();
65890           commentNode.select();
65891         }
65892         utilTriggerEvent(commentField, "blur");
65893         var osm = context.connection();
65894         if (osm) {
65895           osm.userChangesets(function(err, changesets) {
65896             if (err)
65897               return;
65898             var comments = changesets.map(function(changeset) {
65899               var comment = changeset.tags.comment;
65900               return comment ? { title: comment, value: comment } : null;
65901             }).filter(Boolean);
65902             commentField.call(
65903               commentCombo.data(utilArrayUniqBy(comments, "title"))
65904             );
65905           });
65906         }
65907       }
65908       const warnings = [];
65909       if (_tags.comment.match(/google/i)) {
65910         warnings.push({
65911           id: 'contains "google"',
65912           msg: _t.append("commit.google_warning"),
65913           link: _t("commit.google_warning_link")
65914         });
65915       }
65916       const maxChars = context.maxCharsForTagValue();
65917       const strLen = utilUnicodeCharsCount(utilCleanOsmString(_tags.comment, Number.POSITIVE_INFINITY));
65918       if (strLen > maxChars || false) {
65919         warnings.push({
65920           id: "message too long",
65921           msg: _t.append("commit.changeset_comment_length_warning", { maxChars })
65922         });
65923       }
65924       var commentWarning = selection2.select(".form-field-comment").selectAll(".comment-warning").data(warnings, (d2) => d2.id);
65925       commentWarning.exit().transition().duration(200).style("opacity", 0).remove();
65926       var commentEnter = commentWarning.enter().insert("div", ".comment-warning").attr("class", "comment-warning field-warning").style("opacity", 0);
65927       commentEnter.call(svgIcon("#iD-icon-alert", "inline")).append("span");
65928       commentEnter.transition().duration(200).style("opacity", 1);
65929       commentWarning.merge(commentEnter).selectAll("div > span").text("").each(function(d2) {
65930         let selection3 = select_default2(this);
65931         if (d2.link) {
65932           selection3 = selection3.append("a").attr("target", "_blank").attr("href", d2.link);
65933         }
65934         selection3.call(d2.msg);
65935       });
65936     }
65937     changesetEditor.tags = function(_2) {
65938       if (!arguments.length)
65939         return _tags;
65940       _tags = _2;
65941       return changesetEditor;
65942     };
65943     changesetEditor.changesetID = function(_2) {
65944       if (!arguments.length)
65945         return _changesetID;
65946       if (_changesetID === _2)
65947         return changesetEditor;
65948       _changesetID = _2;
65949       _fieldsArr = null;
65950       return changesetEditor;
65951     };
65952     return utilRebind(changesetEditor, dispatch14, "on");
65953   }
65954
65955   // modules/ui/commit.js
65956   var import_fast_deep_equal9 = __toESM(require_fast_deep_equal());
65957
65958   // modules/util/jxon.js
65959   var JXON = new function() {
65960     var sValueProp = "keyValue", sAttributesProp = "keyAttributes", sAttrPref = "@", aCache = [], rIsNull = /^\s*$/, rIsBool = /^(?:true|false)$/i;
65961     function parseText(sValue) {
65962       if (rIsNull.test(sValue)) {
65963         return null;
65964       }
65965       if (rIsBool.test(sValue)) {
65966         return sValue.toLowerCase() === "true";
65967       }
65968       if (isFinite(sValue)) {
65969         return parseFloat(sValue);
65970       }
65971       if (isFinite(Date.parse(sValue))) {
65972         return new Date(sValue);
65973       }
65974       return sValue;
65975     }
65976     function EmptyTree() {
65977     }
65978     EmptyTree.prototype.toString = function() {
65979       return "null";
65980     };
65981     EmptyTree.prototype.valueOf = function() {
65982       return null;
65983     };
65984     function objectify(vValue) {
65985       return vValue === null ? new EmptyTree() : vValue instanceof Object ? vValue : new vValue.constructor(vValue);
65986     }
65987     function createObjTree(oParentNode, nVerb, bFreeze, bNesteAttr) {
65988       var nLevelStart = aCache.length, bChildren = oParentNode.hasChildNodes(), bAttributes = oParentNode.hasAttributes(), bHighVerb = Boolean(nVerb & 2);
65989       var sProp, vContent, nLength = 0, sCollectedTxt = "", vResult = bHighVerb ? {} : (
65990         /* put here the default value for empty nodes: */
65991         true
65992       );
65993       if (bChildren) {
65994         for (var oNode, nItem = 0; nItem < oParentNode.childNodes.length; nItem++) {
65995           oNode = oParentNode.childNodes.item(nItem);
65996           if (oNode.nodeType === 4) {
65997             sCollectedTxt += oNode.nodeValue;
65998           } else if (oNode.nodeType === 3) {
65999             sCollectedTxt += oNode.nodeValue.trim();
66000           } else if (oNode.nodeType === 1 && !oNode.prefix) {
66001             aCache.push(oNode);
66002           }
66003         }
66004       }
66005       var nLevelEnd = aCache.length, vBuiltVal = parseText(sCollectedTxt);
66006       if (!bHighVerb && (bChildren || bAttributes)) {
66007         vResult = nVerb === 0 ? objectify(vBuiltVal) : {};
66008       }
66009       for (var nElId = nLevelStart; nElId < nLevelEnd; nElId++) {
66010         sProp = aCache[nElId].nodeName.toLowerCase();
66011         vContent = createObjTree(aCache[nElId], nVerb, bFreeze, bNesteAttr);
66012         if (vResult.hasOwnProperty(sProp)) {
66013           if (vResult[sProp].constructor !== Array) {
66014             vResult[sProp] = [vResult[sProp]];
66015           }
66016           vResult[sProp].push(vContent);
66017         } else {
66018           vResult[sProp] = vContent;
66019           nLength++;
66020         }
66021       }
66022       if (bAttributes) {
66023         var nAttrLen = oParentNode.attributes.length, sAPrefix = bNesteAttr ? "" : sAttrPref, oAttrParent = bNesteAttr ? {} : vResult;
66024         for (var oAttrib, nAttrib = 0; nAttrib < nAttrLen; nLength++, nAttrib++) {
66025           oAttrib = oParentNode.attributes.item(nAttrib);
66026           oAttrParent[sAPrefix + oAttrib.name.toLowerCase()] = parseText(oAttrib.value.trim());
66027         }
66028         if (bNesteAttr) {
66029           if (bFreeze) {
66030             Object.freeze(oAttrParent);
66031           }
66032           vResult[sAttributesProp] = oAttrParent;
66033           nLength -= nAttrLen - 1;
66034         }
66035       }
66036       if (nVerb === 3 || (nVerb === 2 || nVerb === 1 && nLength > 0) && sCollectedTxt) {
66037         vResult[sValueProp] = vBuiltVal;
66038       } else if (!bHighVerb && nLength === 0 && sCollectedTxt) {
66039         vResult = vBuiltVal;
66040       }
66041       if (bFreeze && (bHighVerb || nLength > 0)) {
66042         Object.freeze(vResult);
66043       }
66044       aCache.length = nLevelStart;
66045       return vResult;
66046     }
66047     function loadObjTree(oXMLDoc, oParentEl, oParentObj) {
66048       var vValue, oChild;
66049       if (oParentObj instanceof String || oParentObj instanceof Number || oParentObj instanceof Boolean) {
66050         oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toString()));
66051       } else if (oParentObj.constructor === Date) {
66052         oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toGMTString()));
66053       }
66054       for (var sName in oParentObj) {
66055         vValue = oParentObj[sName];
66056         if (isFinite(sName) || vValue instanceof Function) {
66057           continue;
66058         }
66059         if (sName === sValueProp) {
66060           if (vValue !== null && vValue !== true) {
66061             oParentEl.appendChild(oXMLDoc.createTextNode(vValue.constructor === Date ? vValue.toGMTString() : String(vValue)));
66062           }
66063         } else if (sName === sAttributesProp) {
66064           for (var sAttrib in vValue) {
66065             oParentEl.setAttribute(sAttrib, vValue[sAttrib]);
66066           }
66067         } else if (sName.charAt(0) === sAttrPref) {
66068           oParentEl.setAttribute(sName.slice(1), vValue);
66069         } else if (vValue.constructor === Array) {
66070           for (var nItem = 0; nItem < vValue.length; nItem++) {
66071             oChild = oXMLDoc.createElement(sName);
66072             loadObjTree(oXMLDoc, oChild, vValue[nItem]);
66073             oParentEl.appendChild(oChild);
66074           }
66075         } else {
66076           oChild = oXMLDoc.createElement(sName);
66077           if (vValue instanceof Object) {
66078             loadObjTree(oXMLDoc, oChild, vValue);
66079           } else if (vValue !== null && vValue !== true) {
66080             oChild.appendChild(oXMLDoc.createTextNode(vValue.toString()));
66081           }
66082           oParentEl.appendChild(oChild);
66083         }
66084       }
66085     }
66086     this.build = function(oXMLParent, nVerbosity, bFreeze, bNesteAttributes) {
66087       var _nVerb = arguments.length > 1 && typeof nVerbosity === "number" ? nVerbosity & 3 : (
66088         /* put here the default verbosity level: */
66089         1
66090       );
66091       return createObjTree(oXMLParent, _nVerb, bFreeze || false, arguments.length > 3 ? bNesteAttributes : _nVerb === 3);
66092     };
66093     this.unbuild = function(oObjTree) {
66094       var oNewDoc = document.implementation.createDocument("", "", null);
66095       loadObjTree(oNewDoc, oNewDoc, oObjTree);
66096       return oNewDoc;
66097     };
66098     this.stringify = function(oObjTree) {
66099       return new XMLSerializer().serializeToString(JXON.unbuild(oObjTree));
66100     };
66101   }();
66102
66103   // modules/ui/sections/changes.js
66104   function uiSectionChanges(context) {
66105     var _discardTags = {};
66106     _mainFileFetcher.get("discarded").then(function(d2) {
66107       _discardTags = d2;
66108     }).catch(function() {
66109     });
66110     var section = uiSection("changes-list", context).label(function() {
66111       var history = context.history();
66112       var summary = history.difference().summary();
66113       return _t.append("inspector.title_count", { title: _t("commit.changes"), count: summary.length });
66114     }).disclosureContent(renderDisclosureContent);
66115     function renderDisclosureContent(selection2) {
66116       var history = context.history();
66117       var summary = history.difference().summary();
66118       var container = selection2.selectAll(".commit-section").data([0]);
66119       var containerEnter = container.enter().append("div").attr("class", "commit-section");
66120       containerEnter.append("ul").attr("class", "changeset-list");
66121       container = containerEnter.merge(container);
66122       var items = container.select("ul").selectAll("li").data(summary);
66123       var itemsEnter = items.enter().append("li").attr("class", "change-item");
66124       var buttons = itemsEnter.append("button").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
66125       buttons.each(function(d2) {
66126         select_default2(this).call(svgIcon("#iD-icon-" + d2.entity.geometry(d2.graph), "pre-text " + d2.changeType));
66127       });
66128       buttons.append("span").attr("class", "change-type").html(function(d2) {
66129         return _t.html("commit." + d2.changeType) + " ";
66130       });
66131       buttons.append("strong").attr("class", "entity-type").text(function(d2) {
66132         var matched = _mainPresetIndex.match(d2.entity, d2.graph);
66133         return matched && matched.name() || utilDisplayType(d2.entity.id);
66134       });
66135       buttons.append("span").attr("class", "entity-name").text(function(d2) {
66136         var name = utilDisplayName(d2.entity) || "", string = "";
66137         if (name !== "") {
66138           string += ":";
66139         }
66140         return string += " " + name;
66141       });
66142       items = itemsEnter.merge(items);
66143       var changeset = new osmChangeset().update({ id: void 0 });
66144       var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
66145       delete changeset.id;
66146       var data = JXON.stringify(changeset.osmChangeJXON(changes));
66147       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
66148       var fileName = "changes.osc";
66149       var linkEnter = container.selectAll(".download-changes").data([0]).enter().append("a").attr("class", "download-changes");
66150       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
66151       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("commit.download_changes"));
66152       function mouseover(d2) {
66153         if (d2.entity) {
66154           context.surface().selectAll(
66155             utilEntityOrMemberSelector([d2.entity.id], context.graph())
66156           ).classed("hover", true);
66157         }
66158       }
66159       function mouseout() {
66160         context.surface().selectAll(".hover").classed("hover", false);
66161       }
66162       function click(d3_event, change) {
66163         if (change.changeType !== "deleted") {
66164           var entity = change.entity;
66165           context.map().zoomToEase(entity);
66166           context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
66167         }
66168       }
66169     }
66170     return section;
66171   }
66172
66173   // modules/ui/commit_warnings.js
66174   function uiCommitWarnings(context) {
66175     function commitWarnings(selection2) {
66176       var issuesBySeverity = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeDisabledRules: true });
66177       for (var severity in issuesBySeverity) {
66178         var issues = issuesBySeverity[severity];
66179         if (severity !== "error") {
66180           issues = issues.filter(function(issue) {
66181             return issue.type !== "help_request";
66182           });
66183         }
66184         var section = severity + "-section";
66185         var issueItem = severity + "-item";
66186         var container = selection2.selectAll("." + section).data(issues.length ? [0] : []);
66187         container.exit().remove();
66188         var containerEnter = container.enter().append("div").attr("class", "modal-section " + section + " fillL2");
66189         containerEnter.append("h3").call(severity === "warning" ? _t.append("commit.warnings") : _t.append("commit.errors"));
66190         containerEnter.append("ul").attr("class", "changeset-list");
66191         container = containerEnter.merge(container);
66192         var items = container.select("ul").selectAll("li").data(issues, function(d2) {
66193           return d2.key;
66194         });
66195         items.exit().remove();
66196         var itemsEnter = items.enter().append("li").attr("class", issueItem);
66197         var buttons = itemsEnter.append("button").on("mouseover", function(d3_event, d2) {
66198           if (d2.entityIds) {
66199             context.surface().selectAll(
66200               utilEntityOrMemberSelector(
66201                 d2.entityIds,
66202                 context.graph()
66203               )
66204             ).classed("hover", true);
66205           }
66206         }).on("mouseout", function() {
66207           context.surface().selectAll(".hover").classed("hover", false);
66208         }).on("click", function(d3_event, d2) {
66209           context.validator().focusIssue(d2);
66210         });
66211         buttons.call(svgIcon("#iD-icon-alert", "pre-text"));
66212         buttons.append("strong").attr("class", "issue-message");
66213         buttons.filter(function(d2) {
66214           return d2.tooltip;
66215         }).call(
66216           uiTooltip().title(function(d2) {
66217             return d2.tooltip;
66218           }).placement("top")
66219         );
66220         items = itemsEnter.merge(items);
66221         items.selectAll(".issue-message").text("").each(function(d2) {
66222           return d2.message(context)(select_default2(this));
66223         });
66224       }
66225     }
66226     return commitWarnings;
66227   }
66228
66229   // modules/ui/commit.js
66230   var readOnlyTags = [
66231     /^changesets_count$/,
66232     /^created_by$/,
66233     /^ideditor:/,
66234     /^imagery_used$/,
66235     /^host$/,
66236     /^locale$/,
66237     /^warnings:/,
66238     /^resolved:/,
66239     /^closed:note$/,
66240     /^closed:keepright$/,
66241     /^closed:improveosm:/,
66242     /^closed:osmose:/
66243   ];
66244   var hashtagRegex = /(#[^\u2000-\u206F\u2E00-\u2E7F\s\\'!"#$%()*,.\/:;<=>?@\[\]^`{|}~]+)/g;
66245   function uiCommit(context) {
66246     var dispatch14 = dispatch_default("cancel");
66247     var _userDetails2;
66248     var _selection;
66249     var changesetEditor = uiChangesetEditor(context).on("change", changeTags);
66250     var rawTagEditor = uiSectionRawTagEditor("changeset-tag-editor", context).on("change", changeTags).readOnlyTags(readOnlyTags);
66251     var commitChanges = uiSectionChanges(context);
66252     var commitWarnings = uiCommitWarnings(context);
66253     function commit(selection2) {
66254       _selection = selection2;
66255       if (!context.changeset)
66256         initChangeset();
66257       loadDerivedChangesetTags();
66258       selection2.call(render);
66259     }
66260     function initChangeset() {
66261       var commentDate = +corePreferences("commentDate") || 0;
66262       var currDate = Date.now();
66263       var cutoff = 2 * 86400 * 1e3;
66264       if (commentDate > currDate || currDate - commentDate > cutoff) {
66265         corePreferences("comment", null);
66266         corePreferences("hashtags", null);
66267         corePreferences("source", null);
66268       }
66269       if (context.defaultChangesetComment()) {
66270         corePreferences("comment", context.defaultChangesetComment());
66271         corePreferences("commentDate", Date.now());
66272       }
66273       if (context.defaultChangesetSource()) {
66274         corePreferences("source", context.defaultChangesetSource());
66275         corePreferences("commentDate", Date.now());
66276       }
66277       if (context.defaultChangesetHashtags()) {
66278         corePreferences("hashtags", context.defaultChangesetHashtags());
66279         corePreferences("commentDate", Date.now());
66280       }
66281       var detected = utilDetect();
66282       var tags = {
66283         comment: corePreferences("comment") || "",
66284         created_by: context.cleanTagValue("iD " + context.version),
66285         host: context.cleanTagValue(detected.host),
66286         locale: context.cleanTagValue(_mainLocalizer.localeCode())
66287       };
66288       findHashtags(tags, true);
66289       var hashtags = corePreferences("hashtags");
66290       if (hashtags) {
66291         tags.hashtags = hashtags;
66292       }
66293       var source = corePreferences("source");
66294       if (source) {
66295         tags.source = source;
66296       }
66297       var photoOverlaysUsed = context.history().photoOverlaysUsed();
66298       if (photoOverlaysUsed.length) {
66299         var sources = (tags.source || "").split(";");
66300         if (sources.indexOf("streetlevel imagery") === -1) {
66301           sources.push("streetlevel imagery");
66302         }
66303         photoOverlaysUsed.forEach(function(photoOverlay) {
66304           if (sources.indexOf(photoOverlay) === -1) {
66305             sources.push(photoOverlay);
66306           }
66307         });
66308         tags.source = context.cleanTagValue(sources.join(";"));
66309       }
66310       context.changeset = new osmChangeset({ tags });
66311     }
66312     function loadDerivedChangesetTags() {
66313       var osm = context.connection();
66314       if (!osm)
66315         return;
66316       var tags = Object.assign({}, context.changeset.tags);
66317       var imageryUsed = context.cleanTagValue(context.history().imageryUsed().join(";"));
66318       tags.imagery_used = imageryUsed || "None";
66319       var osmClosed = osm.getClosedIDs();
66320       var itemType;
66321       if (osmClosed.length) {
66322         tags["closed:note"] = context.cleanTagValue(osmClosed.join(";"));
66323       }
66324       if (services.keepRight) {
66325         var krClosed = services.keepRight.getClosedIDs();
66326         if (krClosed.length) {
66327           tags["closed:keepright"] = context.cleanTagValue(krClosed.join(";"));
66328         }
66329       }
66330       if (services.improveOSM) {
66331         var iOsmClosed = services.improveOSM.getClosedCounts();
66332         for (itemType in iOsmClosed) {
66333           tags["closed:improveosm:" + itemType] = context.cleanTagValue(iOsmClosed[itemType].toString());
66334         }
66335       }
66336       if (services.osmose) {
66337         var osmoseClosed = services.osmose.getClosedCounts();
66338         for (itemType in osmoseClosed) {
66339           tags["closed:osmose:" + itemType] = context.cleanTagValue(osmoseClosed[itemType].toString());
66340         }
66341       }
66342       for (var key in tags) {
66343         if (key.match(/(^warnings:)|(^resolved:)/)) {
66344           delete tags[key];
66345         }
66346       }
66347       function addIssueCounts(issues, prefix) {
66348         var issuesByType = utilArrayGroupBy(issues, "type");
66349         for (var issueType in issuesByType) {
66350           var issuesOfType = issuesByType[issueType];
66351           if (issuesOfType[0].subtype) {
66352             var issuesBySubtype = utilArrayGroupBy(issuesOfType, "subtype");
66353             for (var issueSubtype in issuesBySubtype) {
66354               var issuesOfSubtype = issuesBySubtype[issueSubtype];
66355               tags[prefix + ":" + issueType + ":" + issueSubtype] = context.cleanTagValue(issuesOfSubtype.length.toString());
66356             }
66357           } else {
66358             tags[prefix + ":" + issueType] = context.cleanTagValue(issuesOfType.length.toString());
66359           }
66360         }
66361       }
66362       var warnings = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeIgnored: true, includeDisabledRules: true }).warning.filter(function(issue) {
66363         return issue.type !== "help_request";
66364       });
66365       addIssueCounts(warnings, "warnings");
66366       var resolvedIssues = context.validator().getResolvedIssues();
66367       addIssueCounts(resolvedIssues, "resolved");
66368       context.changeset = context.changeset.update({ tags });
66369     }
66370     function render(selection2) {
66371       var osm = context.connection();
66372       if (!osm)
66373         return;
66374       var header = selection2.selectAll(".header").data([0]);
66375       var headerTitle = header.enter().append("div").attr("class", "header fillL");
66376       headerTitle.append("div").append("h2").call(_t.append("commit.title"));
66377       headerTitle.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
66378         dispatch14.call("cancel", this);
66379       }).call(svgIcon("#iD-icon-close"));
66380       var body = selection2.selectAll(".body").data([0]);
66381       body = body.enter().append("div").attr("class", "body").merge(body);
66382       var changesetSection = body.selectAll(".changeset-editor").data([0]);
66383       changesetSection = changesetSection.enter().append("div").attr("class", "modal-section changeset-editor").merge(changesetSection);
66384       changesetSection.call(
66385         changesetEditor.changesetID(context.changeset.id).tags(context.changeset.tags)
66386       );
66387       body.call(commitWarnings);
66388       var saveSection = body.selectAll(".save-section").data([0]);
66389       saveSection = saveSection.enter().append("div").attr("class", "modal-section save-section fillL").merge(saveSection);
66390       var prose = saveSection.selectAll(".commit-info").data([0]);
66391       if (prose.enter().size()) {
66392         _userDetails2 = null;
66393       }
66394       prose = prose.enter().append("p").attr("class", "commit-info").call(_t.append("commit.upload_explanation")).merge(prose);
66395       osm.userDetails(function(err, user) {
66396         if (err)
66397           return;
66398         if (_userDetails2 === user)
66399           return;
66400         _userDetails2 = user;
66401         var userLink = select_default2(document.createElement("div"));
66402         if (user.image_url) {
66403           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
66404         }
66405         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
66406         prose.html(_t.html("commit.upload_explanation_with_user", { user: { html: userLink.html() } }));
66407       });
66408       var requestReview = saveSection.selectAll(".request-review").data([0]);
66409       var requestReviewEnter = requestReview.enter().append("div").attr("class", "request-review");
66410       var requestReviewDomId = utilUniqueDomId("commit-input-request-review");
66411       var labelEnter = requestReviewEnter.append("label").attr("for", requestReviewDomId);
66412       if (!labelEnter.empty()) {
66413         labelEnter.call(uiTooltip().title(() => _t.append("commit.request_review_info")).placement("top"));
66414       }
66415       labelEnter.append("input").attr("type", "checkbox").attr("id", requestReviewDomId);
66416       labelEnter.append("span").call(_t.append("commit.request_review"));
66417       requestReview = requestReview.merge(requestReviewEnter);
66418       var requestReviewInput = requestReview.selectAll("input").property("checked", isReviewRequested(context.changeset.tags)).on("change", toggleRequestReview);
66419       var buttonSection = saveSection.selectAll(".buttons").data([0]);
66420       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons fillL");
66421       buttonEnter.append("button").attr("class", "secondary-action button cancel-button").append("span").attr("class", "label").call(_t.append("commit.cancel"));
66422       var uploadButton = buttonEnter.append("button").attr("class", "action button save-button");
66423       uploadButton.append("span").attr("class", "label").call(_t.append("commit.save"));
66424       var uploadBlockerTooltipText = getUploadBlockerMessage();
66425       buttonSection = buttonSection.merge(buttonEnter);
66426       buttonSection.selectAll(".cancel-button").on("click.cancel", function() {
66427         dispatch14.call("cancel", this);
66428       });
66429       buttonSection.selectAll(".save-button").classed("disabled", uploadBlockerTooltipText !== null).on("click.save", function() {
66430         if (!select_default2(this).classed("disabled")) {
66431           this.blur();
66432           for (var key in context.changeset.tags) {
66433             if (!key)
66434               delete context.changeset.tags[key];
66435           }
66436           context.uploader().save(context.changeset);
66437         }
66438       });
66439       uiTooltip().destroyAny(buttonSection.selectAll(".save-button"));
66440       if (uploadBlockerTooltipText) {
66441         buttonSection.selectAll(".save-button").call(uiTooltip().title(() => uploadBlockerTooltipText).placement("top"));
66442       }
66443       var tagSection = body.selectAll(".tag-section.raw-tag-editor").data([0]);
66444       tagSection = tagSection.enter().append("div").attr("class", "modal-section tag-section raw-tag-editor").merge(tagSection);
66445       tagSection.call(
66446         rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
66447       );
66448       var changesSection = body.selectAll(".commit-changes-section").data([0]);
66449       changesSection = changesSection.enter().append("div").attr("class", "modal-section commit-changes-section").merge(changesSection);
66450       changesSection.call(commitChanges.render);
66451       function toggleRequestReview() {
66452         var rr = requestReviewInput.property("checked");
66453         updateChangeset({ review_requested: rr ? "yes" : void 0 });
66454         tagSection.call(
66455           rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
66456         );
66457       }
66458     }
66459     function getUploadBlockerMessage() {
66460       var errors = context.validator().getIssuesBySeverity({ what: "edited", where: "all" }).error;
66461       if (errors.length) {
66462         return _t.append("commit.outstanding_errors_message", { count: errors.length });
66463       } else {
66464         var hasChangesetComment = context.changeset && context.changeset.tags.comment && context.changeset.tags.comment.trim().length;
66465         if (!hasChangesetComment) {
66466           return _t.append("commit.comment_needed_message");
66467         }
66468       }
66469       return null;
66470     }
66471     function changeTags(_2, changed, onInput) {
66472       if (changed.hasOwnProperty("comment")) {
66473         if (changed.comment === void 0) {
66474           changed.comment = "";
66475         }
66476         if (!onInput) {
66477           corePreferences("comment", changed.comment);
66478           corePreferences("commentDate", Date.now());
66479         }
66480       }
66481       if (changed.hasOwnProperty("source")) {
66482         if (changed.source === void 0) {
66483           corePreferences("source", null);
66484         } else if (!onInput) {
66485           corePreferences("source", changed.source);
66486           corePreferences("commentDate", Date.now());
66487         }
66488       }
66489       updateChangeset(changed, onInput);
66490       if (_selection) {
66491         _selection.call(render);
66492       }
66493     }
66494     function findHashtags(tags, commentOnly) {
66495       var detectedHashtags = commentHashtags();
66496       if (detectedHashtags.length) {
66497         corePreferences("hashtags", null);
66498       }
66499       if (!detectedHashtags.length || !commentOnly) {
66500         detectedHashtags = detectedHashtags.concat(hashtagHashtags());
66501       }
66502       var allLowerCase = /* @__PURE__ */ new Set();
66503       return detectedHashtags.filter(function(hashtag) {
66504         var lowerCase = hashtag.toLowerCase();
66505         if (!allLowerCase.has(lowerCase)) {
66506           allLowerCase.add(lowerCase);
66507           return true;
66508         }
66509         return false;
66510       });
66511       function commentHashtags() {
66512         var matches = (tags.comment || "").replace(/http\S*/g, "").match(hashtagRegex);
66513         return matches || [];
66514       }
66515       function hashtagHashtags() {
66516         var matches = (tags.hashtags || "").split(/[,;\s]+/).map(function(s2) {
66517           if (s2[0] !== "#") {
66518             s2 = "#" + s2;
66519           }
66520           var matched = s2.match(hashtagRegex);
66521           return matched && matched[0];
66522         }).filter(Boolean);
66523         return matches || [];
66524       }
66525     }
66526     function isReviewRequested(tags) {
66527       var rr = tags.review_requested;
66528       if (rr === void 0)
66529         return false;
66530       rr = rr.trim().toLowerCase();
66531       return !(rr === "" || rr === "no");
66532     }
66533     function updateChangeset(changed, onInput) {
66534       var tags = Object.assign({}, context.changeset.tags);
66535       Object.keys(changed).forEach(function(k2) {
66536         var v2 = changed[k2];
66537         k2 = context.cleanTagKey(k2);
66538         if (readOnlyTags.indexOf(k2) !== -1)
66539           return;
66540         if (v2 === void 0) {
66541           delete tags[k2];
66542         } else if (onInput) {
66543           tags[k2] = v2;
66544         } else {
66545           tags[k2] = context.cleanTagValue(v2);
66546         }
66547       });
66548       if (!onInput) {
66549         var commentOnly = changed.hasOwnProperty("comment") && changed.comment !== "";
66550         var arr = findHashtags(tags, commentOnly);
66551         if (arr.length) {
66552           tags.hashtags = context.cleanTagValue(arr.join(";"));
66553           corePreferences("hashtags", tags.hashtags);
66554         } else {
66555           delete tags.hashtags;
66556           corePreferences("hashtags", null);
66557         }
66558       }
66559       if (_userDetails2 && _userDetails2.changesets_count !== void 0) {
66560         var changesetsCount = parseInt(_userDetails2.changesets_count, 10) + 1;
66561         tags.changesets_count = String(changesetsCount);
66562         if (changesetsCount <= 100) {
66563           var s2;
66564           s2 = corePreferences("walkthrough_completed");
66565           if (s2) {
66566             tags["ideditor:walkthrough_completed"] = s2;
66567           }
66568           s2 = corePreferences("walkthrough_progress");
66569           if (s2) {
66570             tags["ideditor:walkthrough_progress"] = s2;
66571           }
66572           s2 = corePreferences("walkthrough_started");
66573           if (s2) {
66574             tags["ideditor:walkthrough_started"] = s2;
66575           }
66576         }
66577       } else {
66578         delete tags.changesets_count;
66579       }
66580       if (!(0, import_fast_deep_equal9.default)(context.changeset.tags, tags)) {
66581         context.changeset = context.changeset.update({ tags });
66582       }
66583     }
66584     commit.reset = function() {
66585       context.changeset = null;
66586     };
66587     return utilRebind(commit, dispatch14, "on");
66588   }
66589
66590   // modules/ui/confirm.js
66591   function uiConfirm(selection2) {
66592     var modalSelection = uiModal(selection2);
66593     modalSelection.select(".modal").classed("modal-alert", true);
66594     var section = modalSelection.select(".content");
66595     section.append("div").attr("class", "modal-section header");
66596     section.append("div").attr("class", "modal-section message-text");
66597     var buttons = section.append("div").attr("class", "modal-section buttons cf");
66598     modalSelection.okButton = function() {
66599       buttons.append("button").attr("class", "button ok-button action").on("click.confirm", function() {
66600         modalSelection.remove();
66601       }).call(_t.append("confirm.okay")).node().focus();
66602       return modalSelection;
66603     };
66604     return modalSelection;
66605   }
66606
66607   // modules/ui/conflicts.js
66608   function uiConflicts(context) {
66609     var dispatch14 = dispatch_default("cancel", "save");
66610     var keybinding = utilKeybinding("conflicts");
66611     var _origChanges;
66612     var _conflictList;
66613     var _shownConflictIndex;
66614     function keybindingOn() {
66615       select_default2(document).call(keybinding.on("\u238B", cancel, true));
66616     }
66617     function keybindingOff() {
66618       select_default2(document).call(keybinding.unbind);
66619     }
66620     function tryAgain() {
66621       keybindingOff();
66622       dispatch14.call("save");
66623     }
66624     function cancel() {
66625       keybindingOff();
66626       dispatch14.call("cancel");
66627     }
66628     function conflicts(selection2) {
66629       keybindingOn();
66630       var headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
66631       headerEnter.append("button").attr("class", "fr").attr("title", _t("icons.close")).on("click", cancel).call(svgIcon("#iD-icon-close"));
66632       headerEnter.append("h2").call(_t.append("save.conflict.header"));
66633       var bodyEnter = selection2.selectAll(".body").data([0]).enter().append("div").attr("class", "body fillL");
66634       var conflictsHelpEnter = bodyEnter.append("div").attr("class", "conflicts-help").call(_t.append("save.conflict.help"));
66635       var changeset = new osmChangeset();
66636       delete changeset.id;
66637       var data = JXON.stringify(changeset.osmChangeJXON(_origChanges));
66638       var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
66639       var fileName = "changes.osc";
66640       var linkEnter = conflictsHelpEnter.selectAll(".download-changes").append("a").attr("class", "download-changes");
66641       linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
66642       linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("save.conflict.download_changes"));
66643       bodyEnter.append("div").attr("class", "conflict-container fillL3").call(showConflict, 0);
66644       bodyEnter.append("div").attr("class", "conflicts-done").attr("opacity", 0).style("display", "none").call(_t.append("save.conflict.done"));
66645       var buttonsEnter = bodyEnter.append("div").attr("class", "buttons col12 joined conflicts-buttons");
66646       buttonsEnter.append("button").attr("disabled", _conflictList.length > 1).attr("class", "action conflicts-button col6").call(_t.append("save.title")).on("click.try_again", tryAgain);
66647       buttonsEnter.append("button").attr("class", "secondary-action conflicts-button col6").call(_t.append("confirm.cancel")).on("click.cancel", cancel);
66648     }
66649     function showConflict(selection2, index) {
66650       index = utilWrap(index, _conflictList.length);
66651       _shownConflictIndex = index;
66652       var parent = select_default2(selection2.node().parentNode);
66653       if (index === _conflictList.length - 1) {
66654         window.setTimeout(function() {
66655           parent.select(".conflicts-button").attr("disabled", null);
66656           parent.select(".conflicts-done").transition().attr("opacity", 1).style("display", "block");
66657         }, 250);
66658       }
66659       var conflict = selection2.selectAll(".conflict").data([_conflictList[index]]);
66660       conflict.exit().remove();
66661       var conflictEnter = conflict.enter().append("div").attr("class", "conflict");
66662       conflictEnter.append("h4").attr("class", "conflict-count").call(_t.append("save.conflict.count", { num: index + 1, total: _conflictList.length }));
66663       conflictEnter.append("a").attr("class", "conflict-description").attr("href", "#").text(function(d2) {
66664         return d2.name;
66665       }).on("click", function(d3_event, d2) {
66666         d3_event.preventDefault();
66667         zoomToEntity(d2.id);
66668       });
66669       var details = conflictEnter.append("div").attr("class", "conflict-detail-container");
66670       details.append("ul").attr("class", "conflict-detail-list").selectAll("li").data(function(d2) {
66671         return d2.details || [];
66672       }).enter().append("li").attr("class", "conflict-detail-item").html(function(d2) {
66673         return d2;
66674       });
66675       details.append("div").attr("class", "conflict-choices").call(addChoices);
66676       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) {
66677         return i3 === 0 && index === 0 || i3 === 1 && index === _conflictList.length - 1 || null;
66678       }).on("click", function(d3_event, d2) {
66679         d3_event.preventDefault();
66680         var container = parent.selectAll(".conflict-container");
66681         var sign2 = d2 === "previous" ? -1 : 1;
66682         container.selectAll(".conflict").remove();
66683         container.call(showConflict, index + sign2);
66684       }).each(function(d2) {
66685         _t.append("save.conflict." + d2)(select_default2(this));
66686       });
66687     }
66688     function addChoices(selection2) {
66689       var choices = selection2.append("ul").attr("class", "layer-list").selectAll("li").data(function(d2) {
66690         return d2.choices || [];
66691       });
66692       var choicesEnter = choices.enter().append("li").attr("class", "layer");
66693       var labelEnter = choicesEnter.append("label");
66694       labelEnter.append("input").attr("type", "radio").attr("name", function(d2) {
66695         return d2.id;
66696       }).on("change", function(d3_event, d2) {
66697         var ul = this.parentNode.parentNode.parentNode;
66698         ul.__data__.chosen = d2.id;
66699         choose(d3_event, ul, d2);
66700       });
66701       labelEnter.append("span").text(function(d2) {
66702         return d2.text;
66703       });
66704       choicesEnter.merge(choices).each(function(d2) {
66705         var ul = this.parentNode;
66706         if (ul.__data__.chosen === d2.id) {
66707           choose(null, ul, d2);
66708         }
66709       });
66710     }
66711     function choose(d3_event, ul, datum2) {
66712       if (d3_event)
66713         d3_event.preventDefault();
66714       select_default2(ul).selectAll("li").classed("active", function(d2) {
66715         return d2 === datum2;
66716       }).selectAll("input").property("checked", function(d2) {
66717         return d2 === datum2;
66718       });
66719       var extent = geoExtent();
66720       var entity;
66721       entity = context.graph().hasEntity(datum2.id);
66722       if (entity)
66723         extent._extend(entity.extent(context.graph()));
66724       datum2.action();
66725       entity = context.graph().hasEntity(datum2.id);
66726       if (entity)
66727         extent._extend(entity.extent(context.graph()));
66728       zoomToEntity(datum2.id, extent);
66729     }
66730     function zoomToEntity(id2, extent) {
66731       context.surface().selectAll(".hover").classed("hover", false);
66732       var entity = context.graph().hasEntity(id2);
66733       if (entity) {
66734         if (extent) {
66735           context.map().trimmedExtent(extent);
66736         } else {
66737           context.map().zoomToEase(entity);
66738         }
66739         context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
66740       }
66741     }
66742     conflicts.conflictList = function(_2) {
66743       if (!arguments.length)
66744         return _conflictList;
66745       _conflictList = _2;
66746       return conflicts;
66747     };
66748     conflicts.origChanges = function(_2) {
66749       if (!arguments.length)
66750         return _origChanges;
66751       _origChanges = _2;
66752       return conflicts;
66753     };
66754     conflicts.shownEntityIds = function() {
66755       if (_conflictList && typeof _shownConflictIndex === "number") {
66756         return [_conflictList[_shownConflictIndex].id];
66757       }
66758       return [];
66759     };
66760     return utilRebind(conflicts, dispatch14, "on");
66761   }
66762
66763   // modules/ui/entity_editor.js
66764   var import_fast_deep_equal10 = __toESM(require_fast_deep_equal());
66765
66766   // modules/ui/sections/entity_issues.js
66767   function uiSectionEntityIssues(context) {
66768     var preference = corePreferences("entity-issues.reference.expanded");
66769     var _expanded = preference === null ? true : preference === "true";
66770     var _entityIDs = [];
66771     var _issues = [];
66772     var _activeIssueID;
66773     var section = uiSection("entity-issues", context).shouldDisplay(function() {
66774       return _issues.length > 0;
66775     }).label(function() {
66776       return _t.append("inspector.title_count", { title: _t("issues.list_title"), count: _issues.length });
66777     }).disclosureContent(renderDisclosureContent);
66778     context.validator().on("validated.entity_issues", function() {
66779       reloadIssues();
66780       section.reRender();
66781     }).on("focusedIssue.entity_issues", function(issue) {
66782       makeActiveIssue(issue.id);
66783     });
66784     function reloadIssues() {
66785       _issues = context.validator().getSharedEntityIssues(_entityIDs, { includeDisabledRules: true });
66786     }
66787     function makeActiveIssue(issueID) {
66788       _activeIssueID = issueID;
66789       section.selection().selectAll(".issue-container").classed("active", function(d2) {
66790         return d2.id === _activeIssueID;
66791       });
66792     }
66793     function renderDisclosureContent(selection2) {
66794       selection2.classed("grouped-items-area", true);
66795       _activeIssueID = _issues.length > 0 ? _issues[0].id : null;
66796       var containers = selection2.selectAll(".issue-container").data(_issues, function(d2) {
66797         return d2.key;
66798       });
66799       containers.exit().remove();
66800       var containersEnter = containers.enter().append("div").attr("class", "issue-container");
66801       var itemsEnter = containersEnter.append("div").attr("class", function(d2) {
66802         return "issue severity-" + d2.severity;
66803       }).on("mouseover.highlight", function(d3_event, d2) {
66804         var ids = d2.entityIds.filter(function(e3) {
66805           return _entityIDs.indexOf(e3) === -1;
66806         });
66807         utilHighlightEntities(ids, true, context);
66808       }).on("mouseout.highlight", function(d3_event, d2) {
66809         var ids = d2.entityIds.filter(function(e3) {
66810           return _entityIDs.indexOf(e3) === -1;
66811         });
66812         utilHighlightEntities(ids, false, context);
66813       });
66814       var labelsEnter = itemsEnter.append("div").attr("class", "issue-label");
66815       var textEnter = labelsEnter.append("button").attr("class", "issue-text").on("click", function(d3_event, d2) {
66816         makeActiveIssue(d2.id);
66817         var extent = d2.extent(context.graph());
66818         if (extent) {
66819           var setZoom = Math.max(context.map().zoom(), 19);
66820           context.map().unobscuredCenterZoomEase(extent.center(), setZoom);
66821         }
66822       });
66823       textEnter.each(function(d2) {
66824         var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
66825         select_default2(this).call(svgIcon(iconName, "issue-icon"));
66826       });
66827       textEnter.append("span").attr("class", "issue-message");
66828       var infoButton = labelsEnter.append("button").attr("class", "issue-info-button").attr("title", _t("icons.information")).call(svgIcon("#iD-icon-inspect"));
66829       infoButton.on("click", function(d3_event) {
66830         d3_event.stopPropagation();
66831         d3_event.preventDefault();
66832         this.blur();
66833         var container = select_default2(this.parentNode.parentNode.parentNode);
66834         var info = container.selectAll(".issue-info");
66835         var isExpanded = info.classed("expanded");
66836         _expanded = !isExpanded;
66837         corePreferences("entity-issues.reference.expanded", _expanded);
66838         if (isExpanded) {
66839           info.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
66840             info.classed("expanded", false);
66841           });
66842         } else {
66843           info.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1").on("end", function() {
66844             info.style("max-height", null);
66845           });
66846         }
66847       });
66848       itemsEnter.append("ul").attr("class", "issue-fix-list");
66849       containersEnter.append("div").attr("class", "issue-info" + (_expanded ? " expanded" : "")).style("max-height", _expanded ? null : "0").style("opacity", _expanded ? "1" : "0").each(function(d2) {
66850         if (typeof d2.reference === "function") {
66851           select_default2(this).call(d2.reference);
66852         } else {
66853           select_default2(this).call(_t.append("inspector.no_documentation_key"));
66854         }
66855       });
66856       containers = containers.merge(containersEnter).classed("active", function(d2) {
66857         return d2.id === _activeIssueID;
66858       });
66859       containers.selectAll(".issue-message").text("").each(function(d2) {
66860         return d2.message(context)(select_default2(this));
66861       });
66862       var fixLists = containers.selectAll(".issue-fix-list");
66863       var fixes = fixLists.selectAll(".issue-fix-item").data(function(d2) {
66864         return d2.fixes ? d2.fixes(context) : [];
66865       }, function(fix) {
66866         return fix.id;
66867       });
66868       fixes.exit().remove();
66869       var fixesEnter = fixes.enter().append("li").attr("class", "issue-fix-item");
66870       var buttons = fixesEnter.append("button").on("click", function(d3_event, d2) {
66871         if (select_default2(this).attr("disabled") || !d2.onClick)
66872           return;
66873         if (d2.issue.dateLastRanFix && /* @__PURE__ */ new Date() - d2.issue.dateLastRanFix < 1e3)
66874           return;
66875         d2.issue.dateLastRanFix = /* @__PURE__ */ new Date();
66876         utilHighlightEntities(d2.issue.entityIds.concat(d2.entityIds), false, context);
66877         new Promise(function(resolve, reject) {
66878           d2.onClick(context, resolve, reject);
66879           if (d2.onClick.length <= 1) {
66880             resolve();
66881           }
66882         }).then(function() {
66883           context.validator().validate();
66884         });
66885       }).on("mouseover.highlight", function(d3_event, d2) {
66886         utilHighlightEntities(d2.entityIds, true, context);
66887       }).on("mouseout.highlight", function(d3_event, d2) {
66888         utilHighlightEntities(d2.entityIds, false, context);
66889       });
66890       buttons.each(function(d2) {
66891         var iconName = d2.icon || "iD-icon-wrench";
66892         if (iconName.startsWith("maki")) {
66893           iconName += "-15";
66894         }
66895         select_default2(this).call(svgIcon("#" + iconName, "fix-icon"));
66896       });
66897       buttons.append("span").attr("class", "fix-message").each(function(d2) {
66898         return d2.title(select_default2(this));
66899       });
66900       fixesEnter.merge(fixes).selectAll("button").classed("actionable", function(d2) {
66901         return d2.onClick;
66902       }).attr("disabled", function(d2) {
66903         return d2.onClick ? null : "true";
66904       }).attr("title", function(d2) {
66905         if (d2.disabledReason) {
66906           return d2.disabledReason;
66907         }
66908         return null;
66909       });
66910     }
66911     section.entityIDs = function(val) {
66912       if (!arguments.length)
66913         return _entityIDs;
66914       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
66915         _entityIDs = val;
66916         _activeIssueID = null;
66917         reloadIssues();
66918       }
66919       return section;
66920     };
66921     return section;
66922   }
66923
66924   // modules/ui/preset_icon.js
66925   function uiPresetIcon() {
66926     let _preset;
66927     let _geometry;
66928     function presetIcon(selection2) {
66929       selection2.each(render);
66930     }
66931     function getIcon(p2, geom) {
66932       if (p2.isFallback && p2.isFallback())
66933         return geom === "vertex" ? "" : "iD-icon-" + p2.id;
66934       if (p2.icon)
66935         return p2.icon;
66936       if (geom === "line")
66937         return "iD-other-line";
66938       if (geom === "vertex")
66939         return "temaki-vertex";
66940       return "maki-marker-stroked";
66941     }
66942     function renderPointBorder(container, drawPoint) {
66943       let pointBorder = container.selectAll(".preset-icon-point-border").data(drawPoint ? [0] : []);
66944       pointBorder.exit().remove();
66945       let pointBorderEnter = pointBorder.enter();
66946       const w2 = 40;
66947       const h2 = 40;
66948       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");
66949       pointBorder = pointBorderEnter.merge(pointBorder);
66950     }
66951     function renderCategoryBorder(container, category) {
66952       let categoryBorder = container.selectAll(".preset-icon-category-border").data(category ? [0] : []);
66953       categoryBorder.exit().remove();
66954       let categoryBorderEnter = categoryBorder.enter();
66955       const d2 = 60;
66956       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));
66957       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");
66958       categoryBorder = categoryBorderEnter.merge(categoryBorder);
66959       if (category) {
66960         categoryBorder.selectAll("path").attr("class", "area ".concat(category.id));
66961       }
66962     }
66963     function renderCircleFill(container, drawVertex) {
66964       let vertexFill = container.selectAll(".preset-icon-fill-vertex").data(drawVertex ? [0] : []);
66965       vertexFill.exit().remove();
66966       let vertexFillEnter = vertexFill.enter();
66967       const w2 = 60;
66968       const h2 = 60;
66969       const d2 = 40;
66970       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);
66971       vertexFill = vertexFillEnter.merge(vertexFill);
66972     }
66973     function renderSquareFill(container, drawArea, tagClasses) {
66974       let fill = container.selectAll(".preset-icon-fill-area").data(drawArea ? [0] : []);
66975       fill.exit().remove();
66976       let fillEnter = fill.enter();
66977       const d2 = 60;
66978       const w2 = d2;
66979       const h2 = d2;
66980       const l2 = d2 * 2 / 3;
66981       const c1 = (w2 - l2) / 2;
66982       const c2 = c1 + l2;
66983       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));
66984       ["fill", "stroke"].forEach((klass) => {
66985         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));
66986       });
66987       const rVertex = 2.5;
66988       [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach((point2) => {
66989         fillEnter.append("circle").attr("class", "vertex").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", rVertex);
66990       });
66991       const rMidpoint = 1.25;
66992       [[c1, w2 / 2], [c2, w2 / 2], [h2 / 2, c1], [h2 / 2, c2]].forEach((point2) => {
66993         fillEnter.append("circle").attr("class", "midpoint").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", rMidpoint);
66994       });
66995       fill = fillEnter.merge(fill);
66996       fill.selectAll("path.stroke").attr("class", "area stroke ".concat(tagClasses));
66997       fill.selectAll("path.fill").attr("class", "area fill ".concat(tagClasses));
66998     }
66999     function renderLine(container, drawLine, tagClasses) {
67000       let line = container.selectAll(".preset-icon-line").data(drawLine ? [0] : []);
67001       line.exit().remove();
67002       let lineEnter = line.enter();
67003       const d2 = 60;
67004       const w2 = d2;
67005       const h2 = d2;
67006       const y2 = Math.round(d2 * 0.72);
67007       const l2 = Math.round(d2 * 0.6);
67008       const r2 = 2.5;
67009       const x12 = (w2 - l2) / 2;
67010       const x2 = x12 + l2;
67011       lineEnter = lineEnter.append("svg").attr("class", "preset-icon-line").attr("width", w2).attr("height", h2).attr("viewBox", "0 0 ".concat(w2, " ").concat(h2));
67012       ["casing", "stroke"].forEach((klass) => {
67013         lineEnter.append("path").attr("d", "M".concat(x12, " ").concat(y2, " L").concat(x2, " ").concat(y2)).attr("class", "line ".concat(klass));
67014       });
67015       [[x12 - 1, y2], [x2 + 1, y2]].forEach((point2) => {
67016         lineEnter.append("circle").attr("class", "vertex").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", r2);
67017       });
67018       line = lineEnter.merge(line);
67019       line.selectAll("path.stroke").attr("class", "line stroke ".concat(tagClasses));
67020       line.selectAll("path.casing").attr("class", "line casing ".concat(tagClasses));
67021     }
67022     function renderRoute(container, drawRoute, p2) {
67023       let route = container.selectAll(".preset-icon-route").data(drawRoute ? [0] : []);
67024       route.exit().remove();
67025       let routeEnter = route.enter();
67026       const d2 = 60;
67027       const w2 = d2;
67028       const h2 = d2;
67029       const y12 = Math.round(d2 * 0.8);
67030       const y2 = Math.round(d2 * 0.68);
67031       const l2 = Math.round(d2 * 0.6);
67032       const r2 = 2;
67033       const x12 = (w2 - l2) / 2;
67034       const x2 = x12 + l2 / 3;
67035       const x3 = x2 + l2 / 3;
67036       const x4 = x3 + l2 / 3;
67037       routeEnter = routeEnter.append("svg").attr("class", "preset-icon-route").attr("width", w2).attr("height", h2).attr("viewBox", "0 0 ".concat(w2, " ").concat(h2));
67038       ["casing", "stroke"].forEach((klass) => {
67039         routeEnter.append("path").attr("d", "M".concat(x12, " ").concat(y12, " L").concat(x2, " ").concat(y2)).attr("class", "segment0 line ".concat(klass));
67040         routeEnter.append("path").attr("d", "M".concat(x2, " ").concat(y2, " L").concat(x3, " ").concat(y12)).attr("class", "segment1 line ".concat(klass));
67041         routeEnter.append("path").attr("d", "M".concat(x3, " ").concat(y12, " L").concat(x4, " ").concat(y2)).attr("class", "segment2 line ".concat(klass));
67042       });
67043       [[x12, y12], [x2, y2], [x3, y12], [x4, y2]].forEach((point2) => {
67044         routeEnter.append("circle").attr("class", "vertex").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", r2);
67045       });
67046       route = routeEnter.merge(route);
67047       if (drawRoute) {
67048         let routeType = p2.tags.type === "waterway" ? "waterway" : p2.tags.route;
67049         const segmentPresetIDs = routeSegments[routeType];
67050         for (let i3 in segmentPresetIDs) {
67051           const segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i3]);
67052           const segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, "");
67053           route.selectAll("path.stroke.segment".concat(i3)).attr("class", "segment".concat(i3, " line stroke ").concat(segmentTagClasses));
67054           route.selectAll("path.casing.segment".concat(i3)).attr("class", "segment".concat(i3, " line casing ").concat(segmentTagClasses));
67055         }
67056       }
67057     }
67058     function renderSvgIcon(container, picon, geom, isFramed, category, tagClasses) {
67059       const isMaki = picon && /^maki-/.test(picon);
67060       const isTemaki = picon && /^temaki-/.test(picon);
67061       const isFa = picon && /^fa[srb]-/.test(picon);
67062       const isR\u00F6ntgen = picon && /^roentgen-/.test(picon);
67063       const isiDIcon = picon && !(isMaki || isTemaki || isFa || isR\u00F6ntgen);
67064       let icon2 = container.selectAll(".preset-icon").data(picon ? [0] : []);
67065       icon2.exit().remove();
67066       icon2 = icon2.enter().append("div").attr("class", "preset-icon").call(svgIcon("")).merge(icon2);
67067       icon2.attr("class", "preset-icon " + (geom ? geom + "-geom" : "")).classed("category", category).classed("framed", isFramed).classed("preset-icon-iD", isiDIcon);
67068       icon2.selectAll("svg").attr("class", "icon " + picon + " " + (!isiDIcon && geom !== "line" ? "" : tagClasses));
67069       icon2.selectAll("use").attr("href", "#" + picon);
67070     }
67071     function renderImageIcon(container, imageURL) {
67072       let imageIcon = container.selectAll("img.image-icon").data(imageURL ? [0] : []);
67073       imageIcon.exit().remove();
67074       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);
67075       imageIcon.attr("src", imageURL);
67076     }
67077     const routeSegments = {
67078       bicycle: ["highway/cycleway", "highway/cycleway", "highway/cycleway"],
67079       bus: ["highway/unclassified", "highway/secondary", "highway/primary"],
67080       trolleybus: ["highway/unclassified", "highway/secondary", "highway/primary"],
67081       detour: ["highway/tertiary", "highway/residential", "highway/unclassified"],
67082       ferry: ["route/ferry", "route/ferry", "route/ferry"],
67083       foot: ["highway/footway", "highway/footway", "highway/footway"],
67084       hiking: ["highway/path", "highway/path", "highway/path"],
67085       horse: ["highway/bridleway", "highway/bridleway", "highway/bridleway"],
67086       light_rail: ["railway/light_rail", "railway/light_rail", "railway/light_rail"],
67087       monorail: ["railway/monorail", "railway/monorail", "railway/monorail"],
67088       mtb: ["highway/path", "highway/track", "highway/bridleway"],
67089       pipeline: ["man_made/pipeline", "man_made/pipeline", "man_made/pipeline"],
67090       piste: ["piste/downhill", "piste/hike", "piste/nordic"],
67091       power: ["power/line", "power/line", "power/line"],
67092       road: ["highway/secondary", "highway/primary", "highway/trunk"],
67093       subway: ["railway/subway", "railway/subway", "railway/subway"],
67094       train: ["railway/rail", "railway/rail", "railway/rail"],
67095       tram: ["railway/tram", "railway/tram", "railway/tram"],
67096       waterway: ["waterway/stream", "waterway/stream", "waterway/stream"]
67097     };
67098     function render() {
67099       let p2 = _preset.apply(this, arguments);
67100       let geom = _geometry ? _geometry.apply(this, arguments) : null;
67101       if (geom === "relation" && p2.tags && (p2.tags.type === "route" && p2.tags.route && routeSegments[p2.tags.route] || p2.tags.type === "waterway")) {
67102         geom = "route";
67103       }
67104       const showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
67105       const isFallback = p2.isFallback && p2.isFallback();
67106       const imageURL = showThirdPartyIcons === "true" && p2.imageURL;
67107       const picon = getIcon(p2, geom);
67108       const isCategory = !p2.setTags;
67109       const drawPoint = false;
67110       const drawVertex = picon !== null && geom === "vertex";
67111       const drawLine = picon && geom === "line" && !isFallback && !isCategory;
67112       const drawArea = picon && geom === "area" && !isFallback && !isCategory;
67113       const drawRoute = picon && geom === "route";
67114       const isFramed = drawVertex || drawArea || drawLine || drawRoute || isCategory;
67115       let tags = !isCategory ? p2.setTags({}, geom) : {};
67116       for (let k2 in tags) {
67117         if (tags[k2] === "*") {
67118           tags[k2] = "yes";
67119         }
67120       }
67121       let tagClasses = svgTagClasses().getClassesString(tags, "");
67122       let selection2 = select_default2(this);
67123       let container = selection2.selectAll(".preset-icon-container").data([0]);
67124       container = container.enter().append("div").attr("class", "preset-icon-container").merge(container);
67125       container.classed("showing-img", !!imageURL).classed("fallback", isFallback);
67126       renderCategoryBorder(container, isCategory && p2);
67127       renderPointBorder(container, drawPoint);
67128       renderCircleFill(container, drawVertex);
67129       renderSquareFill(container, drawArea, tagClasses);
67130       renderLine(container, drawLine, tagClasses);
67131       renderRoute(container, drawRoute, p2);
67132       renderSvgIcon(container, picon, geom, isFramed, isCategory, tagClasses);
67133       renderImageIcon(container, imageURL);
67134     }
67135     presetIcon.preset = function(val) {
67136       if (!arguments.length)
67137         return _preset;
67138       _preset = utilFunctor(val);
67139       return presetIcon;
67140     };
67141     presetIcon.geometry = function(val) {
67142       if (!arguments.length)
67143         return _geometry;
67144       _geometry = utilFunctor(val);
67145       return presetIcon;
67146     };
67147     return presetIcon;
67148   }
67149
67150   // modules/ui/sections/feature_type.js
67151   function uiSectionFeatureType(context) {
67152     var dispatch14 = dispatch_default("choose");
67153     var _entityIDs = [];
67154     var _presets = [];
67155     var _tagReference;
67156     var section = uiSection("feature-type", context).label(() => _t.append("inspector.feature_type")).disclosureContent(renderDisclosureContent);
67157     function renderDisclosureContent(selection2) {
67158       selection2.classed("preset-list-item", true);
67159       selection2.classed("mixed-types", _presets.length > 1);
67160       var presetButtonWrap = selection2.selectAll(".preset-list-button-wrap").data([0]).enter().append("div").attr("class", "preset-list-button-wrap");
67161       var presetButton = presetButtonWrap.append("button").attr("class", "preset-list-button preset-reset").call(
67162         uiTooltip().title(() => _t.append("inspector.back_tooltip")).placement("bottom")
67163       );
67164       presetButton.append("div").attr("class", "preset-icon-container");
67165       presetButton.append("div").attr("class", "label").append("div").attr("class", "label-inner");
67166       presetButtonWrap.append("div").attr("class", "accessory-buttons");
67167       var tagReferenceBodyWrap = selection2.selectAll(".tag-reference-body-wrap").data([0]);
67168       tagReferenceBodyWrap = tagReferenceBodyWrap.enter().append("div").attr("class", "tag-reference-body-wrap").merge(tagReferenceBodyWrap);
67169       if (_tagReference) {
67170         selection2.selectAll(".preset-list-button-wrap .accessory-buttons").style("display", _presets.length === 1 ? null : "none").call(_tagReference.button);
67171         tagReferenceBodyWrap.style("display", _presets.length === 1 ? null : "none").call(_tagReference.body);
67172       }
67173       selection2.selectAll(".preset-reset").on("click", function() {
67174         dispatch14.call("choose", this, _presets);
67175       }).on("pointerdown pointerup mousedown mouseup", function(d3_event) {
67176         d3_event.preventDefault();
67177         d3_event.stopPropagation();
67178       });
67179       var geometries = entityGeometries();
67180       selection2.select(".preset-list-item button").call(
67181         uiPresetIcon().geometry(_presets.length === 1 ? geometries.length === 1 && geometries[0] : null).preset(_presets.length === 1 ? _presets[0] : _mainPresetIndex.item("point"))
67182       );
67183       var names = _presets.length === 1 ? [
67184         _presets[0].nameLabel(),
67185         _presets[0].subtitleLabel()
67186       ].filter(Boolean) : [_t.append("inspector.multiple_types")];
67187       var label = selection2.select(".label-inner");
67188       var nameparts = label.selectAll(".namepart").data(names, (d2) => d2.stringId);
67189       nameparts.exit().remove();
67190       nameparts.enter().append("div").attr("class", "namepart").text("").each(function(d2) {
67191         d2(select_default2(this));
67192       });
67193     }
67194     section.entityIDs = function(val) {
67195       if (!arguments.length)
67196         return _entityIDs;
67197       _entityIDs = val;
67198       return section;
67199     };
67200     section.presets = function(val) {
67201       if (!arguments.length)
67202         return _presets;
67203       if (!utilArrayIdentical(val, _presets)) {
67204         _presets = val;
67205         if (_presets.length === 1) {
67206           _tagReference = uiTagReference(_presets[0].reference(), context).showing(false);
67207         }
67208       }
67209       return section;
67210     };
67211     function entityGeometries() {
67212       var counts = {};
67213       for (var i3 in _entityIDs) {
67214         var geometry = context.graph().geometry(_entityIDs[i3]);
67215         if (!counts[geometry])
67216           counts[geometry] = 0;
67217         counts[geometry] += 1;
67218       }
67219       return Object.keys(counts).sort(function(geom1, geom2) {
67220         return counts[geom2] - counts[geom1];
67221       });
67222     }
67223     return utilRebind(section, dispatch14, "on");
67224   }
67225
67226   // modules/ui/sections/preset_fields.js
67227   function uiSectionPresetFields(context) {
67228     var section = uiSection("preset-fields", context).label(() => _t.append("inspector.fields")).disclosureContent(renderDisclosureContent);
67229     var dispatch14 = dispatch_default("change", "revert");
67230     var formFields = uiFormFields(context);
67231     var _state;
67232     var _fieldsArr;
67233     var _presets = [];
67234     var _tags;
67235     var _entityIDs;
67236     function renderDisclosureContent(selection2) {
67237       if (!_fieldsArr) {
67238         var graph = context.graph();
67239         var geometries = Object.keys(_entityIDs.reduce(function(geoms, entityID) {
67240           geoms[graph.entity(entityID).geometry(graph)] = true;
67241           return geoms;
67242         }, {}));
67243         const loc = _entityIDs.reduce(function(extent, entityID) {
67244           var entity = context.graph().entity(entityID);
67245           return extent.extend(entity.extent(context.graph()));
67246         }, geoExtent()).center();
67247         var presetsManager = _mainPresetIndex;
67248         var allFields = [];
67249         var allMoreFields = [];
67250         var sharedTotalFields;
67251         _presets.forEach(function(preset) {
67252           var fields = preset.fields(loc);
67253           var moreFields = preset.moreFields(loc);
67254           allFields = utilArrayUnion(allFields, fields);
67255           allMoreFields = utilArrayUnion(allMoreFields, moreFields);
67256           if (!sharedTotalFields) {
67257             sharedTotalFields = utilArrayUnion(fields, moreFields);
67258           } else {
67259             sharedTotalFields = sharedTotalFields.filter(function(field) {
67260               return fields.indexOf(field) !== -1 || moreFields.indexOf(field) !== -1;
67261             });
67262           }
67263         });
67264         var sharedFields = allFields.filter(function(field) {
67265           return sharedTotalFields.indexOf(field) !== -1;
67266         });
67267         var sharedMoreFields = allMoreFields.filter(function(field) {
67268           return sharedTotalFields.indexOf(field) !== -1;
67269         });
67270         _fieldsArr = [];
67271         sharedFields.forEach(function(field) {
67272           if (field.matchAllGeometry(geometries)) {
67273             _fieldsArr.push(
67274               uiField(context, field, _entityIDs)
67275             );
67276           }
67277         });
67278         var singularEntity = _entityIDs.length === 1 && graph.hasEntity(_entityIDs[0]);
67279         if (singularEntity && singularEntity.isHighwayIntersection(graph) && presetsManager.field("restrictions")) {
67280           _fieldsArr.push(
67281             uiField(context, presetsManager.field("restrictions"), _entityIDs)
67282           );
67283         }
67284         var additionalFields = utilArrayUnion(sharedMoreFields, presetsManager.universal());
67285         additionalFields.sort(function(field1, field2) {
67286           return field1.title().localeCompare(field2.title(), _mainLocalizer.localeCode());
67287         });
67288         additionalFields.forEach(function(field) {
67289           if (sharedFields.indexOf(field) === -1 && field.matchAllGeometry(geometries)) {
67290             _fieldsArr.push(
67291               uiField(context, field, _entityIDs, { show: false })
67292             );
67293           }
67294         });
67295         _fieldsArr.forEach(function(field) {
67296           field.on("change", function(t2, onInput) {
67297             dispatch14.call("change", field, _entityIDs, t2, onInput);
67298           }).on("revert", function(keys2) {
67299             dispatch14.call("revert", field, keys2);
67300           });
67301         });
67302       }
67303       _fieldsArr.forEach(function(field) {
67304         field.state(_state).tags(_tags);
67305       });
67306       selection2.call(
67307         formFields.fieldsArr(_fieldsArr).state(_state).klass("grouped-items-area")
67308       );
67309     }
67310     section.presets = function(val) {
67311       if (!arguments.length)
67312         return _presets;
67313       if (!_presets || !val || !utilArrayIdentical(_presets, val)) {
67314         _presets = val;
67315         _fieldsArr = null;
67316       }
67317       return section;
67318     };
67319     section.state = function(val) {
67320       if (!arguments.length)
67321         return _state;
67322       _state = val;
67323       return section;
67324     };
67325     section.tags = function(val) {
67326       if (!arguments.length)
67327         return _tags;
67328       _tags = val;
67329       return section;
67330     };
67331     section.entityIDs = function(val) {
67332       if (!arguments.length)
67333         return _entityIDs;
67334       if (!val || !_entityIDs || !utilArrayIdentical(_entityIDs, val)) {
67335         _entityIDs = val;
67336         _fieldsArr = null;
67337       }
67338       return section;
67339     };
67340     return utilRebind(section, dispatch14, "on");
67341   }
67342
67343   // modules/ui/sections/raw_member_editor.js
67344   function uiSectionRawMemberEditor(context) {
67345     var section = uiSection("raw-member-editor", context).shouldDisplay(function() {
67346       if (!_entityIDs || _entityIDs.length !== 1)
67347         return false;
67348       var entity = context.hasEntity(_entityIDs[0]);
67349       return entity && entity.type === "relation";
67350     }).label(function() {
67351       var entity = context.hasEntity(_entityIDs[0]);
67352       if (!entity)
67353         return "";
67354       var gt2 = entity.members.length > _maxMembers ? ">" : "";
67355       var count = gt2 + entity.members.slice(0, _maxMembers).length;
67356       return _t.append("inspector.title_count", { title: _t("inspector.members"), count });
67357     }).disclosureContent(renderDisclosureContent);
67358     var taginfo = services.taginfo;
67359     var _entityIDs;
67360     var _maxMembers = 1e3;
67361     function downloadMember(d3_event, d2) {
67362       d3_event.preventDefault();
67363       select_default2(this.parentNode).classed("tag-reference-loading", true);
67364       context.loadEntity(d2.id, function() {
67365         section.reRender();
67366       });
67367     }
67368     function zoomToMember(d3_event, d2) {
67369       d3_event.preventDefault();
67370       var entity = context.entity(d2.id);
67371       context.map().zoomToEase(entity);
67372       utilHighlightEntities([d2.id], true, context);
67373     }
67374     function selectMember(d3_event, d2) {
67375       d3_event.preventDefault();
67376       utilHighlightEntities([d2.id], false, context);
67377       var entity = context.entity(d2.id);
67378       var mapExtent = context.map().extent();
67379       if (!entity.intersects(mapExtent, context.graph())) {
67380         context.map().zoomToEase(entity);
67381       }
67382       context.enter(modeSelect(context, [d2.id]));
67383     }
67384     function changeRole(d3_event, d2) {
67385       var oldRole = d2.role;
67386       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
67387       if (oldRole !== newRole) {
67388         var member = { id: d2.id, type: d2.type, role: newRole };
67389         context.perform(
67390           actionChangeMember(d2.relation.id, member, d2.index),
67391           _t("operations.change_role.annotation", {
67392             n: 1
67393           })
67394         );
67395         context.validator().validate();
67396       }
67397     }
67398     function deleteMember(d3_event, d2) {
67399       utilHighlightEntities([d2.id], false, context);
67400       context.perform(
67401         actionDeleteMember(d2.relation.id, d2.index),
67402         _t("operations.delete_member.annotation", {
67403           n: 1
67404         })
67405       );
67406       if (!context.hasEntity(d2.relation.id)) {
67407         context.enter(modeBrowse(context));
67408       } else {
67409         context.validator().validate();
67410       }
67411     }
67412     function renderDisclosureContent(selection2) {
67413       var entityID = _entityIDs[0];
67414       var memberships = [];
67415       var entity = context.entity(entityID);
67416       entity.members.slice(0, _maxMembers).forEach(function(member, index) {
67417         memberships.push({
67418           index,
67419           id: member.id,
67420           type: member.type,
67421           role: member.role,
67422           relation: entity,
67423           member: context.hasEntity(member.id),
67424           domId: utilUniqueDomId(entityID + "-member-" + index)
67425         });
67426       });
67427       var list = selection2.selectAll(".member-list").data([0]);
67428       list = list.enter().append("ul").attr("class", "member-list").merge(list);
67429       var items = list.selectAll("li").data(memberships, function(d2) {
67430         return osmEntity.key(d2.relation) + "," + d2.index + "," + (d2.member ? osmEntity.key(d2.member) : "incomplete");
67431       });
67432       items.exit().each(unbind).remove();
67433       var itemsEnter = items.enter().append("li").attr("class", "member-row form-field").classed("member-incomplete", function(d2) {
67434         return !d2.member;
67435       });
67436       itemsEnter.each(function(d2) {
67437         var item = select_default2(this);
67438         var label = item.append("label").attr("class", "field-label").attr("for", d2.domId);
67439         if (d2.member) {
67440           item.on("mouseover", function() {
67441             utilHighlightEntities([d2.id], true, context);
67442           }).on("mouseout", function() {
67443             utilHighlightEntities([d2.id], false, context);
67444           });
67445           var labelLink = label.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectMember);
67446           labelLink.append("span").attr("class", "member-entity-type").text(function(d4) {
67447             var matched = _mainPresetIndex.match(d4.member, context.graph());
67448             return matched && matched.name() || utilDisplayType(d4.member.id);
67449           });
67450           labelLink.append("span").attr("class", "member-entity-name").text(function(d4) {
67451             return utilDisplayName(d4.member);
67452           });
67453           label.append("button").attr("title", _t("icons.remove")).attr("class", "remove member-delete").call(svgIcon("#iD-operation-delete"));
67454           label.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToMember);
67455         } else {
67456           var labelText = label.append("span").attr("class", "label-text");
67457           labelText.append("span").attr("class", "member-entity-type").call(_t.append("inspector." + d2.type, { id: d2.id }));
67458           labelText.append("span").attr("class", "member-entity-name").call(_t.append("inspector.incomplete", { id: d2.id }));
67459           label.append("button").attr("class", "member-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMember);
67460         }
67461       });
67462       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
67463       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
67464         return d2.domId;
67465       }).property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
67466       if (taginfo) {
67467         wrapEnter.each(bindTypeahead);
67468       }
67469       items = items.merge(itemsEnter).order();
67470       items.select("input.member-role").property("value", function(d2) {
67471         return d2.role;
67472       }).on("blur", changeRole).on("change", changeRole);
67473       items.select("button.member-delete").on("click", deleteMember);
67474       var dragOrigin, targetIndex;
67475       items.call(
67476         drag_default().on("start", function(d3_event) {
67477           dragOrigin = {
67478             x: d3_event.x,
67479             y: d3_event.y
67480           };
67481           targetIndex = null;
67482         }).on("drag", function(d3_event) {
67483           var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
67484           if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
67485           Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5)
67486             return;
67487           var index = items.nodes().indexOf(this);
67488           select_default2(this).classed("dragging", true);
67489           targetIndex = null;
67490           selection2.selectAll("li.member-row").style("transform", function(d2, index2) {
67491             var node = select_default2(this).node();
67492             if (index === index2) {
67493               return "translate(" + x2 + "px, " + y2 + "px)";
67494             } else if (index2 > index && d3_event.y > node.offsetTop) {
67495               if (targetIndex === null || index2 > targetIndex) {
67496                 targetIndex = index2;
67497               }
67498               return "translateY(-100%)";
67499             } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
67500               if (targetIndex === null || index2 < targetIndex) {
67501                 targetIndex = index2;
67502               }
67503               return "translateY(100%)";
67504             }
67505             return null;
67506           });
67507         }).on("end", function(d3_event, d2) {
67508           if (!select_default2(this).classed("dragging"))
67509             return;
67510           var index = items.nodes().indexOf(this);
67511           select_default2(this).classed("dragging", false);
67512           selection2.selectAll("li.member-row").style("transform", null);
67513           if (targetIndex !== null) {
67514             context.perform(
67515               actionMoveMember(d2.relation.id, index, targetIndex),
67516               _t("operations.reorder_members.annotation")
67517             );
67518             context.validator().validate();
67519           }
67520         })
67521       );
67522       function bindTypeahead(d2) {
67523         var row = select_default2(this);
67524         var role = row.selectAll("input.member-role");
67525         var origValue = role.property("value");
67526         function sort(value, data) {
67527           var sameletter = [];
67528           var other = [];
67529           for (var i3 = 0; i3 < data.length; i3++) {
67530             if (data[i3].value.substring(0, value.length) === value) {
67531               sameletter.push(data[i3]);
67532             } else {
67533               other.push(data[i3]);
67534             }
67535           }
67536           return sameletter.concat(other);
67537         }
67538         role.call(
67539           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
67540             var geometry;
67541             if (d2.member) {
67542               geometry = context.graph().geometry(d2.member.id);
67543             } else if (d2.type === "relation") {
67544               geometry = "relation";
67545             } else if (d2.type === "way") {
67546               geometry = "line";
67547             } else {
67548               geometry = "point";
67549             }
67550             var rtype = entity.tags.type;
67551             taginfo.roles({
67552               debounce: true,
67553               rtype: rtype || "",
67554               geometry,
67555               query: role2
67556             }, function(err, data) {
67557               if (!err)
67558                 callback(sort(role2, data));
67559             });
67560           }).on("cancel", function() {
67561             role.property("value", origValue);
67562           })
67563         );
67564       }
67565       function unbind() {
67566         var row = select_default2(this);
67567         row.selectAll("input.member-role").call(uiCombobox.off, context);
67568       }
67569     }
67570     section.entityIDs = function(val) {
67571       if (!arguments.length)
67572         return _entityIDs;
67573       _entityIDs = val;
67574       return section;
67575     };
67576     return section;
67577   }
67578
67579   // modules/actions/delete_members.js
67580   function actionDeleteMembers(relationId, memberIndexes) {
67581     return function(graph) {
67582       memberIndexes.sort((a2, b2) => b2 - a2);
67583       for (var i3 in memberIndexes) {
67584         graph = actionDeleteMember(relationId, memberIndexes[i3])(graph);
67585       }
67586       return graph;
67587     };
67588   }
67589
67590   // modules/ui/sections/raw_membership_editor.js
67591   function uiSectionRawMembershipEditor(context) {
67592     var section = uiSection("raw-membership-editor", context).shouldDisplay(function() {
67593       return _entityIDs && _entityIDs.length;
67594     }).label(function() {
67595       var parents = getSharedParentRelations();
67596       var gt2 = parents.length > _maxMemberships ? ">" : "";
67597       var count = gt2 + parents.slice(0, _maxMemberships).length;
67598       return _t.append("inspector.title_count", { title: _t("inspector.relations"), count });
67599     }).disclosureContent(renderDisclosureContent);
67600     var taginfo = services.taginfo;
67601     var nearbyCombo = uiCombobox(context, "parent-relation").minItems(1).fetcher(fetchNearbyRelations).itemsMouseEnter(function(d3_event, d2) {
67602       if (d2.relation)
67603         utilHighlightEntities([d2.relation.id], true, context);
67604     }).itemsMouseLeave(function(d3_event, d2) {
67605       if (d2.relation)
67606         utilHighlightEntities([d2.relation.id], false, context);
67607     });
67608     var _inChange = false;
67609     var _entityIDs = [];
67610     var _showBlank;
67611     var _maxMemberships = 1e3;
67612     function getSharedParentRelations() {
67613       var parents = [];
67614       for (var i3 = 0; i3 < _entityIDs.length; i3++) {
67615         var entity = context.graph().hasEntity(_entityIDs[i3]);
67616         if (!entity)
67617           continue;
67618         if (i3 === 0) {
67619           parents = context.graph().parentRelations(entity);
67620         } else {
67621           parents = utilArrayIntersection(parents, context.graph().parentRelations(entity));
67622         }
67623         if (!parents.length)
67624           break;
67625       }
67626       return parents;
67627     }
67628     function getMemberships() {
67629       var memberships = [];
67630       var relations = getSharedParentRelations().slice(0, _maxMemberships);
67631       var isMultiselect = _entityIDs.length > 1;
67632       var i3, relation, membership, index, member, indexedMember;
67633       for (i3 = 0; i3 < relations.length; i3++) {
67634         relation = relations[i3];
67635         membership = {
67636           relation,
67637           members: [],
67638           hash: osmEntity.key(relation)
67639         };
67640         for (index = 0; index < relation.members.length; index++) {
67641           member = relation.members[index];
67642           if (_entityIDs.indexOf(member.id) !== -1) {
67643             indexedMember = Object.assign({}, member, { index });
67644             membership.members.push(indexedMember);
67645             membership.hash += "," + index.toString();
67646             if (!isMultiselect) {
67647               memberships.push(membership);
67648               membership = {
67649                 relation,
67650                 members: [],
67651                 hash: osmEntity.key(relation)
67652               };
67653             }
67654           }
67655         }
67656         if (membership.members.length)
67657           memberships.push(membership);
67658       }
67659       memberships.forEach(function(membership2) {
67660         membership2.domId = utilUniqueDomId("membership-" + membership2.relation.id);
67661         var roles = [];
67662         membership2.members.forEach(function(member2) {
67663           if (roles.indexOf(member2.role) === -1)
67664             roles.push(member2.role);
67665         });
67666         membership2.role = roles.length === 1 ? roles[0] : roles;
67667       });
67668       return memberships;
67669     }
67670     function selectRelation(d3_event, d2) {
67671       d3_event.preventDefault();
67672       utilHighlightEntities([d2.relation.id], false, context);
67673       context.enter(modeSelect(context, [d2.relation.id]));
67674     }
67675     function zoomToRelation(d3_event, d2) {
67676       d3_event.preventDefault();
67677       var entity = context.entity(d2.relation.id);
67678       context.map().zoomToEase(entity);
67679       utilHighlightEntities([d2.relation.id], true, context);
67680     }
67681     function changeRole(d3_event, d2) {
67682       if (d2 === 0)
67683         return;
67684       if (_inChange)
67685         return;
67686       var newRole = context.cleanRelationRole(select_default2(this).property("value"));
67687       if (!newRole.trim() && typeof d2.role !== "string")
67688         return;
67689       var membersToUpdate = d2.members.filter(function(member) {
67690         return member.role !== newRole;
67691       });
67692       if (membersToUpdate.length) {
67693         _inChange = true;
67694         context.perform(
67695           function actionChangeMemberRoles(graph) {
67696             membersToUpdate.forEach(function(member) {
67697               var newMember = Object.assign({}, member, { role: newRole });
67698               delete newMember.index;
67699               graph = actionChangeMember(d2.relation.id, newMember, member.index)(graph);
67700             });
67701             return graph;
67702           },
67703           _t("operations.change_role.annotation", {
67704             n: membersToUpdate.length
67705           })
67706         );
67707         context.validator().validate();
67708       }
67709       _inChange = false;
67710     }
67711     function addMembership(d2, role) {
67712       this.blur();
67713       _showBlank = false;
67714       function actionAddMembers(relationId, ids, role2) {
67715         return function(graph) {
67716           for (var i3 in ids) {
67717             var member = { id: ids[i3], type: graph.entity(ids[i3]).type, role: role2 };
67718             graph = actionAddMember(relationId, member)(graph);
67719           }
67720           return graph;
67721         };
67722       }
67723       if (d2.relation) {
67724         context.perform(
67725           actionAddMembers(d2.relation.id, _entityIDs, role),
67726           _t("operations.add_member.annotation", {
67727             n: _entityIDs.length
67728           })
67729         );
67730         context.validator().validate();
67731       } else {
67732         var relation = osmRelation();
67733         context.perform(
67734           actionAddEntity(relation),
67735           actionAddMembers(relation.id, _entityIDs, role),
67736           _t("operations.add.annotation.relation")
67737         );
67738         context.enter(modeSelect(context, [relation.id]).newFeature(true));
67739       }
67740     }
67741     function deleteMembership(d3_event, d2) {
67742       this.blur();
67743       if (d2 === 0)
67744         return;
67745       utilHighlightEntities([d2.relation.id], false, context);
67746       var indexes = d2.members.map(function(member) {
67747         return member.index;
67748       });
67749       context.perform(
67750         actionDeleteMembers(d2.relation.id, indexes),
67751         _t("operations.delete_member.annotation", {
67752           n: _entityIDs.length
67753         })
67754       );
67755       context.validator().validate();
67756     }
67757     function fetchNearbyRelations(q2, callback) {
67758       var newRelation = {
67759         relation: null,
67760         value: _t("inspector.new_relation"),
67761         display: _t.append("inspector.new_relation")
67762       };
67763       var entityID = _entityIDs[0];
67764       var result = [];
67765       var graph = context.graph();
67766       function baseDisplayLabel(entity) {
67767         var matched = _mainPresetIndex.match(entity, graph);
67768         var presetName = matched && matched.name() || _t("inspector.relation");
67769         var entityName = utilDisplayName(entity) || "";
67770         return presetName + " " + entityName;
67771       }
67772       var explicitRelation = q2 && context.hasEntity(q2.toLowerCase());
67773       if (explicitRelation && explicitRelation.type === "relation" && explicitRelation.id !== entityID) {
67774         result.push({
67775           relation: explicitRelation,
67776           value: baseDisplayLabel(explicitRelation) + " " + explicitRelation.id
67777         });
67778       } else {
67779         context.history().intersects(context.map().extent()).forEach(function(entity) {
67780           if (entity.type !== "relation" || entity.id === entityID)
67781             return;
67782           var value = baseDisplayLabel(entity);
67783           if (q2 && (value + " " + entity.id).toLowerCase().indexOf(q2.toLowerCase()) === -1)
67784             return;
67785           result.push({ relation: entity, value });
67786         });
67787         result.sort(function(a2, b2) {
67788           return osmRelation.creationOrder(a2.relation, b2.relation);
67789         });
67790         var dupeGroups = Object.values(utilArrayGroupBy(result, "value")).filter(function(v2) {
67791           return v2.length > 1;
67792         });
67793         dupeGroups.forEach(function(group) {
67794           group.forEach(function(obj) {
67795             obj.value += " " + obj.relation.id;
67796           });
67797         });
67798       }
67799       result.forEach(function(obj) {
67800         obj.title = obj.value;
67801       });
67802       result.unshift(newRelation);
67803       callback(result);
67804     }
67805     function renderDisclosureContent(selection2) {
67806       var memberships = getMemberships();
67807       var list = selection2.selectAll(".member-list").data([0]);
67808       list = list.enter().append("ul").attr("class", "member-list").merge(list);
67809       var items = list.selectAll("li.member-row-normal").data(memberships, function(d2) {
67810         return d2.hash;
67811       });
67812       items.exit().each(unbind).remove();
67813       var itemsEnter = items.enter().append("li").attr("class", "member-row member-row-normal form-field");
67814       itemsEnter.on("mouseover", function(d3_event, d2) {
67815         utilHighlightEntities([d2.relation.id], true, context);
67816       }).on("mouseout", function(d3_event, d2) {
67817         utilHighlightEntities([d2.relation.id], false, context);
67818       });
67819       var labelEnter = itemsEnter.append("label").attr("class", "field-label").attr("for", function(d2) {
67820         return d2.domId;
67821       });
67822       var labelLink = labelEnter.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectRelation);
67823       labelLink.append("span").attr("class", "member-entity-type").text(function(d2) {
67824         var matched = _mainPresetIndex.match(d2.relation, context.graph());
67825         return matched && matched.name() || _t.html("inspector.relation");
67826       });
67827       labelLink.append("span").attr("class", "member-entity-name").text(function(d2) {
67828         return utilDisplayName(d2.relation);
67829       });
67830       labelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", deleteMembership);
67831       labelEnter.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToRelation);
67832       var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
67833       wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
67834         return d2.domId;
67835       }).property("type", "text").property("value", function(d2) {
67836         return typeof d2.role === "string" ? d2.role : "";
67837       }).attr("title", function(d2) {
67838         return Array.isArray(d2.role) ? d2.role.filter(Boolean).join("\n") : d2.role;
67839       }).attr("placeholder", function(d2) {
67840         return Array.isArray(d2.role) ? _t("inspector.multiple_roles") : _t("inspector.role");
67841       }).classed("mixed", function(d2) {
67842         return Array.isArray(d2.role);
67843       }).call(utilNoAuto).on("blur", changeRole).on("change", changeRole);
67844       if (taginfo) {
67845         wrapEnter.each(bindTypeahead);
67846       }
67847       var newMembership = list.selectAll(".member-row-new").data(_showBlank ? [0] : []);
67848       newMembership.exit().remove();
67849       var newMembershipEnter = newMembership.enter().append("li").attr("class", "member-row member-row-new form-field");
67850       var newLabelEnter = newMembershipEnter.append("label").attr("class", "field-label");
67851       newLabelEnter.append("input").attr("placeholder", _t("inspector.choose_relation")).attr("type", "text").attr("class", "member-entity-input").call(utilNoAuto);
67852       newLabelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", function() {
67853         list.selectAll(".member-row-new").remove();
67854       });
67855       var newWrapEnter = newMembershipEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
67856       newWrapEnter.append("input").attr("class", "member-role").property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
67857       newMembership = newMembership.merge(newMembershipEnter);
67858       newMembership.selectAll(".member-entity-input").on("blur", cancelEntity).call(
67859         nearbyCombo.on("accept", acceptEntity).on("cancel", cancelEntity)
67860       );
67861       var addRow = selection2.selectAll(".add-row").data([0]);
67862       var addRowEnter = addRow.enter().append("div").attr("class", "add-row");
67863       var addRelationButton = addRowEnter.append("button").attr("class", "add-relation").attr("aria-label", _t("inspector.add_to_relation"));
67864       addRelationButton.call(svgIcon("#iD-icon-plus", "light"));
67865       addRelationButton.call(uiTooltip().title(() => _t.append("inspector.add_to_relation")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left"));
67866       addRowEnter.append("div").attr("class", "space-value");
67867       addRowEnter.append("div").attr("class", "space-buttons");
67868       addRow = addRow.merge(addRowEnter);
67869       addRow.select(".add-relation").on("click", function() {
67870         _showBlank = true;
67871         section.reRender();
67872         list.selectAll(".member-entity-input").node().focus();
67873       });
67874       function acceptEntity(d2) {
67875         if (!d2) {
67876           cancelEntity();
67877           return;
67878         }
67879         if (d2.relation)
67880           utilHighlightEntities([d2.relation.id], false, context);
67881         var role = context.cleanRelationRole(list.selectAll(".member-row-new .member-role").property("value"));
67882         addMembership(d2, role);
67883       }
67884       function cancelEntity() {
67885         var input = newMembership.selectAll(".member-entity-input");
67886         input.property("value", "");
67887         context.surface().selectAll(".highlighted").classed("highlighted", false);
67888       }
67889       function bindTypeahead(d2) {
67890         var row = select_default2(this);
67891         var role = row.selectAll("input.member-role");
67892         var origValue = role.property("value");
67893         function sort(value, data) {
67894           var sameletter = [];
67895           var other = [];
67896           for (var i3 = 0; i3 < data.length; i3++) {
67897             if (data[i3].value.substring(0, value.length) === value) {
67898               sameletter.push(data[i3]);
67899             } else {
67900               other.push(data[i3]);
67901             }
67902           }
67903           return sameletter.concat(other);
67904         }
67905         role.call(
67906           uiCombobox(context, "member-role").fetcher(function(role2, callback) {
67907             var rtype = d2.relation.tags.type;
67908             taginfo.roles({
67909               debounce: true,
67910               rtype: rtype || "",
67911               geometry: context.graph().geometry(_entityIDs[0]),
67912               query: role2
67913             }, function(err, data) {
67914               if (!err)
67915                 callback(sort(role2, data));
67916             });
67917           }).on("cancel", function() {
67918             role.property("value", origValue);
67919           })
67920         );
67921       }
67922       function unbind() {
67923         var row = select_default2(this);
67924         row.selectAll("input.member-role").call(uiCombobox.off, context);
67925       }
67926     }
67927     section.entityIDs = function(val) {
67928       if (!arguments.length)
67929         return _entityIDs;
67930       _entityIDs = val;
67931       _showBlank = false;
67932       return section;
67933     };
67934     return section;
67935   }
67936
67937   // modules/ui/sections/selection_list.js
67938   function uiSectionSelectionList(context) {
67939     var _selectedIDs = [];
67940     var section = uiSection("selected-features", context).shouldDisplay(function() {
67941       return _selectedIDs.length > 1;
67942     }).label(function() {
67943       return _t.append("inspector.title_count", { title: _t("inspector.features"), count: _selectedIDs.length });
67944     }).disclosureContent(renderDisclosureContent);
67945     context.history().on("change.selectionList", function(difference) {
67946       if (difference) {
67947         section.reRender();
67948       }
67949     });
67950     section.entityIDs = function(val) {
67951       if (!arguments.length)
67952         return _selectedIDs;
67953       _selectedIDs = val;
67954       return section;
67955     };
67956     function selectEntity(d3_event, entity) {
67957       context.enter(modeSelect(context, [entity.id]));
67958     }
67959     function deselectEntity(d3_event, entity) {
67960       var selectedIDs = _selectedIDs.slice();
67961       var index = selectedIDs.indexOf(entity.id);
67962       if (index > -1) {
67963         selectedIDs.splice(index, 1);
67964         context.enter(modeSelect(context, selectedIDs));
67965       }
67966     }
67967     function renderDisclosureContent(selection2) {
67968       var list = selection2.selectAll(".feature-list").data([0]);
67969       list = list.enter().append("ul").attr("class", "feature-list").merge(list);
67970       var entities = _selectedIDs.map(function(id2) {
67971         return context.hasEntity(id2);
67972       }).filter(Boolean);
67973       var items = list.selectAll(".feature-list-item").data(entities, osmEntity.key);
67974       items.exit().remove();
67975       var enter = items.enter().append("li").attr("class", "feature-list-item").each(function(d2) {
67976         select_default2(this).on("mouseover", function() {
67977           utilHighlightEntities([d2.id], true, context);
67978         }).on("mouseout", function() {
67979           utilHighlightEntities([d2.id], false, context);
67980         });
67981       });
67982       var label = enter.append("button").attr("class", "label").on("click", selectEntity);
67983       label.append("span").attr("class", "entity-geom-icon").call(svgIcon("", "pre-text"));
67984       label.append("span").attr("class", "entity-type");
67985       label.append("span").attr("class", "entity-name");
67986       enter.append("button").attr("class", "close").attr("title", _t("icons.deselect")).on("click", deselectEntity).call(svgIcon("#iD-icon-close"));
67987       items = items.merge(enter);
67988       items.selectAll(".entity-geom-icon use").attr("href", function() {
67989         var entity = this.parentNode.parentNode.__data__;
67990         return "#iD-icon-" + entity.geometry(context.graph());
67991       });
67992       items.selectAll(".entity-type").text(function(entity) {
67993         return _mainPresetIndex.match(entity, context.graph()).name();
67994       });
67995       items.selectAll(".entity-name").text(function(d2) {
67996         var entity = context.entity(d2.id);
67997         return utilDisplayName(entity);
67998       });
67999     }
68000     return section;
68001   }
68002
68003   // modules/ui/entity_editor.js
68004   function uiEntityEditor(context) {
68005     var dispatch14 = dispatch_default("choose");
68006     var _state = "select";
68007     var _coalesceChanges = false;
68008     var _modified = false;
68009     var _base;
68010     var _entityIDs;
68011     var _activePresets = [];
68012     var _newFeature;
68013     var _sections;
68014     function entityEditor(selection2) {
68015       var combinedTags = utilCombinedTags(_entityIDs, context.graph());
68016       var header = selection2.selectAll(".header").data([0]);
68017       var headerEnter = header.enter().append("div").attr("class", "header fillL");
68018       var direction = _mainLocalizer.textDirection() === "rtl" ? "forward" : "backward";
68019       headerEnter.append("button").attr("class", "preset-reset preset-choose").attr("title", _t("inspector.back_tooltip")).call(svgIcon("#iD-icon-".concat(direction)));
68020       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
68021         context.enter(modeBrowse(context));
68022       }).call(svgIcon(_modified ? "#iD-icon-apply" : "#iD-icon-close"));
68023       headerEnter.append("h2");
68024       header = header.merge(headerEnter);
68025       header.selectAll("h2").text("").call(_entityIDs.length === 1 ? _t.append("inspector.edit") : _t.append("inspector.edit_features"));
68026       header.selectAll(".preset-reset").on("click", function() {
68027         dispatch14.call("choose", this, _activePresets);
68028       });
68029       var body = selection2.selectAll(".inspector-body").data([0]);
68030       var bodyEnter = body.enter().append("div").attr("class", "entity-editor inspector-body sep-top");
68031       body = body.merge(bodyEnter);
68032       if (!_sections) {
68033         _sections = [
68034           uiSectionSelectionList(context),
68035           uiSectionFeatureType(context).on("choose", function(presets) {
68036             dispatch14.call("choose", this, presets);
68037           }),
68038           uiSectionEntityIssues(context),
68039           uiSectionPresetFields(context).on("change", changeTags).on("revert", revertTags),
68040           uiSectionRawTagEditor("raw-tag-editor", context).on("change", changeTags),
68041           uiSectionRawMemberEditor(context),
68042           uiSectionRawMembershipEditor(context)
68043         ];
68044       }
68045       _sections.forEach(function(section) {
68046         if (section.entityIDs) {
68047           section.entityIDs(_entityIDs);
68048         }
68049         if (section.presets) {
68050           section.presets(_activePresets);
68051         }
68052         if (section.tags) {
68053           section.tags(combinedTags);
68054         }
68055         if (section.state) {
68056           section.state(_state);
68057         }
68058         body.call(section.render);
68059       });
68060       context.history().on("change.entity-editor", historyChanged);
68061       function historyChanged(difference) {
68062         if (selection2.selectAll(".entity-editor").empty())
68063           return;
68064         if (_state === "hide")
68065           return;
68066         var significant = !difference || difference.didChange.properties || difference.didChange.addition || difference.didChange.deletion;
68067         if (!significant)
68068           return;
68069         _entityIDs = _entityIDs.filter(context.hasEntity);
68070         if (!_entityIDs.length)
68071           return;
68072         var priorActivePreset = _activePresets.length === 1 && _activePresets[0];
68073         loadActivePresets();
68074         var graph = context.graph();
68075         entityEditor.modified(_base !== graph);
68076         entityEditor(selection2);
68077         if (priorActivePreset && _activePresets.length === 1 && priorActivePreset !== _activePresets[0]) {
68078           context.container().selectAll(".entity-editor button.preset-reset .label").style("background-color", "#fff").transition().duration(750).style("background-color", null);
68079         }
68080       }
68081     }
68082     function changeTags(entityIDs, changed, onInput) {
68083       var actions = [];
68084       for (var i3 in entityIDs) {
68085         var entityID = entityIDs[i3];
68086         var entity = context.entity(entityID);
68087         var tags = Object.assign({}, entity.tags);
68088         if (typeof changed === "function") {
68089           tags = changed(tags);
68090         } else {
68091           for (var k2 in changed) {
68092             if (!k2)
68093               continue;
68094             var v2 = changed[k2];
68095             if (typeof v2 === "object") {
68096               tags[k2] = tags[v2.oldKey];
68097             } else if (v2 !== void 0 || tags.hasOwnProperty(k2)) {
68098               tags[k2] = v2;
68099             }
68100           }
68101         }
68102         if (!onInput) {
68103           tags = utilCleanTags(tags);
68104         }
68105         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
68106           actions.push(actionChangeTags(entityID, tags));
68107         }
68108       }
68109       if (actions.length) {
68110         var combinedAction = function(graph) {
68111           actions.forEach(function(action) {
68112             graph = action(graph);
68113           });
68114           return graph;
68115         };
68116         var annotation = _t("operations.change_tags.annotation");
68117         if (_coalesceChanges) {
68118           context.overwrite(combinedAction, annotation);
68119         } else {
68120           context.perform(combinedAction, annotation);
68121           _coalesceChanges = !!onInput;
68122         }
68123       }
68124       if (!onInput) {
68125         context.validator().validate();
68126       }
68127     }
68128     function revertTags(keys2) {
68129       var actions = [];
68130       for (var i3 in _entityIDs) {
68131         var entityID = _entityIDs[i3];
68132         var original = context.graph().base().entities[entityID];
68133         var changed = {};
68134         for (var j3 in keys2) {
68135           var key = keys2[j3];
68136           changed[key] = original ? original.tags[key] : void 0;
68137         }
68138         var entity = context.entity(entityID);
68139         var tags = Object.assign({}, entity.tags);
68140         for (var k2 in changed) {
68141           if (!k2)
68142             continue;
68143           var v2 = changed[k2];
68144           if (v2 !== void 0 || tags.hasOwnProperty(k2)) {
68145             tags[k2] = v2;
68146           }
68147         }
68148         tags = utilCleanTags(tags);
68149         if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
68150           actions.push(actionChangeTags(entityID, tags));
68151         }
68152       }
68153       if (actions.length) {
68154         var combinedAction = function(graph) {
68155           actions.forEach(function(action) {
68156             graph = action(graph);
68157           });
68158           return graph;
68159         };
68160         var annotation = _t("operations.change_tags.annotation");
68161         if (_coalesceChanges) {
68162           context.overwrite(combinedAction, annotation);
68163         } else {
68164           context.perform(combinedAction, annotation);
68165           _coalesceChanges = false;
68166         }
68167       }
68168       context.validator().validate();
68169     }
68170     entityEditor.modified = function(val) {
68171       if (!arguments.length)
68172         return _modified;
68173       _modified = val;
68174       return entityEditor;
68175     };
68176     entityEditor.state = function(val) {
68177       if (!arguments.length)
68178         return _state;
68179       _state = val;
68180       return entityEditor;
68181     };
68182     entityEditor.entityIDs = function(val) {
68183       if (!arguments.length)
68184         return _entityIDs;
68185       _base = context.graph();
68186       _coalesceChanges = false;
68187       if (val && _entityIDs && utilArrayIdentical(_entityIDs, val))
68188         return entityEditor;
68189       _entityIDs = val;
68190       loadActivePresets(true);
68191       return entityEditor.modified(false);
68192     };
68193     entityEditor.newFeature = function(val) {
68194       if (!arguments.length)
68195         return _newFeature;
68196       _newFeature = val;
68197       return entityEditor;
68198     };
68199     function loadActivePresets(isForNewSelection) {
68200       var graph = context.graph();
68201       var counts = {};
68202       for (var i3 in _entityIDs) {
68203         var entity = graph.hasEntity(_entityIDs[i3]);
68204         if (!entity)
68205           return;
68206         var match = _mainPresetIndex.match(entity, graph);
68207         if (!counts[match.id])
68208           counts[match.id] = 0;
68209         counts[match.id] += 1;
68210       }
68211       var matches = Object.keys(counts).sort(function(p1, p2) {
68212         return counts[p2] - counts[p1];
68213       }).map(function(pID) {
68214         return _mainPresetIndex.item(pID);
68215       });
68216       if (!isForNewSelection) {
68217         var weakPreset = _activePresets.length === 1 && !_activePresets[0].isFallback() && Object.keys(_activePresets[0].addTags || {}).length === 0;
68218         if (weakPreset && matches.length === 1 && matches[0].isFallback())
68219           return;
68220       }
68221       entityEditor.presets(matches);
68222     }
68223     entityEditor.presets = function(val) {
68224       if (!arguments.length)
68225         return _activePresets;
68226       if (!utilArrayIdentical(val, _activePresets)) {
68227         _activePresets = val;
68228       }
68229       return entityEditor;
68230     };
68231     return utilRebind(entityEditor, dispatch14, "on");
68232   }
68233
68234   // modules/ui/feature_list.js
68235   var sexagesimal = __toESM(require_sexagesimal());
68236   function uiFeatureList(context) {
68237     var _geocodeResults;
68238     function featureList(selection2) {
68239       var header = selection2.append("div").attr("class", "header fillL");
68240       header.append("h2").call(_t.append("inspector.feature_list"));
68241       var searchWrap = selection2.append("div").attr("class", "search-header");
68242       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
68243       var search = searchWrap.append("input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keypress", keypress).on("keydown", keydown).on("input", inputevent);
68244       var listWrap = selection2.append("div").attr("class", "inspector-body");
68245       var list = listWrap.append("div").attr("class", "feature-list");
68246       context.on("exit.feature-list", clearSearch);
68247       context.map().on("drawn.feature-list", mapDrawn);
68248       context.keybinding().on(uiCmd("\u2318F"), focusSearch);
68249       function focusSearch(d3_event) {
68250         var mode = context.mode() && context.mode().id;
68251         if (mode !== "browse")
68252           return;
68253         d3_event.preventDefault();
68254         search.node().focus();
68255       }
68256       function keydown(d3_event) {
68257         if (d3_event.keyCode === 27) {
68258           search.node().blur();
68259         }
68260       }
68261       function keypress(d3_event) {
68262         var q2 = search.property("value"), items = list.selectAll(".feature-list-item");
68263         if (d3_event.keyCode === 13 && // ↩ Return
68264         q2.length && items.size()) {
68265           click(d3_event, items.datum());
68266         }
68267       }
68268       function inputevent() {
68269         _geocodeResults = void 0;
68270         drawList();
68271       }
68272       function clearSearch() {
68273         search.property("value", "");
68274         drawList();
68275       }
68276       function mapDrawn(e3) {
68277         if (e3.full) {
68278           drawList();
68279         }
68280       }
68281       function features() {
68282         var result = [];
68283         var graph = context.graph();
68284         var visibleCenter = context.map().extent().center();
68285         var q2 = search.property("value").toLowerCase();
68286         if (!q2)
68287           return result;
68288         var locationMatch = sexagesimal.pair(q2.toUpperCase()) || q2.match(/^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)$/);
68289         if (locationMatch) {
68290           var loc = [Number(locationMatch[0]), Number(locationMatch[1])];
68291           result.push({
68292             id: -1,
68293             geometry: "point",
68294             type: _t("inspector.location"),
68295             name: dmsCoordinatePair([loc[1], loc[0]]),
68296             location: loc
68297           });
68298         }
68299         var idMatch = !locationMatch && q2.match(/(?:^|\W)(node|way|relation|[nwr])\W{0,2}0*([1-9]\d*)(?:\W|$)/i);
68300         if (idMatch) {
68301           var elemType = idMatch[1].charAt(0);
68302           var elemId = idMatch[2];
68303           result.push({
68304             id: elemType + elemId,
68305             geometry: elemType === "n" ? "point" : elemType === "w" ? "line" : "relation",
68306             type: elemType === "n" ? _t("inspector.node") : elemType === "w" ? _t("inspector.way") : _t("inspector.relation"),
68307             name: elemId
68308           });
68309         }
68310         var allEntities = graph.entities;
68311         var localResults = [];
68312         for (var id2 in allEntities) {
68313           var entity = allEntities[id2];
68314           if (!entity)
68315             continue;
68316           var name = utilDisplayName(entity) || "";
68317           if (name.toLowerCase().indexOf(q2) < 0)
68318             continue;
68319           var matched = _mainPresetIndex.match(entity, graph);
68320           var type2 = matched && matched.name() || utilDisplayType(entity.id);
68321           var extent = entity.extent(graph);
68322           var distance = extent ? geoSphericalDistance(visibleCenter, extent.center()) : 0;
68323           localResults.push({
68324             id: entity.id,
68325             entity,
68326             geometry: entity.geometry(graph),
68327             type: type2,
68328             name,
68329             distance
68330           });
68331           if (localResults.length > 100)
68332             break;
68333         }
68334         localResults = localResults.sort(function byDistance(a2, b2) {
68335           return a2.distance - b2.distance;
68336         });
68337         result = result.concat(localResults);
68338         (_geocodeResults || []).forEach(function(d2) {
68339           if (d2.osm_type && d2.osm_id) {
68340             var id3 = osmEntity.id.fromOSM(d2.osm_type, d2.osm_id);
68341             var tags = {};
68342             tags[d2.class] = d2.type;
68343             var attrs = { id: id3, type: d2.osm_type, tags };
68344             if (d2.osm_type === "way") {
68345               attrs.nodes = ["a", "a"];
68346             }
68347             var tempEntity = osmEntity(attrs);
68348             var tempGraph = coreGraph([tempEntity]);
68349             var matched2 = _mainPresetIndex.match(tempEntity, tempGraph);
68350             var type3 = matched2 && matched2.name() || utilDisplayType(id3);
68351             result.push({
68352               id: tempEntity.id,
68353               geometry: tempEntity.geometry(tempGraph),
68354               type: type3,
68355               name: d2.display_name,
68356               extent: new geoExtent(
68357                 [Number(d2.boundingbox[3]), Number(d2.boundingbox[0])],
68358                 [Number(d2.boundingbox[2]), Number(d2.boundingbox[1])]
68359               )
68360             });
68361           }
68362         });
68363         if (q2.match(/^[0-9]+$/)) {
68364           result.push({
68365             id: "n" + q2,
68366             geometry: "point",
68367             type: _t("inspector.node"),
68368             name: q2
68369           });
68370           result.push({
68371             id: "w" + q2,
68372             geometry: "line",
68373             type: _t("inspector.way"),
68374             name: q2
68375           });
68376           result.push({
68377             id: "r" + q2,
68378             geometry: "relation",
68379             type: _t("inspector.relation"),
68380             name: q2
68381           });
68382         }
68383         return result;
68384       }
68385       function drawList() {
68386         var value = search.property("value");
68387         var results = features();
68388         list.classed("filtered", value.length);
68389         var resultsIndicator = list.selectAll(".no-results-item").data([0]).enter().append("button").property("disabled", true).attr("class", "no-results-item").call(svgIcon("#iD-icon-alert", "pre-text"));
68390         resultsIndicator.append("span").attr("class", "entity-name");
68391         list.selectAll(".no-results-item .entity-name").html("").call(_t.append("geocoder.no_results_worldwide"));
68392         if (services.geocoder) {
68393           list.selectAll(".geocode-item").data([0]).enter().append("button").attr("class", "geocode-item secondary-action").on("click", geocoderSearch).append("div").attr("class", "label").append("span").attr("class", "entity-name").call(_t.append("geocoder.search"));
68394         }
68395         list.selectAll(".no-results-item").style("display", value.length && !results.length ? "block" : "none");
68396         list.selectAll(".geocode-item").style("display", value && _geocodeResults === void 0 ? "block" : "none");
68397         list.selectAll(".feature-list-item").data([-1]).remove();
68398         var items = list.selectAll(".feature-list-item").data(results, function(d2) {
68399           return d2.id;
68400         });
68401         var enter = items.enter().insert("button", ".geocode-item").attr("class", "feature-list-item").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
68402         var label = enter.append("div").attr("class", "label");
68403         label.each(function(d2) {
68404           select_default2(this).call(svgIcon("#iD-icon-" + d2.geometry, "pre-text"));
68405         });
68406         label.append("span").attr("class", "entity-type").text(function(d2) {
68407           return d2.type;
68408         });
68409         label.append("span").attr("class", "entity-name").text(function(d2) {
68410           return d2.name;
68411         });
68412         enter.style("opacity", 0).transition().style("opacity", 1);
68413         items.order();
68414         items.exit().remove();
68415       }
68416       function mouseover(d3_event, d2) {
68417         if (d2.id === -1)
68418           return;
68419         utilHighlightEntities([d2.id], true, context);
68420       }
68421       function mouseout(d3_event, d2) {
68422         if (d2.id === -1)
68423           return;
68424         utilHighlightEntities([d2.id], false, context);
68425       }
68426       function click(d3_event, d2) {
68427         d3_event.preventDefault();
68428         if (d2.location) {
68429           context.map().centerZoomEase([d2.location[1], d2.location[0]], 19);
68430         } else if (d2.entity) {
68431           utilHighlightEntities([d2.id], false, context);
68432           context.enter(modeSelect(context, [d2.entity.id]));
68433           context.map().zoomToEase(d2.entity);
68434         } else {
68435           context.zoomToEntity(d2.id);
68436         }
68437       }
68438       function geocoderSearch() {
68439         services.geocoder.search(search.property("value"), function(err, resp) {
68440           _geocodeResults = resp || [];
68441           drawList();
68442         });
68443       }
68444     }
68445     return featureList;
68446   }
68447
68448   // modules/ui/improveOSM_comments.js
68449   function uiImproveOsmComments() {
68450     let _qaItem;
68451     function issueComments(selection2) {
68452       let comments = selection2.selectAll(".comments-container").data([0]);
68453       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
68454       services.improveOSM.getComments(_qaItem).then((d2) => {
68455         if (!d2.comments)
68456           return;
68457         const commentEnter = comments.selectAll(".comment").data(d2.comments).enter().append("div").attr("class", "comment");
68458         commentEnter.append("div").attr("class", "comment-avatar").call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
68459         const mainEnter = commentEnter.append("div").attr("class", "comment-main");
68460         const metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
68461         metadataEnter.append("div").attr("class", "comment-author").each(function(d4) {
68462           const osm = services.osm;
68463           let selection3 = select_default2(this);
68464           if (osm && d4.username) {
68465             selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d4.username)).attr("target", "_blank");
68466           }
68467           selection3.text((d5) => d5.username);
68468         });
68469         metadataEnter.append("div").attr("class", "comment-date").html((d4) => _t.html("note.status.commented", { when: localeDateString2(d4.timestamp) }));
68470         mainEnter.append("div").attr("class", "comment-text").append("p").text((d4) => d4.text);
68471       }).catch((err) => {
68472         console.log(err);
68473       });
68474     }
68475     function localeDateString2(s2) {
68476       if (!s2)
68477         return null;
68478       const options2 = { day: "numeric", month: "short", year: "numeric" };
68479       const d2 = new Date(s2 * 1e3);
68480       if (isNaN(d2.getTime()))
68481         return null;
68482       return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
68483     }
68484     issueComments.issue = function(val) {
68485       if (!arguments.length)
68486         return _qaItem;
68487       _qaItem = val;
68488       return issueComments;
68489     };
68490     return issueComments;
68491   }
68492
68493   // modules/ui/improveOSM_details.js
68494   function uiImproveOsmDetails(context) {
68495     let _qaItem;
68496     function issueDetail(d2) {
68497       if (d2.desc)
68498         return d2.desc;
68499       const issueKey = d2.issueKey;
68500       d2.replacements = d2.replacements || {};
68501       d2.replacements.default = { html: _t.html("inspector.unknown") };
68502       return _t.html("QA.improveOSM.error_types.".concat(issueKey, ".description"), d2.replacements);
68503     }
68504     function improveOsmDetails(selection2) {
68505       const details = selection2.selectAll(".error-details").data(
68506         _qaItem ? [_qaItem] : [],
68507         (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
68508       );
68509       details.exit().remove();
68510       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
68511       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
68512       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
68513       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
68514       let relatedEntities = [];
68515       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
68516         const link2 = select_default2(this);
68517         const isObjectLink = link2.classed("error_object_link");
68518         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
68519         const entity = context.hasEntity(entityID);
68520         relatedEntities.push(entityID);
68521         link2.on("mouseenter", () => {
68522           utilHighlightEntities([entityID], true, context);
68523         }).on("mouseleave", () => {
68524           utilHighlightEntities([entityID], false, context);
68525         }).on("click", (d3_event) => {
68526           d3_event.preventDefault();
68527           utilHighlightEntities([entityID], false, context);
68528           const osmlayer = context.layers().layer("osm");
68529           if (!osmlayer.enabled()) {
68530             osmlayer.enabled(true);
68531           }
68532           context.map().centerZoom(_qaItem.loc, 20);
68533           if (entity) {
68534             context.enter(modeSelect(context, [entityID]));
68535           } else {
68536             context.loadEntity(entityID, (err, result) => {
68537               if (err)
68538                 return;
68539               const entity2 = result.data.find((e3) => e3.id === entityID);
68540               if (entity2)
68541                 context.enter(modeSelect(context, [entityID]));
68542             });
68543           }
68544         });
68545         if (entity) {
68546           let name = utilDisplayName(entity);
68547           if (!name && !isObjectLink) {
68548             const preset = _mainPresetIndex.match(entity, context.graph());
68549             name = preset && !preset.isFallback() && preset.name();
68550           }
68551           if (name) {
68552             this.innerText = name;
68553           }
68554         }
68555       });
68556       context.features().forceVisible(relatedEntities);
68557       context.map().pan([0, 0]);
68558     }
68559     improveOsmDetails.issue = function(val) {
68560       if (!arguments.length)
68561         return _qaItem;
68562       _qaItem = val;
68563       return improveOsmDetails;
68564     };
68565     return improveOsmDetails;
68566   }
68567
68568   // modules/ui/improveOSM_header.js
68569   function uiImproveOsmHeader() {
68570     let _qaItem;
68571     function issueTitle(d2) {
68572       const issueKey = d2.issueKey;
68573       d2.replacements = d2.replacements || {};
68574       d2.replacements.default = { html: _t.html("inspector.unknown") };
68575       return _t.html("QA.improveOSM.error_types.".concat(issueKey, ".title"), d2.replacements);
68576     }
68577     function improveOsmHeader(selection2) {
68578       const header = selection2.selectAll(".qa-header").data(
68579         _qaItem ? [_qaItem] : [],
68580         (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
68581       );
68582       header.exit().remove();
68583       const headerEnter = header.enter().append("div").attr("class", "qa-header");
68584       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));
68585       svgEnter.append("polygon").attr("fill", "currentColor").attr("class", "qaItem-fill").attr("points", "16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6");
68586       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 : "");
68587       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
68588     }
68589     improveOsmHeader.issue = function(val) {
68590       if (!arguments.length)
68591         return _qaItem;
68592       _qaItem = val;
68593       return improveOsmHeader;
68594     };
68595     return improveOsmHeader;
68596   }
68597
68598   // modules/ui/improveOSM_editor.js
68599   function uiImproveOsmEditor(context) {
68600     const dispatch14 = dispatch_default("change");
68601     const qaDetails = uiImproveOsmDetails(context);
68602     const qaComments = uiImproveOsmComments(context);
68603     const qaHeader = uiImproveOsmHeader(context);
68604     let _qaItem;
68605     function improveOsmEditor(selection2) {
68606       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
68607       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
68608       headerEnter.append("h2").call(_t.append("QA.improveOSM.title"));
68609       let body = selection2.selectAll(".body").data([0]);
68610       body = body.enter().append("div").attr("class", "body").merge(body);
68611       const editor = body.selectAll(".qa-editor").data([0]);
68612       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(qaComments.issue(_qaItem)).call(improveOsmSaveSection);
68613     }
68614     function improveOsmSaveSection(selection2) {
68615       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
68616       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
68617       let saveSection = selection2.selectAll(".qa-save").data(
68618         isShown ? [_qaItem] : [],
68619         (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
68620       );
68621       saveSection.exit().remove();
68622       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
68623       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("note.newComment"));
68624       saveSectionEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("QA.keepRight.comment_placeholder")).attr("maxlength", 1e3).property("value", (d2) => d2.newComment).call(utilNoAuto).on("input", changeInput).on("blur", changeInput);
68625       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
68626       function changeInput() {
68627         const input = select_default2(this);
68628         let val = input.property("value").trim();
68629         if (val === "") {
68630           val = void 0;
68631         }
68632         _qaItem = _qaItem.update({ newComment: val });
68633         const qaService = services.improveOSM;
68634         if (qaService) {
68635           qaService.replaceItem(_qaItem);
68636         }
68637         saveSection.call(qaSaveButtons);
68638       }
68639     }
68640     function qaSaveButtons(selection2) {
68641       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
68642       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
68643       buttonSection.exit().remove();
68644       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
68645       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
68646       buttonEnter.append("button").attr("class", "button close-button action");
68647       buttonEnter.append("button").attr("class", "button ignore-button action");
68648       buttonSection = buttonSection.merge(buttonEnter);
68649       buttonSection.select(".comment-button").attr("disabled", (d2) => d2.newComment ? null : true).on("click.comment", function(d3_event, d2) {
68650         this.blur();
68651         const qaService = services.improveOSM;
68652         if (qaService) {
68653           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
68654         }
68655       });
68656       buttonSection.select(".close-button").html((d2) => {
68657         const andComment = d2.newComment ? "_comment" : "";
68658         return _t.html("QA.keepRight.close".concat(andComment));
68659       }).on("click.close", function(d3_event, d2) {
68660         this.blur();
68661         const qaService = services.improveOSM;
68662         if (qaService) {
68663           d2.newStatus = "SOLVED";
68664           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
68665         }
68666       });
68667       buttonSection.select(".ignore-button").html((d2) => {
68668         const andComment = d2.newComment ? "_comment" : "";
68669         return _t.html("QA.keepRight.ignore".concat(andComment));
68670       }).on("click.ignore", function(d3_event, d2) {
68671         this.blur();
68672         const qaService = services.improveOSM;
68673         if (qaService) {
68674           d2.newStatus = "INVALID";
68675           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
68676         }
68677       });
68678     }
68679     improveOsmEditor.error = function(val) {
68680       if (!arguments.length)
68681         return _qaItem;
68682       _qaItem = val;
68683       return improveOsmEditor;
68684     };
68685     return utilRebind(improveOsmEditor, dispatch14, "on");
68686   }
68687
68688   // modules/ui/preset_list.js
68689   function uiPresetList(context) {
68690     var dispatch14 = dispatch_default("cancel", "choose");
68691     var _entityIDs;
68692     var _currLoc;
68693     var _currentPresets;
68694     var _autofocus = false;
68695     function presetList(selection2) {
68696       if (!_entityIDs)
68697         return;
68698       var presets = _mainPresetIndex.matchAllGeometry(entityGeometries());
68699       selection2.html("");
68700       var messagewrap = selection2.append("div").attr("class", "header fillL");
68701       var message = messagewrap.append("h2").call(_t.append("inspector.choose"));
68702       var direction = _mainLocalizer.textDirection() === "rtl" ? "backward" : "forward";
68703       messagewrap.append("button").attr("class", "preset-choose").attr("title", _entityIDs.length === 1 ? _t("inspector.edit") : _t("inspector.edit_features")).on("click", function() {
68704         dispatch14.call("cancel", this);
68705       }).call(svgIcon("#iD-icon-".concat(direction)));
68706       function initialKeydown(d3_event) {
68707         if (search.property("value").length === 0 && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
68708           d3_event.preventDefault();
68709           d3_event.stopPropagation();
68710           operationDelete(context, _entityIDs)();
68711         } else if (search.property("value").length === 0 && (d3_event.ctrlKey || d3_event.metaKey) && d3_event.keyCode === utilKeybinding.keyCodes.z) {
68712           d3_event.preventDefault();
68713           d3_event.stopPropagation();
68714           context.undo();
68715         } else if (!d3_event.ctrlKey && !d3_event.metaKey) {
68716           select_default2(this).on("keydown", keydown);
68717           keydown.call(this, d3_event);
68718         }
68719       }
68720       function keydown(d3_event) {
68721         if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"] && // if insertion point is at the end of the string
68722         search.node().selectionStart === search.property("value").length) {
68723           d3_event.preventDefault();
68724           d3_event.stopPropagation();
68725           var buttons = list.selectAll(".preset-list-button");
68726           if (!buttons.empty())
68727             buttons.nodes()[0].focus();
68728         }
68729       }
68730       function keypress(d3_event) {
68731         var value = search.property("value");
68732         if (d3_event.keyCode === 13 && // ↩ Return
68733         value.length) {
68734           list.selectAll(".preset-list-item:first-child").each(function(d2) {
68735             d2.choose.call(this);
68736           });
68737         }
68738       }
68739       function inputevent() {
68740         var value = search.property("value");
68741         list.classed("filtered", value.length);
68742         var results, messageText;
68743         if (value.length) {
68744           results = presets.search(value, entityGeometries()[0], _currLoc);
68745           messageText = _t.html("inspector.results", {
68746             n: results.collection.length,
68747             search: value
68748           });
68749         } else {
68750           var entityPresets2 = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
68751           results = _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets2);
68752           messageText = _t.html("inspector.choose");
68753         }
68754         list.call(drawList, results);
68755         message.html(messageText);
68756       }
68757       var searchWrap = selection2.append("div").attr("class", "search-header");
68758       searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
68759       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));
68760       if (_autofocus) {
68761         search.node().focus();
68762         setTimeout(function() {
68763           search.node().focus();
68764         }, 0);
68765       }
68766       var listWrap = selection2.append("div").attr("class", "inspector-body");
68767       var entityPresets = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
68768       var list = listWrap.append("div").attr("class", "preset-list").call(drawList, _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets));
68769       context.features().on("change.preset-list", updateForFeatureHiddenState);
68770     }
68771     function drawList(list, presets) {
68772       presets = presets.matchAllGeometry(entityGeometries());
68773       var collection = presets.collection.reduce(function(collection2, preset) {
68774         if (!preset)
68775           return collection2;
68776         if (preset.members) {
68777           if (preset.members.collection.filter(function(preset2) {
68778             return preset2.addable();
68779           }).length > 1) {
68780             collection2.push(CategoryItem(preset));
68781           }
68782         } else if (preset.addable()) {
68783           collection2.push(PresetItem(preset));
68784         }
68785         return collection2;
68786       }, []);
68787       var items = list.selectAll(".preset-list-item").data(collection, function(d2) {
68788         return d2.preset.id;
68789       });
68790       items.order();
68791       items.exit().remove();
68792       items.enter().append("div").attr("class", function(item) {
68793         return "preset-list-item preset-" + item.preset.id.replace("/", "-");
68794       }).classed("current", function(item) {
68795         return _currentPresets.indexOf(item.preset) !== -1;
68796       }).each(function(item) {
68797         select_default2(this).call(item);
68798       }).style("opacity", 0).transition().style("opacity", 1);
68799       updateForFeatureHiddenState();
68800     }
68801     function itemKeydown(d3_event) {
68802       var item = select_default2(this.closest(".preset-list-item"));
68803       var parentItem = select_default2(item.node().parentNode.closest(".preset-list-item"));
68804       if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"]) {
68805         d3_event.preventDefault();
68806         d3_event.stopPropagation();
68807         var nextItem = select_default2(item.node().nextElementSibling);
68808         if (nextItem.empty()) {
68809           if (!parentItem.empty()) {
68810             nextItem = select_default2(parentItem.node().nextElementSibling);
68811           }
68812         } else if (select_default2(this).classed("expanded")) {
68813           nextItem = item.select(".subgrid .preset-list-item:first-child");
68814         }
68815         if (!nextItem.empty()) {
68816           nextItem.select(".preset-list-button").node().focus();
68817         }
68818       } else if (d3_event.keyCode === utilKeybinding.keyCodes["\u2191"]) {
68819         d3_event.preventDefault();
68820         d3_event.stopPropagation();
68821         var previousItem = select_default2(item.node().previousElementSibling);
68822         if (previousItem.empty()) {
68823           if (!parentItem.empty()) {
68824             previousItem = parentItem;
68825           }
68826         } else if (previousItem.select(".preset-list-button").classed("expanded")) {
68827           previousItem = previousItem.select(".subgrid .preset-list-item:last-child");
68828         }
68829         if (!previousItem.empty()) {
68830           previousItem.select(".preset-list-button").node().focus();
68831         } else {
68832           var search = select_default2(this.closest(".preset-list-pane")).select(".preset-search-input");
68833           search.node().focus();
68834         }
68835       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
68836         d3_event.preventDefault();
68837         d3_event.stopPropagation();
68838         if (!parentItem.empty()) {
68839           parentItem.select(".preset-list-button").node().focus();
68840         }
68841       } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
68842         d3_event.preventDefault();
68843         d3_event.stopPropagation();
68844         item.datum().choose.call(select_default2(this).node());
68845       }
68846     }
68847     function CategoryItem(preset) {
68848       var box, sublist, shown = false;
68849       function item(selection2) {
68850         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap category");
68851         function click() {
68852           var isExpanded = select_default2(this).classed("expanded");
68853           var iconName = isExpanded ? _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward" : "#iD-icon-down";
68854           select_default2(this).classed("expanded", !isExpanded).attr("title", !isExpanded ? _t("icons.collapse") : _t("icons.expand"));
68855           select_default2(this).selectAll("div.label-inner svg.icon use").attr("href", iconName);
68856           item.choose();
68857         }
68858         var geometries = entityGeometries();
68859         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) {
68860           if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
68861             d3_event.preventDefault();
68862             d3_event.stopPropagation();
68863             if (!select_default2(this).classed("expanded")) {
68864               click.call(this, d3_event);
68865             }
68866           } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
68867             d3_event.preventDefault();
68868             d3_event.stopPropagation();
68869             if (select_default2(this).classed("expanded")) {
68870               click.call(this, d3_event);
68871             }
68872           } else {
68873             itemKeydown.call(this, d3_event);
68874           }
68875         });
68876         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
68877         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");
68878         box = selection2.append("div").attr("class", "subgrid").style("max-height", "0px").style("opacity", 0);
68879         box.append("div").attr("class", "arrow");
68880         sublist = box.append("div").attr("class", "preset-list fillL3");
68881       }
68882       item.choose = function() {
68883         if (!box || !sublist)
68884           return;
68885         if (shown) {
68886           shown = false;
68887           box.transition().duration(200).style("opacity", "0").style("max-height", "0px").style("padding-bottom", "0px");
68888         } else {
68889           shown = true;
68890           var members = preset.members.matchAllGeometry(entityGeometries());
68891           sublist.call(drawList, members);
68892           box.transition().duration(200).style("opacity", "1").style("max-height", 200 + members.collection.length * 190 + "px").style("padding-bottom", "10px");
68893         }
68894       };
68895       item.preset = preset;
68896       return item;
68897     }
68898     function PresetItem(preset) {
68899       function item(selection2) {
68900         var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap");
68901         var geometries = entityGeometries();
68902         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);
68903         var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
68904         var nameparts = [
68905           preset.nameLabel(),
68906           preset.subtitleLabel()
68907         ].filter(Boolean);
68908         label.selectAll(".namepart").data(nameparts, (d2) => d2.stringId).enter().append("div").attr("class", "namepart").text("").each(function(d2) {
68909           d2(select_default2(this));
68910         });
68911         wrap2.call(item.reference.button);
68912         selection2.call(item.reference.body);
68913       }
68914       item.choose = function() {
68915         if (select_default2(this).classed("disabled"))
68916           return;
68917         if (!context.inIntro()) {
68918           _mainPresetIndex.setMostRecent(preset, entityGeometries()[0]);
68919         }
68920         context.perform(
68921           function(graph) {
68922             for (var i3 in _entityIDs) {
68923               var entityID = _entityIDs[i3];
68924               var oldPreset = _mainPresetIndex.match(graph.entity(entityID), graph);
68925               graph = actionChangePreset(entityID, oldPreset, preset)(graph);
68926             }
68927             return graph;
68928           },
68929           _t("operations.change_tags.annotation")
68930         );
68931         context.validator().validate();
68932         dispatch14.call("choose", this, preset);
68933       };
68934       item.help = function(d3_event) {
68935         d3_event.stopPropagation();
68936         item.reference.toggle();
68937       };
68938       item.preset = preset;
68939       item.reference = uiTagReference(preset.reference(), context);
68940       return item;
68941     }
68942     function updateForFeatureHiddenState() {
68943       if (!_entityIDs.every(context.hasEntity))
68944         return;
68945       var geometries = entityGeometries();
68946       var button = context.container().selectAll(".preset-list .preset-list-button");
68947       button.call(uiTooltip().destroyAny);
68948       button.each(function(item, index) {
68949         var hiddenPresetFeaturesId;
68950         for (var i3 in geometries) {
68951           hiddenPresetFeaturesId = context.features().isHiddenPreset(item.preset, geometries[i3]);
68952           if (hiddenPresetFeaturesId)
68953             break;
68954         }
68955         var isHiddenPreset = !context.inIntro() && !!hiddenPresetFeaturesId && (_currentPresets.length !== 1 || item.preset !== _currentPresets[0]);
68956         select_default2(this).classed("disabled", isHiddenPreset);
68957         if (isHiddenPreset) {
68958           var isAutoHidden = context.features().autoHidden(hiddenPresetFeaturesId);
68959           select_default2(this).call(
68960             uiTooltip().title(() => _t.append("inspector.hidden_preset." + (isAutoHidden ? "zoom" : "manual"), {
68961               features: _t("feature." + hiddenPresetFeaturesId + ".description")
68962             })).placement(index < 2 ? "bottom" : "top")
68963           );
68964         }
68965       });
68966     }
68967     presetList.autofocus = function(val) {
68968       if (!arguments.length)
68969         return _autofocus;
68970       _autofocus = val;
68971       return presetList;
68972     };
68973     presetList.entityIDs = function(val) {
68974       if (!arguments.length)
68975         return _entityIDs;
68976       _entityIDs = val;
68977       _currLoc = null;
68978       if (_entityIDs && _entityIDs.length) {
68979         const extent = _entityIDs.reduce(function(extent2, entityID) {
68980           var entity = context.graph().entity(entityID);
68981           return extent2.extend(entity.extent(context.graph()));
68982         }, geoExtent());
68983         _currLoc = extent.center();
68984         var presets = _entityIDs.map(function(entityID) {
68985           return _mainPresetIndex.match(context.entity(entityID), context.graph());
68986         });
68987         presetList.presets(presets);
68988       }
68989       return presetList;
68990     };
68991     presetList.presets = function(val) {
68992       if (!arguments.length)
68993         return _currentPresets;
68994       _currentPresets = val;
68995       return presetList;
68996     };
68997     function entityGeometries() {
68998       var counts = {};
68999       for (var i3 in _entityIDs) {
69000         var entityID = _entityIDs[i3];
69001         var entity = context.entity(entityID);
69002         var geometry = entity.geometry(context.graph());
69003         if (geometry === "vertex" && entity.isOnAddressLine(context.graph())) {
69004           geometry = "point";
69005         }
69006         if (!counts[geometry])
69007           counts[geometry] = 0;
69008         counts[geometry] += 1;
69009       }
69010       return Object.keys(counts).sort(function(geom1, geom2) {
69011         return counts[geom2] - counts[geom1];
69012       });
69013     }
69014     return utilRebind(presetList, dispatch14, "on");
69015   }
69016
69017   // modules/ui/view_on_osm.js
69018   function uiViewOnOSM(context) {
69019     var _what;
69020     function viewOnOSM(selection2) {
69021       var url;
69022       if (_what instanceof osmEntity) {
69023         url = context.connection().entityURL(_what);
69024       } else if (_what instanceof osmNote) {
69025         url = context.connection().noteURL(_what);
69026       }
69027       var data = !_what || _what.isNew() ? [] : [_what];
69028       var link2 = selection2.selectAll(".view-on-osm").data(data, function(d2) {
69029         return d2.id;
69030       });
69031       link2.exit().remove();
69032       var linkEnter = link2.enter().append("a").attr("class", "view-on-osm").attr("target", "_blank").attr("href", url).call(svgIcon("#iD-icon-out-link", "inline"));
69033       linkEnter.append("span").call(_t.append("inspector.view_on_osm"));
69034     }
69035     viewOnOSM.what = function(_2) {
69036       if (!arguments.length)
69037         return _what;
69038       _what = _2;
69039       return viewOnOSM;
69040     };
69041     return viewOnOSM;
69042   }
69043
69044   // modules/ui/inspector.js
69045   function uiInspector(context) {
69046     var presetList = uiPresetList(context);
69047     var entityEditor = uiEntityEditor(context);
69048     var wrap2 = select_default2(null), presetPane = select_default2(null), editorPane = select_default2(null);
69049     var _state = "select";
69050     var _entityIDs;
69051     var _newFeature = false;
69052     function inspector(selection2) {
69053       presetList.entityIDs(_entityIDs).autofocus(_newFeature).on("choose", inspector.setPreset).on("cancel", function() {
69054         inspector.setPreset();
69055       });
69056       entityEditor.state(_state).entityIDs(_entityIDs).on("choose", inspector.showList);
69057       wrap2 = selection2.selectAll(".panewrap").data([0]);
69058       var enter = wrap2.enter().append("div").attr("class", "panewrap");
69059       enter.append("div").attr("class", "preset-list-pane pane");
69060       enter.append("div").attr("class", "entity-editor-pane pane");
69061       wrap2 = wrap2.merge(enter);
69062       presetPane = wrap2.selectAll(".preset-list-pane");
69063       editorPane = wrap2.selectAll(".entity-editor-pane");
69064       function shouldDefaultToPresetList() {
69065         if (_state !== "select")
69066           return false;
69067         if (_entityIDs.length !== 1)
69068           return false;
69069         var entityID = _entityIDs[0];
69070         var entity = context.hasEntity(entityID);
69071         if (!entity)
69072           return false;
69073         if (entity.hasNonGeometryTags())
69074           return false;
69075         if (_newFeature)
69076           return true;
69077         if (entity.geometry(context.graph()) !== "vertex")
69078           return false;
69079         if (context.graph().parentRelations(entity).length)
69080           return false;
69081         if (context.validator().getEntityIssues(entityID).length)
69082           return false;
69083         if (entity.isHighwayIntersection(context.graph()))
69084           return false;
69085         return true;
69086       }
69087       if (shouldDefaultToPresetList()) {
69088         wrap2.style("right", "-100%");
69089         editorPane.classed("hide", true);
69090         presetPane.classed("hide", false).call(presetList);
69091       } else {
69092         wrap2.style("right", "0%");
69093         presetPane.classed("hide", true);
69094         editorPane.classed("hide", false).call(entityEditor);
69095       }
69096       var footer = selection2.selectAll(".footer").data([0]);
69097       footer = footer.enter().append("div").attr("class", "footer").merge(footer);
69098       footer.call(
69099         uiViewOnOSM(context).what(context.hasEntity(_entityIDs.length === 1 && _entityIDs[0]))
69100       );
69101     }
69102     inspector.showList = function(presets) {
69103       presetPane.classed("hide", false);
69104       wrap2.transition().styleTween("right", function() {
69105         return value_default("0%", "-100%");
69106       }).on("end", function() {
69107         editorPane.classed("hide", true);
69108       });
69109       if (presets) {
69110         presetList.presets(presets);
69111       }
69112       presetPane.call(presetList.autofocus(true));
69113     };
69114     inspector.setPreset = function(preset) {
69115       if (preset && preset.id === "type/multipolygon") {
69116         presetPane.call(presetList.autofocus(true));
69117       } else {
69118         editorPane.classed("hide", false);
69119         wrap2.transition().styleTween("right", function() {
69120           return value_default("-100%", "0%");
69121         }).on("end", function() {
69122           presetPane.classed("hide", true);
69123         });
69124         if (preset) {
69125           entityEditor.presets([preset]);
69126         }
69127         editorPane.call(entityEditor);
69128       }
69129     };
69130     inspector.state = function(val) {
69131       if (!arguments.length)
69132         return _state;
69133       _state = val;
69134       entityEditor.state(_state);
69135       context.container().selectAll(".field-help-body").remove();
69136       return inspector;
69137     };
69138     inspector.entityIDs = function(val) {
69139       if (!arguments.length)
69140         return _entityIDs;
69141       _entityIDs = val;
69142       return inspector;
69143     };
69144     inspector.newFeature = function(val) {
69145       if (!arguments.length)
69146         return _newFeature;
69147       _newFeature = val;
69148       return inspector;
69149     };
69150     return inspector;
69151   }
69152
69153   // modules/ui/keepRight_details.js
69154   function uiKeepRightDetails(context) {
69155     let _qaItem;
69156     function issueDetail(d2) {
69157       const { itemType, parentIssueType } = d2;
69158       const unknown = { html: _t.html("inspector.unknown") };
69159       let replacements = d2.replacements || {};
69160       replacements.default = unknown;
69161       if (_mainLocalizer.hasTextForStringId("QA.keepRight.errorTypes.".concat(itemType, ".title"))) {
69162         return _t.html("QA.keepRight.errorTypes.".concat(itemType, ".description"), replacements);
69163       } else {
69164         return _t.html("QA.keepRight.errorTypes.".concat(parentIssueType, ".description"), replacements);
69165       }
69166     }
69167     function keepRightDetails(selection2) {
69168       const details = selection2.selectAll(".error-details").data(
69169         _qaItem ? [_qaItem] : [],
69170         (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
69171       );
69172       details.exit().remove();
69173       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
69174       const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
69175       descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
69176       descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
69177       let relatedEntities = [];
69178       descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
69179         const link2 = select_default2(this);
69180         const isObjectLink = link2.classed("error_object_link");
69181         const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
69182         const entity = context.hasEntity(entityID);
69183         relatedEntities.push(entityID);
69184         link2.on("mouseenter", () => {
69185           utilHighlightEntities([entityID], true, context);
69186         }).on("mouseleave", () => {
69187           utilHighlightEntities([entityID], false, context);
69188         }).on("click", (d3_event) => {
69189           d3_event.preventDefault();
69190           utilHighlightEntities([entityID], false, context);
69191           const osmlayer = context.layers().layer("osm");
69192           if (!osmlayer.enabled()) {
69193             osmlayer.enabled(true);
69194           }
69195           context.map().centerZoomEase(_qaItem.loc, 20);
69196           if (entity) {
69197             context.enter(modeSelect(context, [entityID]));
69198           } else {
69199             context.loadEntity(entityID, (err, result) => {
69200               if (err)
69201                 return;
69202               const entity2 = result.data.find((e3) => e3.id === entityID);
69203               if (entity2)
69204                 context.enter(modeSelect(context, [entityID]));
69205             });
69206           }
69207         });
69208         if (entity) {
69209           let name = utilDisplayName(entity);
69210           if (!name && !isObjectLink) {
69211             const preset = _mainPresetIndex.match(entity, context.graph());
69212             name = preset && !preset.isFallback() && preset.name();
69213           }
69214           if (name) {
69215             this.innerText = name;
69216           }
69217         }
69218       });
69219       context.features().forceVisible(relatedEntities);
69220       context.map().pan([0, 0]);
69221     }
69222     keepRightDetails.issue = function(val) {
69223       if (!arguments.length)
69224         return _qaItem;
69225       _qaItem = val;
69226       return keepRightDetails;
69227     };
69228     return keepRightDetails;
69229   }
69230
69231   // modules/ui/keepRight_header.js
69232   function uiKeepRightHeader() {
69233     let _qaItem;
69234     function issueTitle(d2) {
69235       const { itemType, parentIssueType } = d2;
69236       const unknown = _t.html("inspector.unknown");
69237       let replacements = d2.replacements || {};
69238       replacements.default = { html: unknown };
69239       if (_mainLocalizer.hasTextForStringId("QA.keepRight.errorTypes.".concat(itemType, ".title"))) {
69240         return _t.html("QA.keepRight.errorTypes.".concat(itemType, ".title"), replacements);
69241       } else {
69242         return _t.html("QA.keepRight.errorTypes.".concat(parentIssueType, ".title"), replacements);
69243       }
69244     }
69245     function keepRightHeader(selection2) {
69246       const header = selection2.selectAll(".qa-header").data(
69247         _qaItem ? [_qaItem] : [],
69248         (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
69249       );
69250       header.exit().remove();
69251       const headerEnter = header.enter().append("div").attr("class", "qa-header");
69252       const iconEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d2) => d2.id < 0);
69253       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"));
69254       headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
69255     }
69256     keepRightHeader.issue = function(val) {
69257       if (!arguments.length)
69258         return _qaItem;
69259       _qaItem = val;
69260       return keepRightHeader;
69261     };
69262     return keepRightHeader;
69263   }
69264
69265   // modules/ui/view_on_keepRight.js
69266   function uiViewOnKeepRight() {
69267     let _qaItem;
69268     function viewOnKeepRight(selection2) {
69269       let url;
69270       if (services.keepRight && _qaItem instanceof QAItem) {
69271         url = services.keepRight.issueURL(_qaItem);
69272       }
69273       const link2 = selection2.selectAll(".view-on-keepRight").data(url ? [url] : []);
69274       link2.exit().remove();
69275       const linkEnter = link2.enter().append("a").attr("class", "view-on-keepRight").attr("target", "_blank").attr("rel", "noopener").attr("href", (d2) => d2).call(svgIcon("#iD-icon-out-link", "inline"));
69276       linkEnter.append("span").call(_t.append("inspector.view_on_keepRight"));
69277     }
69278     viewOnKeepRight.what = function(val) {
69279       if (!arguments.length)
69280         return _qaItem;
69281       _qaItem = val;
69282       return viewOnKeepRight;
69283     };
69284     return viewOnKeepRight;
69285   }
69286
69287   // modules/ui/keepRight_editor.js
69288   function uiKeepRightEditor(context) {
69289     const dispatch14 = dispatch_default("change");
69290     const qaDetails = uiKeepRightDetails(context);
69291     const qaHeader = uiKeepRightHeader(context);
69292     let _qaItem;
69293     function keepRightEditor(selection2) {
69294       const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
69295       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
69296       headerEnter.append("h2").call(_t.append("QA.keepRight.title"));
69297       let body = selection2.selectAll(".body").data([0]);
69298       body = body.enter().append("div").attr("class", "body").merge(body);
69299       const editor = body.selectAll(".qa-editor").data([0]);
69300       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(keepRightSaveSection);
69301       const footer = selection2.selectAll(".footer").data([0]);
69302       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnKeepRight(context).what(_qaItem));
69303     }
69304     function keepRightSaveSection(selection2) {
69305       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
69306       const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
69307       let saveSection = selection2.selectAll(".qa-save").data(
69308         isShown ? [_qaItem] : [],
69309         (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
69310       );
69311       saveSection.exit().remove();
69312       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
69313       saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("QA.keepRight.comment"));
69314       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);
69315       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
69316       function changeInput() {
69317         const input = select_default2(this);
69318         let val = input.property("value").trim();
69319         if (val === _qaItem.comment) {
69320           val = void 0;
69321         }
69322         _qaItem = _qaItem.update({ newComment: val });
69323         const qaService = services.keepRight;
69324         if (qaService) {
69325           qaService.replaceItem(_qaItem);
69326         }
69327         saveSection.call(qaSaveButtons);
69328       }
69329     }
69330     function qaSaveButtons(selection2) {
69331       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
69332       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
69333       buttonSection.exit().remove();
69334       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
69335       buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
69336       buttonEnter.append("button").attr("class", "button close-button action");
69337       buttonEnter.append("button").attr("class", "button ignore-button action");
69338       buttonSection = buttonSection.merge(buttonEnter);
69339       buttonSection.select(".comment-button").attr("disabled", (d2) => d2.newComment ? null : true).on("click.comment", function(d3_event, d2) {
69340         this.blur();
69341         const qaService = services.keepRight;
69342         if (qaService) {
69343           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
69344         }
69345       });
69346       buttonSection.select(".close-button").html((d2) => {
69347         const andComment = d2.newComment ? "_comment" : "";
69348         return _t.html("QA.keepRight.close".concat(andComment));
69349       }).on("click.close", function(d3_event, d2) {
69350         this.blur();
69351         const qaService = services.keepRight;
69352         if (qaService) {
69353           d2.newStatus = "ignore_t";
69354           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
69355         }
69356       });
69357       buttonSection.select(".ignore-button").html((d2) => {
69358         const andComment = d2.newComment ? "_comment" : "";
69359         return _t.html("QA.keepRight.ignore".concat(andComment));
69360       }).on("click.ignore", function(d3_event, d2) {
69361         this.blur();
69362         const qaService = services.keepRight;
69363         if (qaService) {
69364           d2.newStatus = "ignore";
69365           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
69366         }
69367       });
69368     }
69369     keepRightEditor.error = function(val) {
69370       if (!arguments.length)
69371         return _qaItem;
69372       _qaItem = val;
69373       return keepRightEditor;
69374     };
69375     return utilRebind(keepRightEditor, dispatch14, "on");
69376   }
69377
69378   // modules/ui/lasso.js
69379   function uiLasso(context) {
69380     var group, polygon2;
69381     lasso.coordinates = [];
69382     function lasso(selection2) {
69383       context.container().classed("lasso", true);
69384       group = selection2.append("g").attr("class", "lasso hide");
69385       polygon2 = group.append("path").attr("class", "lasso-path");
69386       group.call(uiToggle(true));
69387     }
69388     function draw() {
69389       if (polygon2) {
69390         polygon2.data([lasso.coordinates]).attr("d", function(d2) {
69391           return "M" + d2.join(" L") + " Z";
69392         });
69393       }
69394     }
69395     lasso.extent = function() {
69396       return lasso.coordinates.reduce(function(extent, point2) {
69397         return extent.extend(geoExtent(point2));
69398       }, geoExtent());
69399     };
69400     lasso.p = function(_2) {
69401       if (!arguments.length)
69402         return lasso;
69403       lasso.coordinates.push(_2);
69404       draw();
69405       return lasso;
69406     };
69407     lasso.close = function() {
69408       if (group) {
69409         group.call(uiToggle(false, function() {
69410           select_default2(this).remove();
69411         }));
69412       }
69413       context.container().classed("lasso", false);
69414     };
69415     return lasso;
69416   }
69417
69418   // modules/ui/note_comments.js
69419   function uiNoteComments() {
69420     var _note;
69421     function noteComments(selection2) {
69422       if (_note.isNew())
69423         return;
69424       var comments = selection2.selectAll(".comments-container").data([0]);
69425       comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
69426       var commentEnter = comments.selectAll(".comment").data(_note.comments).enter().append("div").attr("class", "comment");
69427       commentEnter.append("div").attr("class", function(d2) {
69428         return "comment-avatar user-" + d2.uid;
69429       }).call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
69430       var mainEnter = commentEnter.append("div").attr("class", "comment-main");
69431       var metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
69432       metadataEnter.append("div").attr("class", "comment-author").each(function(d2) {
69433         var selection3 = select_default2(this);
69434         var osm = services.osm;
69435         if (osm && d2.user) {
69436           selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d2.user)).attr("target", "_blank");
69437         }
69438         if (d2.user) {
69439           selection3.text(d2.user);
69440         } else {
69441           selection3.call(_t.append("note.anonymous"));
69442         }
69443       });
69444       metadataEnter.append("div").attr("class", "comment-date").html(function(d2) {
69445         return _t.html("note.status." + d2.action, { when: localeDateString2(d2.date) });
69446       });
69447       mainEnter.append("div").attr("class", "comment-text").html(function(d2) {
69448         return d2.html;
69449       }).selectAll("a").attr("rel", "noopener nofollow").attr("target", "_blank");
69450       comments.call(replaceAvatars);
69451     }
69452     function replaceAvatars(selection2) {
69453       var showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
69454       var osm = services.osm;
69455       if (showThirdPartyIcons !== "true" || !osm)
69456         return;
69457       var uids = {};
69458       _note.comments.forEach(function(d2) {
69459         if (d2.uid)
69460           uids[d2.uid] = true;
69461       });
69462       Object.keys(uids).forEach(function(uid) {
69463         osm.loadUser(uid, function(err, user) {
69464           if (!user || !user.image_url)
69465             return;
69466           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);
69467         });
69468       });
69469     }
69470     function localeDateString2(s2) {
69471       if (!s2)
69472         return null;
69473       var options2 = { day: "numeric", month: "short", year: "numeric" };
69474       s2 = s2.replace(/-/g, "/");
69475       var d2 = new Date(s2);
69476       if (isNaN(d2.getTime()))
69477         return null;
69478       return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
69479     }
69480     noteComments.note = function(val) {
69481       if (!arguments.length)
69482         return _note;
69483       _note = val;
69484       return noteComments;
69485     };
69486     return noteComments;
69487   }
69488
69489   // modules/ui/note_header.js
69490   function uiNoteHeader() {
69491     var _note;
69492     function noteHeader(selection2) {
69493       var header = selection2.selectAll(".note-header").data(
69494         _note ? [_note] : [],
69495         function(d2) {
69496           return d2.status + d2.id;
69497         }
69498       );
69499       header.exit().remove();
69500       var headerEnter = header.enter().append("div").attr("class", "note-header");
69501       var iconEnter = headerEnter.append("div").attr("class", function(d2) {
69502         return "note-header-icon " + d2.status;
69503       }).classed("new", function(d2) {
69504         return d2.id < 0;
69505       });
69506       iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-note", "note-fill"));
69507       iconEnter.each(function(d2) {
69508         var statusIcon;
69509         if (d2.id < 0) {
69510           statusIcon = "#iD-icon-plus";
69511         } else if (d2.status === "open") {
69512           statusIcon = "#iD-icon-close";
69513         } else {
69514           statusIcon = "#iD-icon-apply";
69515         }
69516         iconEnter.append("div").attr("class", "note-icon-annotation").attr("title", _t("icons.close")).call(svgIcon(statusIcon, "icon-annotation"));
69517       });
69518       headerEnter.append("div").attr("class", "note-header-label").html(function(d2) {
69519         if (_note.isNew()) {
69520           return _t.html("note.new");
69521         }
69522         return _t.html("note.note") + " " + d2.id + " " + (d2.status === "closed" ? _t.html("note.closed") : "");
69523       });
69524     }
69525     noteHeader.note = function(val) {
69526       if (!arguments.length)
69527         return _note;
69528       _note = val;
69529       return noteHeader;
69530     };
69531     return noteHeader;
69532   }
69533
69534   // modules/ui/note_report.js
69535   function uiNoteReport() {
69536     var _note;
69537     function noteReport(selection2) {
69538       var url;
69539       if (services.osm && _note instanceof osmNote && !_note.isNew()) {
69540         url = services.osm.noteReportURL(_note);
69541       }
69542       var link2 = selection2.selectAll(".note-report").data(url ? [url] : []);
69543       link2.exit().remove();
69544       var linkEnter = link2.enter().append("a").attr("class", "note-report").attr("target", "_blank").attr("href", function(d2) {
69545         return d2;
69546       }).call(svgIcon("#iD-icon-out-link", "inline"));
69547       linkEnter.append("span").call(_t.append("note.report"));
69548     }
69549     noteReport.note = function(val) {
69550       if (!arguments.length)
69551         return _note;
69552       _note = val;
69553       return noteReport;
69554     };
69555     return noteReport;
69556   }
69557
69558   // modules/ui/note_editor.js
69559   function uiNoteEditor(context) {
69560     var dispatch14 = dispatch_default("change");
69561     var noteComments = uiNoteComments(context);
69562     var noteHeader = uiNoteHeader();
69563     var _note;
69564     var _newNote;
69565     function noteEditor(selection2) {
69566       var header = selection2.selectAll(".header").data([0]);
69567       var headerEnter = header.enter().append("div").attr("class", "header fillL");
69568       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
69569         context.enter(modeBrowse(context));
69570       }).call(svgIcon("#iD-icon-close"));
69571       headerEnter.append("h2").call(_t.append("note.title"));
69572       var body = selection2.selectAll(".body").data([0]);
69573       body = body.enter().append("div").attr("class", "body").merge(body);
69574       var editor = body.selectAll(".note-editor").data([0]);
69575       editor.enter().append("div").attr("class", "modal-section note-editor").merge(editor).call(noteHeader.note(_note)).call(noteComments.note(_note)).call(noteSaveSection);
69576       var footer = selection2.selectAll(".footer").data([0]);
69577       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOSM(context).what(_note)).call(uiNoteReport(context).note(_note));
69578       var osm = services.osm;
69579       if (osm) {
69580         osm.on("change.note-save", function() {
69581           selection2.call(noteEditor);
69582         });
69583       }
69584     }
69585     function noteSaveSection(selection2) {
69586       var isSelected = _note && _note.id === context.selectedNoteID();
69587       var noteSave = selection2.selectAll(".note-save").data(isSelected ? [_note] : [], function(d2) {
69588         return d2.status + d2.id;
69589       });
69590       noteSave.exit().remove();
69591       var noteSaveEnter = noteSave.enter().append("div").attr("class", "note-save save-section cf");
69592       noteSaveEnter.append("h4").attr("class", ".note-save-header").html(function() {
69593         return _note.isNew() ? _t.html("note.newDescription") : _t.html("note.newComment");
69594       });
69595       var commentTextarea = noteSaveEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("note.inputPlaceholder")).attr("maxlength", 1e3).property("value", function(d2) {
69596         return d2.newComment;
69597       }).call(utilNoAuto).on("keydown.note-input", keydown).on("input.note-input", changeInput).on("blur.note-input", changeInput);
69598       if (!commentTextarea.empty() && _newNote) {
69599         commentTextarea.node().focus();
69600       }
69601       noteSave = noteSaveEnter.merge(noteSave).call(userDetails).call(noteSaveButtons);
69602       function keydown(d3_event) {
69603         if (!(d3_event.keyCode === 13 && // ↩ Return
69604         d3_event.metaKey))
69605           return;
69606         var osm = services.osm;
69607         if (!osm)
69608           return;
69609         var hasAuth = osm.authenticated();
69610         if (!hasAuth)
69611           return;
69612         if (!_note.newComment)
69613           return;
69614         d3_event.preventDefault();
69615         select_default2(this).on("keydown.note-input", null);
69616         window.setTimeout(function() {
69617           if (_note.isNew()) {
69618             noteSave.selectAll(".save-button").node().focus();
69619             clickSave(_note);
69620           } else {
69621             noteSave.selectAll(".comment-button").node().focus();
69622             clickComment(_note);
69623           }
69624         }, 10);
69625       }
69626       function changeInput() {
69627         var input = select_default2(this);
69628         var val = input.property("value").trim() || void 0;
69629         _note = _note.update({ newComment: val });
69630         var osm = services.osm;
69631         if (osm) {
69632           osm.replaceNote(_note);
69633         }
69634         noteSave.call(noteSaveButtons);
69635       }
69636     }
69637     function userDetails(selection2) {
69638       var detailSection = selection2.selectAll(".detail-section").data([0]);
69639       detailSection = detailSection.enter().append("div").attr("class", "detail-section").merge(detailSection);
69640       var osm = services.osm;
69641       if (!osm)
69642         return;
69643       var hasAuth = osm.authenticated();
69644       var authWarning = detailSection.selectAll(".auth-warning").data(hasAuth ? [] : [0]);
69645       authWarning.exit().transition().duration(200).style("opacity", 0).remove();
69646       var authEnter = authWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning auth-warning").style("opacity", 0);
69647       authEnter.call(svgIcon("#iD-icon-alert", "inline"));
69648       authEnter.append("span").call(_t.append("note.login"));
69649       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) {
69650         d3_event.preventDefault();
69651         osm.authenticate();
69652       });
69653       authEnter.transition().duration(200).style("opacity", 1);
69654       var prose = detailSection.selectAll(".note-save-prose").data(hasAuth ? [0] : []);
69655       prose.exit().remove();
69656       prose = prose.enter().append("p").attr("class", "note-save-prose").call(_t.append("note.upload_explanation")).merge(prose);
69657       osm.userDetails(function(err, user) {
69658         if (err)
69659           return;
69660         var userLink = select_default2(document.createElement("div"));
69661         if (user.image_url) {
69662           userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
69663         }
69664         userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
69665         prose.html(_t.html("note.upload_explanation_with_user", { user: { html: userLink.html() } }));
69666       });
69667     }
69668     function noteSaveButtons(selection2) {
69669       var osm = services.osm;
69670       var hasAuth = osm && osm.authenticated();
69671       var isSelected = _note && _note.id === context.selectedNoteID();
69672       var buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_note] : [], function(d2) {
69673         return d2.status + d2.id;
69674       });
69675       buttonSection.exit().remove();
69676       var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
69677       if (_note.isNew()) {
69678         buttonEnter.append("button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
69679         buttonEnter.append("button").attr("class", "button save-button action").call(_t.append("note.save"));
69680       } else {
69681         buttonEnter.append("button").attr("class", "button status-button action");
69682         buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("note.comment"));
69683       }
69684       buttonSection = buttonSection.merge(buttonEnter);
69685       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
69686       buttonSection.select(".save-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
69687       buttonSection.select(".status-button").attr("disabled", hasAuth ? null : true).html(function(d2) {
69688         var action = d2.status === "open" ? "close" : "open";
69689         var andComment = d2.newComment ? "_comment" : "";
69690         return _t.html("note." + action + andComment);
69691       }).on("click.status", clickStatus);
69692       buttonSection.select(".comment-button").attr("disabled", isSaveDisabled).on("click.comment", clickComment);
69693       function isSaveDisabled(d2) {
69694         return hasAuth && d2.status === "open" && d2.newComment ? null : true;
69695       }
69696     }
69697     function clickCancel(d3_event, d2) {
69698       this.blur();
69699       var osm = services.osm;
69700       if (osm) {
69701         osm.removeNote(d2);
69702       }
69703       context.enter(modeBrowse(context));
69704       dispatch14.call("change");
69705     }
69706     function clickSave(d3_event, d2) {
69707       this.blur();
69708       var osm = services.osm;
69709       if (osm) {
69710         osm.postNoteCreate(d2, function(err, note) {
69711           dispatch14.call("change", note);
69712         });
69713       }
69714     }
69715     function clickStatus(d3_event, d2) {
69716       this.blur();
69717       var osm = services.osm;
69718       if (osm) {
69719         var setStatus = d2.status === "open" ? "closed" : "open";
69720         osm.postNoteUpdate(d2, setStatus, function(err, note) {
69721           dispatch14.call("change", note);
69722         });
69723       }
69724     }
69725     function clickComment(d3_event, d2) {
69726       this.blur();
69727       var osm = services.osm;
69728       if (osm) {
69729         osm.postNoteUpdate(d2, d2.status, function(err, note) {
69730           dispatch14.call("change", note);
69731         });
69732       }
69733     }
69734     noteEditor.note = function(val) {
69735       if (!arguments.length)
69736         return _note;
69737       _note = val;
69738       return noteEditor;
69739     };
69740     noteEditor.newNote = function(val) {
69741       if (!arguments.length)
69742         return _newNote;
69743       _newNote = val;
69744       return noteEditor;
69745     };
69746     return utilRebind(noteEditor, dispatch14, "on");
69747   }
69748
69749   // modules/ui/source_switch.js
69750   function uiSourceSwitch(context) {
69751     var keys2;
69752     function click(d3_event) {
69753       d3_event.preventDefault();
69754       var osm = context.connection();
69755       if (!osm)
69756         return;
69757       if (context.inIntro())
69758         return;
69759       if (context.history().hasChanges() && !window.confirm(_t("source_switch.lose_changes")))
69760         return;
69761       var isLive = select_default2(this).classed("live");
69762       isLive = !isLive;
69763       context.enter(modeBrowse(context));
69764       context.history().clearSaved();
69765       context.flush();
69766       select_default2(this).html(isLive ? _t.html("source_switch.live") : _t.html("source_switch.dev")).classed("live", isLive).classed("chip", isLive);
69767       osm.switch(isLive ? keys2[0] : keys2[1]);
69768     }
69769     var sourceSwitch = function(selection2) {
69770       selection2.append("a").attr("href", "#").call(_t.append("source_switch.live")).attr("class", "live chip").on("click", click);
69771     };
69772     sourceSwitch.keys = function(_2) {
69773       if (!arguments.length)
69774         return keys2;
69775       keys2 = _2;
69776       return sourceSwitch;
69777     };
69778     return sourceSwitch;
69779   }
69780
69781   // modules/ui/spinner.js
69782   function uiSpinner(context) {
69783     var osm = context.connection();
69784     return function(selection2) {
69785       var img = selection2.append("img").attr("src", context.imagePath("loader-black.gif")).style("opacity", 0);
69786       if (osm) {
69787         osm.on("loading.spinner", function() {
69788           img.transition().style("opacity", 1);
69789         }).on("loaded.spinner", function() {
69790           img.transition().style("opacity", 0);
69791         });
69792       }
69793     };
69794   }
69795
69796   // modules/ui/sections/privacy.js
69797   function uiSectionPrivacy(context) {
69798     let section = uiSection("preferences-third-party", context).label(() => _t.append("preferences.privacy.title")).disclosureContent(renderDisclosureContent);
69799     function renderDisclosureContent(selection2) {
69800       selection2.selectAll(".privacy-options-list").data([0]).enter().append("ul").attr("class", "layer-list privacy-options-list");
69801       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(
69802         uiTooltip().title(() => _t.append("preferences.privacy.third_party_icons.tooltip")).placement("bottom")
69803       );
69804       thirdPartyIconsEnter.append("input").attr("type", "checkbox").on("change", (d3_event, d2) => {
69805         d3_event.preventDefault();
69806         corePreferences("preferences.privacy.thirdpartyicons", d2 === "true" ? "false" : "true");
69807       });
69808       thirdPartyIconsEnter.append("span").call(_t.append("preferences.privacy.third_party_icons.description"));
69809       selection2.selectAll(".privacy-third-party-icons-item").classed("active", (d2) => d2 === "true").select("input").property("checked", (d2) => d2 === "true");
69810       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"));
69811     }
69812     corePreferences.onChange("preferences.privacy.thirdpartyicons", section.reRender);
69813     return section;
69814   }
69815
69816   // modules/ui/splash.js
69817   function uiSplash(context) {
69818     return (selection2) => {
69819       if (context.history().hasRestorableChanges())
69820         return;
69821       let updateMessage = "";
69822       const sawPrivacyVersion = corePreferences("sawPrivacyVersion");
69823       let showSplash = !corePreferences("sawSplash");
69824       if (sawPrivacyVersion !== context.privacyVersion) {
69825         updateMessage = _t("splash.privacy_update");
69826         showSplash = true;
69827       }
69828       if (!showSplash)
69829         return;
69830       corePreferences("sawSplash", true);
69831       corePreferences("sawPrivacyVersion", context.privacyVersion);
69832       _mainFileFetcher.get("intro_graph");
69833       let modalSelection = uiModal(selection2);
69834       modalSelection.select(".modal").attr("class", "modal-splash modal");
69835       let introModal = modalSelection.select(".content").append("div").attr("class", "fillL");
69836       introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("splash.welcome"));
69837       let modalSection = introModal.append("div").attr("class", "modal-section");
69838       modalSection.append("p").html(_t.html("splash.text", {
69839         version: context.version,
69840         website: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/develop/CHANGELOG.md#whats-new">' + _t.html("splash.changelog") + "</a>" },
69841         github: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/issues">github.com</a>' }
69842       }));
69843       modalSection.append("p").html(_t.html("splash.privacy", {
69844         updateMessage,
69845         privacyLink: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/release/PRIVACY.md">' + _t("splash.privacy_policy") + "</a>" }
69846       }));
69847       uiSectionPrivacy(context).label(() => _t.append("splash.privacy_settings")).render(modalSection);
69848       let buttonWrap = introModal.append("div").attr("class", "modal-actions");
69849       let walkthrough = buttonWrap.append("button").attr("class", "walkthrough").on("click", () => {
69850         context.container().call(uiIntro(context));
69851         modalSelection.close();
69852       });
69853       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
69854       walkthrough.append("div").call(_t.append("splash.walkthrough"));
69855       let startEditing = buttonWrap.append("button").attr("class", "start-editing").on("click", modalSelection.close);
69856       startEditing.append("svg").attr("class", "logo logo-features").append("use").attr("xlink:href", "#iD-logo-features");
69857       startEditing.append("div").call(_t.append("splash.start"));
69858       modalSelection.select("button.close").attr("class", "hide");
69859     };
69860   }
69861
69862   // modules/ui/status.js
69863   function uiStatus(context) {
69864     var osm = context.connection();
69865     return function(selection2) {
69866       if (!osm)
69867         return;
69868       function update(err, apiStatus) {
69869         selection2.html("");
69870         if (err) {
69871           if (apiStatus === "connectionSwitched") {
69872             return;
69873           } else if (apiStatus === "rateLimited") {
69874             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) {
69875               d3_event.preventDefault();
69876               osm.authenticate();
69877             });
69878           } else {
69879             var throttledRetry = throttle_default(function() {
69880               context.loadTiles(context.projection);
69881               osm.reloadApiStatus();
69882             }, 2e3);
69883             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) {
69884               d3_event.preventDefault();
69885               throttledRetry();
69886             });
69887           }
69888         } else if (apiStatus === "readonly") {
69889           selection2.call(_t.append("osm_api_status.message.readonly"));
69890         } else if (apiStatus === "offline") {
69891           selection2.call(_t.append("osm_api_status.message.offline"));
69892         }
69893         selection2.attr("class", "api-status " + (err ? "error" : apiStatus));
69894       }
69895       osm.on("apiStatusChange.uiStatus", update);
69896       context.history().on("storage_error", () => {
69897         selection2.selectAll("span.local-storage-full").remove();
69898         selection2.append("span").attr("class", "local-storage-full").call(_t.append("osm_api_status.message.local_storage_full"));
69899         selection2.classed("error", true);
69900       });
69901       window.setInterval(function() {
69902         osm.reloadApiStatus();
69903       }, 9e4);
69904       osm.reloadApiStatus();
69905     };
69906   }
69907
69908   // node_modules/osm-community-index/lib/simplify.js
69909   var import_diacritics2 = __toESM(require_diacritics(), 1);
69910   function simplify(str2) {
69911     if (typeof str2 !== "string")
69912       return "";
69913     return import_diacritics2.default.remove(
69914       str2.replace(/&/g, "and").replace(/(İ|i̇)/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u2000-\u206f\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e7f\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase()
69915     );
69916   }
69917
69918   // node_modules/osm-community-index/lib/resolve_strings.js
69919   function resolveStrings(item, defaults, localizerFn) {
69920     let itemStrings = Object.assign({}, item.strings);
69921     let defaultStrings = Object.assign({}, defaults[item.type]);
69922     const anyToken = new RegExp(/(\{\w+\})/, "gi");
69923     if (localizerFn) {
69924       if (itemStrings.community) {
69925         const communityID = simplify(itemStrings.community);
69926         itemStrings.community = localizerFn("_communities.".concat(communityID));
69927       }
69928       ["name", "description", "extendedDescription"].forEach((prop) => {
69929         if (defaultStrings[prop])
69930           defaultStrings[prop] = localizerFn("_defaults.".concat(item.type, ".").concat(prop));
69931         if (itemStrings[prop])
69932           itemStrings[prop] = localizerFn("".concat(item.id, ".").concat(prop));
69933       });
69934     }
69935     let replacements = {
69936       account: item.account,
69937       community: itemStrings.community,
69938       signupUrl: itemStrings.signupUrl,
69939       url: itemStrings.url
69940     };
69941     if (!replacements.signupUrl) {
69942       replacements.signupUrl = resolve(itemStrings.signupUrl || defaultStrings.signupUrl);
69943     }
69944     if (!replacements.url) {
69945       replacements.url = resolve(itemStrings.url || defaultStrings.url);
69946     }
69947     let resolved = {
69948       name: resolve(itemStrings.name || defaultStrings.name),
69949       url: resolve(itemStrings.url || defaultStrings.url),
69950       signupUrl: resolve(itemStrings.signupUrl || defaultStrings.signupUrl),
69951       description: resolve(itemStrings.description || defaultStrings.description),
69952       extendedDescription: resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription)
69953     };
69954     resolved.nameHTML = linkify(resolved.url, resolved.name);
69955     resolved.urlHTML = linkify(resolved.url);
69956     resolved.signupUrlHTML = linkify(resolved.signupUrl);
69957     resolved.descriptionHTML = resolve(itemStrings.description || defaultStrings.description, true);
69958     resolved.extendedDescriptionHTML = resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription, true);
69959     return resolved;
69960     function resolve(s2, addLinks) {
69961       if (!s2)
69962         return void 0;
69963       let result = s2;
69964       for (let key in replacements) {
69965         const token = "{".concat(key, "}");
69966         const regex = new RegExp(token, "g");
69967         if (regex.test(result)) {
69968           let replacement = replacements[key];
69969           if (!replacement) {
69970             throw new Error("Cannot resolve token: ".concat(token));
69971           } else {
69972             if (addLinks && (key === "signupUrl" || key === "url")) {
69973               replacement = linkify(replacement);
69974             }
69975             result = result.replace(regex, replacement);
69976           }
69977         }
69978       }
69979       const leftovers = result.match(anyToken);
69980       if (leftovers) {
69981         throw new Error("Cannot resolve tokens: ".concat(leftovers));
69982       }
69983       if (addLinks && item.type === "reddit") {
69984         result = result.replace(/(\/r\/\w+\/*)/i, (match) => linkify(resolved.url, match));
69985       }
69986       return result;
69987     }
69988     function linkify(url, text2) {
69989       if (!url)
69990         return void 0;
69991       text2 = text2 || url;
69992       return '<a target="_blank" href="'.concat(url, '">').concat(text2, "</a>");
69993     }
69994   }
69995
69996   // modules/ui/success.js
69997   var _oci = null;
69998   function uiSuccess(context) {
69999     const MAXEVENTS = 2;
70000     const dispatch14 = dispatch_default("cancel");
70001     let _changeset2;
70002     let _location;
70003     ensureOSMCommunityIndex();
70004     function ensureOSMCommunityIndex() {
70005       const data = _mainFileFetcher;
70006       return Promise.all([
70007         data.get("oci_features"),
70008         data.get("oci_resources"),
70009         data.get("oci_defaults")
70010       ]).then((vals) => {
70011         if (_oci)
70012           return _oci;
70013         if (vals[0] && Array.isArray(vals[0].features)) {
70014           _sharedLocationManager.mergeCustomGeoJSON(vals[0]);
70015         }
70016         let ociResources = Object.values(vals[1].resources);
70017         if (ociResources.length) {
70018           return _sharedLocationManager.mergeLocationSets(ociResources).then(() => {
70019             _oci = {
70020               resources: ociResources,
70021               defaults: vals[2].defaults
70022             };
70023             return _oci;
70024           });
70025         } else {
70026           _oci = {
70027             resources: [],
70028             // no resources?
70029             defaults: vals[2].defaults
70030           };
70031           return _oci;
70032         }
70033       });
70034     }
70035     function parseEventDate(when) {
70036       if (!when)
70037         return;
70038       let raw = when.trim();
70039       if (!raw)
70040         return;
70041       if (!/Z$/.test(raw)) {
70042         raw += "Z";
70043       }
70044       const parsed = new Date(raw);
70045       return new Date(parsed.toUTCString().slice(0, 25));
70046     }
70047     function success(selection2) {
70048       let header = selection2.append("div").attr("class", "header fillL");
70049       header.append("h2").call(_t.append("success.just_edited"));
70050       header.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => dispatch14.call("cancel")).call(svgIcon("#iD-icon-close"));
70051       let body = selection2.append("div").attr("class", "body save-success fillL");
70052       let summary = body.append("div").attr("class", "save-summary");
70053       summary.append("h3").call(_t.append("success.thank_you" + (_location ? "_location" : ""), { where: _location }));
70054       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"));
70055       let osm = context.connection();
70056       if (!osm)
70057         return;
70058       let changesetURL = osm.changesetURL(_changeset2.id);
70059       let table = summary.append("table").attr("class", "summary-table");
70060       let row = table.append("tr").attr("class", "summary-row");
70061       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");
70062       let summaryDetail = row.append("td").attr("class", "cell-detail summary-detail");
70063       summaryDetail.append("a").attr("class", "cell-detail summary-view-on-osm").attr("target", "_blank").attr("href", changesetURL).call(_t.append("success.view_on_osm"));
70064       summaryDetail.append("div").html(_t.html("success.changeset_id", {
70065         changeset_id: { html: '<a href="'.concat(changesetURL, '" target="_blank">').concat(_changeset2.id, "</a>") }
70066       }));
70067       ensureOSMCommunityIndex().then((oci) => {
70068         const loc = context.map().center();
70069         const validHere = _sharedLocationManager.locationSetsAt(loc);
70070         let communities = [];
70071         oci.resources.forEach((resource) => {
70072           let area = validHere[resource.locationSetID];
70073           if (!area)
70074             return;
70075           const localizer = (stringID) => _t.html("community.".concat(stringID));
70076           resource.resolved = resolveStrings(resource, oci.defaults, localizer);
70077           communities.push({
70078             area,
70079             order: resource.order || 0,
70080             resource
70081           });
70082         });
70083         communities.sort((a2, b2) => a2.area - b2.area || b2.order - a2.order);
70084         body.call(showCommunityLinks, communities.map((c2) => c2.resource));
70085       });
70086     }
70087     function showCommunityLinks(selection2, resources) {
70088       let communityLinks = selection2.append("div").attr("class", "save-communityLinks");
70089       communityLinks.append("h3").call(_t.append("success.like_osm"));
70090       let table = communityLinks.append("table").attr("class", "community-table");
70091       let row = table.selectAll(".community-row").data(resources);
70092       let rowEnter = row.enter().append("tr").attr("class", "community-row");
70093       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));
70094       let communityDetail = rowEnter.append("td").attr("class", "cell-detail community-detail");
70095       communityDetail.each(showCommunityDetails);
70096       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"));
70097     }
70098     function showCommunityDetails(d2) {
70099       let selection2 = select_default2(this);
70100       let communityID = d2.id;
70101       selection2.append("div").attr("class", "community-name").html(d2.resolved.nameHTML);
70102       selection2.append("div").attr("class", "community-description").html(d2.resolved.descriptionHTML);
70103       if (d2.resolved.extendedDescriptionHTML || d2.languageCodes && d2.languageCodes.length) {
70104         selection2.append("div").call(
70105           uiDisclosure(context, "community-more-".concat(d2.id), false).expanded(false).updatePreference(false).label(() => _t.append("success.more")).content(showMore)
70106         );
70107       }
70108       let nextEvents = (d2.events || []).map((event) => {
70109         event.date = parseEventDate(event.when);
70110         return event;
70111       }).filter((event) => {
70112         const t2 = event.date.getTime();
70113         const now3 = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
70114         return !isNaN(t2) && t2 >= now3;
70115       }).sort((a2, b2) => {
70116         return a2.date < b2.date ? -1 : a2.date > b2.date ? 1 : 0;
70117       }).slice(0, MAXEVENTS);
70118       if (nextEvents.length) {
70119         selection2.append("div").call(
70120           uiDisclosure(context, "community-events-".concat(d2.id), false).expanded(false).updatePreference(false).label(_t.html("success.events")).content(showNextEvents)
70121         ).select(".hide-toggle").append("span").attr("class", "badge-text").text(nextEvents.length);
70122       }
70123       function showMore(selection3) {
70124         let more = selection3.selectAll(".community-more").data([0]);
70125         let moreEnter = more.enter().append("div").attr("class", "community-more");
70126         if (d2.resolved.extendedDescriptionHTML) {
70127           moreEnter.append("div").attr("class", "community-extended-description").html(d2.resolved.extendedDescriptionHTML);
70128         }
70129         if (d2.languageCodes && d2.languageCodes.length) {
70130           const languageList = d2.languageCodes.map((code) => _mainLocalizer.languageName(code)).join(", ");
70131           moreEnter.append("div").attr("class", "community-languages").call(_t.append("success.languages", { languages: languageList }));
70132         }
70133       }
70134       function showNextEvents(selection3) {
70135         let events = selection3.append("div").attr("class", "community-events");
70136         let item = events.selectAll(".community-event").data(nextEvents);
70137         let itemEnter = item.enter().append("div").attr("class", "community-event");
70138         itemEnter.append("div").attr("class", "community-event-name").append("a").attr("target", "_blank").attr("href", (d4) => d4.url).text((d4) => {
70139           let name = d4.name;
70140           if (d4.i18n && d4.id) {
70141             name = _t("community.".concat(communityID, ".events.").concat(d4.id, ".name"), { default: name });
70142           }
70143           return name;
70144         });
70145         itemEnter.append("div").attr("class", "community-event-when").text((d4) => {
70146           let options2 = { weekday: "short", day: "numeric", month: "short", year: "numeric" };
70147           if (d4.date.getHours() || d4.date.getMinutes()) {
70148             options2.hour = "numeric";
70149             options2.minute = "numeric";
70150           }
70151           return d4.date.toLocaleString(_mainLocalizer.localeCode(), options2);
70152         });
70153         itemEnter.append("div").attr("class", "community-event-where").text((d4) => {
70154           let where = d4.where;
70155           if (d4.i18n && d4.id) {
70156             where = _t("community.".concat(communityID, ".events.").concat(d4.id, ".where"), { default: where });
70157           }
70158           return where;
70159         });
70160         itemEnter.append("div").attr("class", "community-event-description").text((d4) => {
70161           let description = d4.description;
70162           if (d4.i18n && d4.id) {
70163             description = _t("community.".concat(communityID, ".events.").concat(d4.id, ".description"), { default: description });
70164           }
70165           return description;
70166         });
70167       }
70168     }
70169     success.changeset = function(val) {
70170       if (!arguments.length)
70171         return _changeset2;
70172       _changeset2 = val;
70173       return success;
70174     };
70175     success.location = function(val) {
70176       if (!arguments.length)
70177         return _location;
70178       _location = val;
70179       return success;
70180     };
70181     return utilRebind(success, dispatch14, "on");
70182   }
70183
70184   // modules/ui/version.js
70185   var sawVersion = null;
70186   var isNewVersion = false;
70187   var isNewUser = false;
70188   function uiVersion(context) {
70189     var currVersion = context.version;
70190     var matchedVersion = currVersion.match(/\d+\.\d+\.\d+.*/);
70191     if (sawVersion === null && matchedVersion !== null) {
70192       if (corePreferences("sawVersion")) {
70193         isNewUser = false;
70194         isNewVersion = corePreferences("sawVersion") !== currVersion && currVersion.indexOf("-") === -1;
70195       } else {
70196         isNewUser = true;
70197         isNewVersion = true;
70198       }
70199       corePreferences("sawVersion", currVersion);
70200       sawVersion = currVersion;
70201     }
70202     return function(selection2) {
70203       selection2.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD").text(currVersion);
70204       if (isNewVersion && !isNewUser) {
70205         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(
70206           uiTooltip().title(() => _t.append("version.whats_new", { version: currVersion })).placement("top").scrollContainer(context.container().select(".main-footer-wrap"))
70207         );
70208       }
70209     };
70210   }
70211
70212   // modules/ui/zoom.js
70213   function uiZoom(context) {
70214     var zooms = [{
70215       id: "zoom-in",
70216       icon: "iD-icon-plus",
70217       title: _t.append("zoom.in"),
70218       action: zoomIn,
70219       disabled: function() {
70220         return !context.map().canZoomIn();
70221       },
70222       disabledTitle: _t.append("zoom.disabled.in"),
70223       key: "+"
70224     }, {
70225       id: "zoom-out",
70226       icon: "iD-icon-minus",
70227       title: _t.append("zoom.out"),
70228       action: zoomOut,
70229       disabled: function() {
70230         return !context.map().canZoomOut();
70231       },
70232       disabledTitle: _t.append("zoom.disabled.out"),
70233       key: "-"
70234     }];
70235     function zoomIn(d3_event) {
70236       if (d3_event.shiftKey)
70237         return;
70238       d3_event.preventDefault();
70239       context.map().zoomIn();
70240     }
70241     function zoomOut(d3_event) {
70242       if (d3_event.shiftKey)
70243         return;
70244       d3_event.preventDefault();
70245       context.map().zoomOut();
70246     }
70247     function zoomInFurther(d3_event) {
70248       if (d3_event.shiftKey)
70249         return;
70250       d3_event.preventDefault();
70251       context.map().zoomInFurther();
70252     }
70253     function zoomOutFurther(d3_event) {
70254       if (d3_event.shiftKey)
70255         return;
70256       d3_event.preventDefault();
70257       context.map().zoomOutFurther();
70258     }
70259     return function(selection2) {
70260       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function(d2) {
70261         if (d2.disabled()) {
70262           return d2.disabledTitle;
70263         }
70264         return d2.title;
70265       }).keys(function(d2) {
70266         return [d2.key];
70267       });
70268       var lastPointerUpType;
70269       var buttons = selection2.selectAll("button").data(zooms).enter().append("button").attr("class", function(d2) {
70270         return d2.id;
70271       }).on("pointerup.editor", function(d3_event) {
70272         lastPointerUpType = d3_event.pointerType;
70273       }).on("click.editor", function(d3_event, d2) {
70274         if (!d2.disabled()) {
70275           d2.action(d3_event);
70276         } else if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
70277           context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass("disabled").label(d2.disabledTitle)();
70278         }
70279         lastPointerUpType = null;
70280       }).call(tooltipBehavior);
70281       buttons.each(function(d2) {
70282         select_default2(this).call(svgIcon("#" + d2.icon, "light"));
70283       });
70284       utilKeybinding.plusKeys.forEach(function(key) {
70285         context.keybinding().on([key], zoomIn);
70286         context.keybinding().on([uiCmd("\u2325" + key)], zoomInFurther);
70287       });
70288       utilKeybinding.minusKeys.forEach(function(key) {
70289         context.keybinding().on([key], zoomOut);
70290         context.keybinding().on([uiCmd("\u2325" + key)], zoomOutFurther);
70291       });
70292       function updateButtonStates() {
70293         buttons.classed("disabled", function(d2) {
70294           return d2.disabled();
70295         }).each(function() {
70296           var selection3 = select_default2(this);
70297           if (!selection3.select(".tooltip.in").empty()) {
70298             selection3.call(tooltipBehavior.updateContent);
70299           }
70300         });
70301       }
70302       updateButtonStates();
70303       context.map().on("move.uiZoom", updateButtonStates);
70304     };
70305   }
70306
70307   // modules/ui/sections/raw_tag_editor.js
70308   function uiSectionRawTagEditor(id2, context) {
70309     var section = uiSection(id2, context).classes("raw-tag-editor").label(function() {
70310       var count = Object.keys(_tags).filter(function(d2) {
70311         return d2;
70312       }).length;
70313       return _t.append("inspector.title_count", { title: _t("inspector.tags"), count });
70314     }).expandedByDefault(false).disclosureContent(renderDisclosureContent);
70315     var taginfo = services.taginfo;
70316     var dispatch14 = dispatch_default("change");
70317     var availableViews = [
70318       { id: "list", icon: "#fas-th-list" },
70319       { id: "text", icon: "#fas-i-cursor" }
70320     ];
70321     let _discardTags = {};
70322     _mainFileFetcher.get("discarded").then((d2) => {
70323       _discardTags = d2;
70324     }).catch(() => {
70325     });
70326     var _tagView = corePreferences("raw-tag-editor-view") || "list";
70327     var _readOnlyTags = [];
70328     var _orderedKeys = [];
70329     var _showBlank = false;
70330     var _pendingChange = null;
70331     var _state;
70332     var _presets;
70333     var _tags;
70334     var _entityIDs;
70335     var _didInteract = false;
70336     function interacted() {
70337       _didInteract = true;
70338     }
70339     function renderDisclosureContent(wrap2) {
70340       _orderedKeys = _orderedKeys.filter(function(key) {
70341         return _tags[key] !== void 0;
70342       });
70343       var all = Object.keys(_tags).sort();
70344       var missingKeys = utilArrayDifference(all, _orderedKeys);
70345       for (var i3 in missingKeys) {
70346         _orderedKeys.push(missingKeys[i3]);
70347       }
70348       var rowData = _orderedKeys.map(function(key, i4) {
70349         return { index: i4, key, value: _tags[key] };
70350       });
70351       if (!rowData.length || _showBlank) {
70352         _showBlank = false;
70353         rowData.push({ index: rowData.length, key: "", value: "" });
70354       }
70355       var options2 = wrap2.selectAll(".raw-tag-options").data([0]);
70356       options2.exit().remove();
70357       var optionsEnter = options2.enter().insert("div", ":first-child").attr("class", "raw-tag-options").attr("role", "tablist");
70358       var optionEnter = optionsEnter.selectAll(".raw-tag-option").data(availableViews, function(d2) {
70359         return d2.id;
70360       }).enter();
70361       optionEnter.append("button").attr("class", function(d2) {
70362         return "raw-tag-option raw-tag-option-" + d2.id + (_tagView === d2.id ? " selected" : "");
70363       }).attr("aria-selected", function(d2) {
70364         return _tagView === d2.id;
70365       }).attr("role", "tab").attr("title", function(d2) {
70366         return _t("icons." + d2.id);
70367       }).on("click", function(d3_event, d2) {
70368         _tagView = d2.id;
70369         corePreferences("raw-tag-editor-view", d2.id);
70370         wrap2.selectAll(".raw-tag-option").classed("selected", function(datum2) {
70371           return datum2 === d2;
70372         }).attr("aria-selected", function(datum2) {
70373           return datum2 === d2;
70374         });
70375         wrap2.selectAll(".tag-text").classed("hide", d2.id !== "text").each(setTextareaHeight);
70376         wrap2.selectAll(".tag-list, .add-row").classed("hide", d2.id !== "list");
70377       }).each(function(d2) {
70378         select_default2(this).call(svgIcon(d2.icon));
70379       });
70380       var textData = rowsToText(rowData);
70381       var textarea = wrap2.selectAll(".tag-text").data([0]);
70382       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);
70383       textarea.call(utilGetSetValue, textData).each(setTextareaHeight).on("input", setTextareaHeight).on("focus", interacted).on("blur", textChanged).on("change", textChanged);
70384       var list = wrap2.selectAll(".tag-list").data([0]);
70385       list = list.enter().append("ul").attr("class", "tag-list" + (_tagView !== "list" ? " hide" : "")).merge(list);
70386       var addRowEnter = wrap2.selectAll(".add-row").data([0]).enter().append("div").attr("class", "add-row" + (_tagView !== "list" ? " hide" : ""));
70387       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);
70388       addRowEnter.append("div").attr("class", "space-value");
70389       addRowEnter.append("div").attr("class", "space-buttons");
70390       var items = list.selectAll(".tag-row").data(rowData, function(d2) {
70391         return d2.key;
70392       });
70393       items.exit().each(unbind).remove();
70394       var itemsEnter = items.enter().append("li").attr("class", "tag-row").classed("readonly", isReadOnly);
70395       var innerWrap = itemsEnter.append("div").attr("class", "inner-wrap");
70396       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);
70397       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);
70398       innerWrap.append("button").attr("class", "form-field-button remove").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
70399       items = items.merge(itemsEnter).sort(function(a2, b2) {
70400         return a2.index - b2.index;
70401       });
70402       items.each(function(d2) {
70403         var row = select_default2(this);
70404         var key = row.select("input.key");
70405         var value = row.select("input.value");
70406         if (_entityIDs && taginfo && _state !== "hover") {
70407           bindTypeahead(key, value);
70408         }
70409         var referenceOptions = { key: d2.key };
70410         if (typeof d2.value === "string") {
70411           referenceOptions.value = d2.value;
70412         }
70413         var reference = uiTagReference(referenceOptions, context);
70414         if (_state === "hover") {
70415           reference.showing(false);
70416         }
70417         row.select(".inner-wrap").call(reference.button);
70418         row.call(reference.body);
70419         row.select("button.remove");
70420       });
70421       items.selectAll("input.key").attr("title", function(d2) {
70422         return d2.key;
70423       }).call(utilGetSetValue, function(d2) {
70424         return d2.key;
70425       }).attr("readonly", function(d2) {
70426         return isReadOnly(d2) || null;
70427       });
70428       items.selectAll("input.value").attr("title", function(d2) {
70429         return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : d2.value;
70430       }).classed("mixed", function(d2) {
70431         return Array.isArray(d2.value);
70432       }).attr("placeholder", function(d2) {
70433         return typeof d2.value === "string" ? null : _t("inspector.multiple_values");
70434       }).call(utilGetSetValue, function(d2) {
70435         return typeof d2.value === "string" ? d2.value : "";
70436       }).attr("readonly", function(d2) {
70437         return isReadOnly(d2) || null;
70438       });
70439       items.selectAll("button.remove").on(
70440         ("PointerEvent" in window ? "pointer" : "mouse") + "down",
70441         // 'click' fires too late - #5878
70442         (d3_event, d2) => {
70443           if (d3_event.button !== 0)
70444             return;
70445           removeTag(d3_event, d2);
70446         }
70447       );
70448     }
70449     function isReadOnly(d2) {
70450       for (var i3 = 0; i3 < _readOnlyTags.length; i3++) {
70451         if (d2.key.match(_readOnlyTags[i3]) !== null) {
70452           return true;
70453         }
70454       }
70455       return false;
70456     }
70457     function setTextareaHeight() {
70458       if (_tagView !== "text")
70459         return;
70460       var selection2 = select_default2(this);
70461       var matches = selection2.node().value.match(/\n/g);
70462       var lineCount = 2 + Number(matches && matches.length);
70463       var lineHeight = 20;
70464       selection2.style("height", lineCount * lineHeight + "px");
70465     }
70466     function stringify3(s2) {
70467       return JSON.stringify(s2).slice(1, -1);
70468     }
70469     function unstringify(s2) {
70470       var leading = "";
70471       var trailing = "";
70472       if (s2.length < 1 || s2.charAt(0) !== '"') {
70473         leading = '"';
70474       }
70475       if (s2.length < 2 || s2.charAt(s2.length - 1) !== '"' || s2.charAt(s2.length - 1) === '"' && s2.charAt(s2.length - 2) === "\\") {
70476         trailing = '"';
70477       }
70478       return JSON.parse(leading + s2 + trailing);
70479     }
70480     function rowsToText(rows) {
70481       var str2 = rows.filter(function(row) {
70482         return row.key && row.key.trim() !== "";
70483       }).map(function(row) {
70484         var rawVal = row.value;
70485         if (typeof rawVal !== "string")
70486           rawVal = "*";
70487         var val = rawVal ? stringify3(rawVal) : "";
70488         return stringify3(row.key) + "=" + val;
70489       }).join("\n");
70490       if (_state !== "hover" && str2.length) {
70491         return str2 + "\n";
70492       }
70493       return str2;
70494     }
70495     function textChanged() {
70496       var newText = this.value.trim();
70497       var newTags = {};
70498       newText.split("\n").forEach(function(row) {
70499         var m2 = row.match(/^\s*([^=]+)=(.*)$/);
70500         if (m2 !== null) {
70501           var k2 = context.cleanTagKey(unstringify(m2[1].trim()));
70502           var v2 = context.cleanTagValue(unstringify(m2[2].trim()));
70503           newTags[k2] = v2;
70504         }
70505       });
70506       var tagDiff = utilTagDiff(_tags, newTags);
70507       if (!tagDiff.length)
70508         return;
70509       _pendingChange = _pendingChange || {};
70510       tagDiff.forEach(function(change) {
70511         if (isReadOnly({ key: change.key }))
70512           return;
70513         if (change.newVal === "*" && typeof change.oldVal !== "string")
70514           return;
70515         if (change.type === "-") {
70516           _pendingChange[change.key] = void 0;
70517         } else if (change.type === "+") {
70518           _pendingChange[change.key] = change.newVal || "";
70519         }
70520       });
70521       if (Object.keys(_pendingChange).length === 0) {
70522         _pendingChange = null;
70523         return;
70524       }
70525       scheduleChange();
70526     }
70527     function pushMore(d3_event) {
70528       if (d3_event.keyCode === 9 && !d3_event.shiftKey && section.selection().selectAll(".tag-list li:last-child input.value").node() === this && utilGetSetValue(select_default2(this))) {
70529         addTag();
70530       }
70531     }
70532     function bindTypeahead(key, value) {
70533       if (isReadOnly(key.datum()))
70534         return;
70535       if (Array.isArray(value.datum().value)) {
70536         value.call(uiCombobox(context, "tag-value").minItems(1).fetcher(function(value2, callback) {
70537           var keyString = utilGetSetValue(key);
70538           if (!_tags[keyString])
70539             return;
70540           var data = _tags[keyString].filter(Boolean).map(function(tagValue) {
70541             return {
70542               value: tagValue,
70543               title: tagValue
70544             };
70545           });
70546           callback(data);
70547         }));
70548         return;
70549       }
70550       var geometry = context.graph().geometry(_entityIDs[0]);
70551       key.call(uiCombobox(context, "tag-key").fetcher(function(value2, callback) {
70552         taginfo.keys({
70553           debounce: true,
70554           geometry,
70555           query: value2
70556         }, function(err, data) {
70557           if (!err) {
70558             const filtered = data.filter((d2) => _tags[d2.value] === void 0).filter((d2) => !(d2.value in _discardTags)).filter((d2) => d2.value.toLowerCase().includes(value2.toLowerCase()));
70559             callback(sort(value2, filtered));
70560           }
70561         });
70562       }));
70563       value.call(uiCombobox(context, "tag-value").fetcher(function(value2, callback) {
70564         taginfo.values({
70565           debounce: true,
70566           key: utilGetSetValue(key),
70567           geometry,
70568           query: value2
70569         }, function(err, data) {
70570           if (!err) {
70571             const filtered = data.filter((d2) => d2.value.toLowerCase().includes(value2.toLowerCase()));
70572             callback(sort(value2, filtered));
70573           }
70574         });
70575       }).caseSensitive(allowUpperCaseTagValues.test(utilGetSetValue(key))));
70576       function sort(value2, data) {
70577         var sameletter = [];
70578         var other = [];
70579         for (var i3 = 0; i3 < data.length; i3++) {
70580           if (data[i3].value.substring(0, value2.length) === value2) {
70581             sameletter.push(data[i3]);
70582           } else {
70583             other.push(data[i3]);
70584           }
70585         }
70586         return sameletter.concat(other);
70587       }
70588     }
70589     function unbind() {
70590       var row = select_default2(this);
70591       row.selectAll("input.key").call(uiCombobox.off, context);
70592       row.selectAll("input.value").call(uiCombobox.off, context);
70593     }
70594     function keyChange(d3_event, d2) {
70595       if (select_default2(this).attr("readonly"))
70596         return;
70597       var kOld = d2.key;
70598       if (_pendingChange && _pendingChange.hasOwnProperty(kOld) && _pendingChange[kOld] === void 0)
70599         return;
70600       var kNew = context.cleanTagKey(this.value.trim());
70601       if (isReadOnly({ key: kNew })) {
70602         this.value = kOld;
70603         return;
70604       }
70605       if (kNew && kNew !== kOld && _tags[kNew] !== void 0) {
70606         this.value = kOld;
70607         section.selection().selectAll(".tag-list input.value").each(function(d4) {
70608           if (d4.key === kNew) {
70609             var input = select_default2(this).node();
70610             input.focus();
70611             input.select();
70612           }
70613         });
70614         return;
70615       }
70616       _pendingChange = _pendingChange || {};
70617       if (kOld) {
70618         if (kOld === kNew)
70619           return;
70620         _pendingChange[kNew] = _pendingChange[kOld] || { oldKey: kOld };
70621         _pendingChange[kOld] = void 0;
70622       } else {
70623         let row = this.parentNode.parentNode;
70624         let inputVal = select_default2(row).selectAll("input.value");
70625         let vNew = context.cleanTagValue(utilGetSetValue(inputVal));
70626         _pendingChange[kNew] = vNew;
70627         utilGetSetValue(inputVal, vNew);
70628       }
70629       var existingKeyIndex = _orderedKeys.indexOf(kOld);
70630       if (existingKeyIndex !== -1)
70631         _orderedKeys[existingKeyIndex] = kNew;
70632       d2.key = kNew;
70633       this.value = kNew;
70634       scheduleChange();
70635     }
70636     function valueChange(d3_event, d2) {
70637       if (isReadOnly(d2))
70638         return;
70639       if (typeof d2.value !== "string" && !this.value)
70640         return;
70641       if (_pendingChange && _pendingChange.hasOwnProperty(d2.key) && _pendingChange[d2.key] === void 0)
70642         return;
70643       _pendingChange = _pendingChange || {};
70644       _pendingChange[d2.key] = context.cleanTagValue(this.value);
70645       scheduleChange();
70646     }
70647     function removeTag(d3_event, d2) {
70648       if (isReadOnly(d2))
70649         return;
70650       if (d2.key === "") {
70651         _showBlank = false;
70652         section.reRender();
70653       } else {
70654         _orderedKeys = _orderedKeys.filter(function(key) {
70655           return key !== d2.key;
70656         });
70657         _pendingChange = _pendingChange || {};
70658         _pendingChange[d2.key] = void 0;
70659         scheduleChange();
70660       }
70661     }
70662     function addTag() {
70663       window.setTimeout(function() {
70664         _showBlank = true;
70665         section.reRender();
70666         section.selection().selectAll(".tag-list li:last-child input.key").node().focus();
70667       }, 20);
70668     }
70669     function scheduleChange() {
70670       var entityIDs = _entityIDs;
70671       window.setTimeout(function() {
70672         if (!_pendingChange)
70673           return;
70674         dispatch14.call("change", this, entityIDs, _pendingChange);
70675         _pendingChange = null;
70676       }, 10);
70677     }
70678     section.state = function(val) {
70679       if (!arguments.length)
70680         return _state;
70681       if (_state !== val) {
70682         _orderedKeys = [];
70683         _state = val;
70684       }
70685       return section;
70686     };
70687     section.presets = function(val) {
70688       if (!arguments.length)
70689         return _presets;
70690       _presets = val;
70691       if (_presets && _presets.length && _presets[0].isFallback()) {
70692         section.disclosureExpanded(true);
70693       } else if (!_didInteract) {
70694         section.disclosureExpanded(null);
70695       }
70696       return section;
70697     };
70698     section.tags = function(val) {
70699       if (!arguments.length)
70700         return _tags;
70701       _tags = val;
70702       return section;
70703     };
70704     section.entityIDs = function(val) {
70705       if (!arguments.length)
70706         return _entityIDs;
70707       if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
70708         _entityIDs = val;
70709         _orderedKeys = [];
70710       }
70711       return section;
70712     };
70713     section.readOnlyTags = function(val) {
70714       if (!arguments.length)
70715         return _readOnlyTags;
70716       _readOnlyTags = val;
70717       return section;
70718     };
70719     return utilRebind(section, dispatch14, "on");
70720   }
70721
70722   // modules/ui/data_editor.js
70723   function uiDataEditor(context) {
70724     var dataHeader = uiDataHeader();
70725     var rawTagEditor = uiSectionRawTagEditor("custom-data-tag-editor", context).expandedByDefault(true).readOnlyTags([/./]);
70726     var _datum;
70727     function dataEditor(selection2) {
70728       var header = selection2.selectAll(".header").data([0]);
70729       var headerEnter = header.enter().append("div").attr("class", "header fillL");
70730       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
70731         context.enter(modeBrowse(context));
70732       }).call(svgIcon("#iD-icon-close"));
70733       headerEnter.append("h2").call(_t.append("map_data.title"));
70734       var body = selection2.selectAll(".body").data([0]);
70735       body = body.enter().append("div").attr("class", "body").merge(body);
70736       var editor = body.selectAll(".data-editor").data([0]);
70737       editor.enter().append("div").attr("class", "modal-section data-editor").merge(editor).call(dataHeader.datum(_datum));
70738       var rte = body.selectAll(".raw-tag-editor").data([0]);
70739       rte.enter().append("div").attr("class", "raw-tag-editor data-editor").merge(rte).call(
70740         rawTagEditor.tags(_datum && _datum.properties || {}).state("hover").render
70741       ).selectAll("textarea.tag-text").attr("readonly", true).classed("readonly", true);
70742     }
70743     dataEditor.datum = function(val) {
70744       if (!arguments.length)
70745         return _datum;
70746       _datum = val;
70747       return this;
70748     };
70749     return dataEditor;
70750   }
70751
70752   // modules/ui/osmose_details.js
70753   function uiOsmoseDetails(context) {
70754     let _qaItem;
70755     function issueString(d2, type2) {
70756       if (!d2)
70757         return "";
70758       const s2 = services.osmose.getStrings(d2.itemType);
70759       return type2 in s2 ? s2[type2] : "";
70760     }
70761     function osmoseDetails(selection2) {
70762       const details = selection2.selectAll(".error-details").data(
70763         _qaItem ? [_qaItem] : [],
70764         (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
70765       );
70766       details.exit().remove();
70767       const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
70768       if (issueString(_qaItem, "detail")) {
70769         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
70770         div.append("h4").call(_t.append("QA.keepRight.detail_description"));
70771         div.append("p").attr("class", "qa-details-description-text").html((d2) => issueString(d2, "detail")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
70772       }
70773       const detailsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
70774       const elemsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
70775       if (issueString(_qaItem, "fix")) {
70776         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
70777         div.append("h4").call(_t.append("QA.osmose.fix_title"));
70778         div.append("p").html((d2) => issueString(d2, "fix")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
70779       }
70780       if (issueString(_qaItem, "trap")) {
70781         const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
70782         div.append("h4").call(_t.append("QA.osmose.trap_title"));
70783         div.append("p").html((d2) => issueString(d2, "trap")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
70784       }
70785       const thisItem = _qaItem;
70786       services.osmose.loadIssueDetail(_qaItem).then((d2) => {
70787         if (!d2.elems || d2.elems.length === 0)
70788           return;
70789         if (context.selectedErrorID() !== thisItem.id && context.container().selectAll(".qaItem.osmose.hover.itemId-".concat(thisItem.id)).empty())
70790           return;
70791         if (d2.detail) {
70792           detailsDiv.append("h4").call(_t.append("QA.osmose.detail_title"));
70793           detailsDiv.append("p").html((d4) => d4.detail).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
70794         }
70795         elemsDiv.append("h4").call(_t.append("QA.osmose.elems_title"));
70796         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() {
70797           const link2 = select_default2(this);
70798           const entityID = this.textContent;
70799           const entity = context.hasEntity(entityID);
70800           link2.on("mouseenter", () => {
70801             utilHighlightEntities([entityID], true, context);
70802           }).on("mouseleave", () => {
70803             utilHighlightEntities([entityID], false, context);
70804           }).on("click", (d3_event) => {
70805             d3_event.preventDefault();
70806             utilHighlightEntities([entityID], false, context);
70807             const osmlayer = context.layers().layer("osm");
70808             if (!osmlayer.enabled()) {
70809               osmlayer.enabled(true);
70810             }
70811             context.map().centerZoom(d2.loc, 20);
70812             if (entity) {
70813               context.enter(modeSelect(context, [entityID]));
70814             } else {
70815               context.loadEntity(entityID, (err, result) => {
70816                 if (err)
70817                   return;
70818                 const entity2 = result.data.find((e3) => e3.id === entityID);
70819                 if (entity2)
70820                   context.enter(modeSelect(context, [entityID]));
70821               });
70822             }
70823           });
70824           if (entity) {
70825             let name = utilDisplayName(entity);
70826             if (!name) {
70827               const preset = _mainPresetIndex.match(entity, context.graph());
70828               name = preset && !preset.isFallback() && preset.name();
70829             }
70830             if (name) {
70831               this.innerText = name;
70832             }
70833           }
70834         });
70835         context.features().forceVisible(d2.elems);
70836         context.map().pan([0, 0]);
70837       }).catch((err) => {
70838         console.log(err);
70839       });
70840     }
70841     osmoseDetails.issue = function(val) {
70842       if (!arguments.length)
70843         return _qaItem;
70844       _qaItem = val;
70845       return osmoseDetails;
70846     };
70847     return osmoseDetails;
70848   }
70849
70850   // modules/ui/osmose_header.js
70851   function uiOsmoseHeader() {
70852     let _qaItem;
70853     function issueTitle(d2) {
70854       const unknown = _t("inspector.unknown");
70855       if (!d2)
70856         return unknown;
70857       const s2 = services.osmose.getStrings(d2.itemType);
70858       return "title" in s2 ? s2.title : unknown;
70859     }
70860     function osmoseHeader(selection2) {
70861       const header = selection2.selectAll(".qa-header").data(
70862         _qaItem ? [_qaItem] : [],
70863         (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
70864       );
70865       header.exit().remove();
70866       const headerEnter = header.enter().append("div").attr("class", "qa-header");
70867       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));
70868       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");
70869       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 : "");
70870       headerEnter.append("div").attr("class", "qa-header-label").text(issueTitle);
70871     }
70872     osmoseHeader.issue = function(val) {
70873       if (!arguments.length)
70874         return _qaItem;
70875       _qaItem = val;
70876       return osmoseHeader;
70877     };
70878     return osmoseHeader;
70879   }
70880
70881   // modules/ui/view_on_osmose.js
70882   function uiViewOnOsmose() {
70883     let _qaItem;
70884     function viewOnOsmose(selection2) {
70885       let url;
70886       if (services.osmose && _qaItem instanceof QAItem) {
70887         url = services.osmose.itemURL(_qaItem);
70888       }
70889       const link2 = selection2.selectAll(".view-on-osmose").data(url ? [url] : []);
70890       link2.exit().remove();
70891       const linkEnter = link2.enter().append("a").attr("class", "view-on-osmose").attr("target", "_blank").attr("rel", "noopener").attr("href", (d2) => d2).call(svgIcon("#iD-icon-out-link", "inline"));
70892       linkEnter.append("span").call(_t.append("inspector.view_on_osmose"));
70893     }
70894     viewOnOsmose.what = function(val) {
70895       if (!arguments.length)
70896         return _qaItem;
70897       _qaItem = val;
70898       return viewOnOsmose;
70899     };
70900     return viewOnOsmose;
70901   }
70902
70903   // modules/ui/osmose_editor.js
70904   function uiOsmoseEditor(context) {
70905     const dispatch14 = dispatch_default("change");
70906     const qaDetails = uiOsmoseDetails(context);
70907     const qaHeader = uiOsmoseHeader(context);
70908     let _qaItem;
70909     function osmoseEditor(selection2) {
70910       const header = selection2.selectAll(".header").data([0]);
70911       const headerEnter = header.enter().append("div").attr("class", "header fillL");
70912       headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
70913       headerEnter.append("h2").call(_t.append("QA.osmose.title"));
70914       let body = selection2.selectAll(".body").data([0]);
70915       body = body.enter().append("div").attr("class", "body").merge(body);
70916       let editor = body.selectAll(".qa-editor").data([0]);
70917       editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(osmoseSaveSection);
70918       const footer = selection2.selectAll(".footer").data([0]);
70919       footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOsmose(context).what(_qaItem));
70920     }
70921     function osmoseSaveSection(selection2) {
70922       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
70923       const isShown = _qaItem && isSelected;
70924       let saveSection = selection2.selectAll(".qa-save").data(
70925         isShown ? [_qaItem] : [],
70926         (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
70927       );
70928       saveSection.exit().remove();
70929       const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
70930       saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
70931     }
70932     function qaSaveButtons(selection2) {
70933       const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
70934       let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
70935       buttonSection.exit().remove();
70936       const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
70937       buttonEnter.append("button").attr("class", "button close-button action");
70938       buttonEnter.append("button").attr("class", "button ignore-button action");
70939       buttonSection = buttonSection.merge(buttonEnter);
70940       buttonSection.select(".close-button").call(_t.append("QA.keepRight.close")).on("click.close", function(d3_event, d2) {
70941         this.blur();
70942         const qaService = services.osmose;
70943         if (qaService) {
70944           d2.newStatus = "done";
70945           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
70946         }
70947       });
70948       buttonSection.select(".ignore-button").call(_t.append("QA.keepRight.ignore")).on("click.ignore", function(d3_event, d2) {
70949         this.blur();
70950         const qaService = services.osmose;
70951         if (qaService) {
70952           d2.newStatus = "false";
70953           qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
70954         }
70955       });
70956     }
70957     osmoseEditor.error = function(val) {
70958       if (!arguments.length)
70959         return _qaItem;
70960       _qaItem = val;
70961       return osmoseEditor;
70962     };
70963     return utilRebind(osmoseEditor, dispatch14, "on");
70964   }
70965
70966   // modules/ui/sidebar.js
70967   function uiSidebar(context) {
70968     var inspector = uiInspector(context);
70969     var dataEditor = uiDataEditor(context);
70970     var noteEditor = uiNoteEditor(context);
70971     var improveOsmEditor = uiImproveOsmEditor(context);
70972     var keepRightEditor = uiKeepRightEditor(context);
70973     var osmoseEditor = uiOsmoseEditor(context);
70974     var _current;
70975     var _wasData = false;
70976     var _wasNote = false;
70977     var _wasQaItem = false;
70978     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
70979     function sidebar(selection2) {
70980       var container = context.container();
70981       var minWidth = 240;
70982       var sidebarWidth;
70983       var containerWidth;
70984       var dragOffset;
70985       selection2.style("min-width", minWidth + "px").style("max-width", "400px").style("width", "33.3333%");
70986       var resizer = selection2.append("div").attr("class", "sidebar-resizer").on(_pointerPrefix + "down.sidebar-resizer", pointerdown);
70987       var downPointerId, lastClientX, containerLocGetter;
70988       function pointerdown(d3_event) {
70989         if (downPointerId)
70990           return;
70991         if ("button" in d3_event && d3_event.button !== 0)
70992           return;
70993         downPointerId = d3_event.pointerId || "mouse";
70994         lastClientX = d3_event.clientX;
70995         containerLocGetter = utilFastMouse(container.node());
70996         dragOffset = utilFastMouse(resizer.node())(d3_event)[0] - 1;
70997         sidebarWidth = selection2.node().getBoundingClientRect().width;
70998         containerWidth = container.node().getBoundingClientRect().width;
70999         var widthPct = sidebarWidth / containerWidth * 100;
71000         selection2.style("width", widthPct + "%").style("max-width", "85%");
71001         resizer.classed("dragging", true);
71002         select_default2(window).on("touchmove.sidebar-resizer", function(d3_event2) {
71003           d3_event2.preventDefault();
71004         }, { passive: false }).on(_pointerPrefix + "move.sidebar-resizer", pointermove).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", pointerup);
71005       }
71006       function pointermove(d3_event) {
71007         if (downPointerId !== (d3_event.pointerId || "mouse"))
71008           return;
71009         d3_event.preventDefault();
71010         var dx = d3_event.clientX - lastClientX;
71011         lastClientX = d3_event.clientX;
71012         var isRTL = _mainLocalizer.textDirection() === "rtl";
71013         var scaleX = isRTL ? 0 : 1;
71014         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
71015         var x2 = containerLocGetter(d3_event)[0] - dragOffset;
71016         sidebarWidth = isRTL ? containerWidth - x2 : x2;
71017         var isCollapsed = selection2.classed("collapsed");
71018         var shouldCollapse = sidebarWidth < minWidth;
71019         selection2.classed("collapsed", shouldCollapse);
71020         if (shouldCollapse) {
71021           if (!isCollapsed) {
71022             selection2.style(xMarginProperty, "-400px").style("width", "400px");
71023             context.ui().onResize([(sidebarWidth - dx) * scaleX, 0]);
71024           }
71025         } else {
71026           var widthPct = sidebarWidth / containerWidth * 100;
71027           selection2.style(xMarginProperty, null).style("width", widthPct + "%");
71028           if (isCollapsed) {
71029             context.ui().onResize([-sidebarWidth * scaleX, 0]);
71030           } else {
71031             context.ui().onResize([-dx * scaleX, 0]);
71032           }
71033         }
71034       }
71035       function pointerup(d3_event) {
71036         if (downPointerId !== (d3_event.pointerId || "mouse"))
71037           return;
71038         downPointerId = null;
71039         resizer.classed("dragging", false);
71040         select_default2(window).on("touchmove.sidebar-resizer", null).on(_pointerPrefix + "move.sidebar-resizer", null).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", null);
71041       }
71042       var featureListWrap = selection2.append("div").attr("class", "feature-list-pane").call(uiFeatureList(context));
71043       var inspectorWrap = selection2.append("div").attr("class", "inspector-hidden inspector-wrap");
71044       var hoverModeSelect = function(targets) {
71045         context.container().selectAll(".feature-list-item button").classed("hover", false);
71046         if (context.selectedIDs().length > 1 && targets && targets.length) {
71047           var elements = context.container().selectAll(".feature-list-item button").filter(function(node) {
71048             return targets.indexOf(node) !== -1;
71049           });
71050           if (!elements.empty()) {
71051             elements.classed("hover", true);
71052           }
71053         }
71054       };
71055       sidebar.hoverModeSelect = throttle_default(hoverModeSelect, 200);
71056       function hover(targets) {
71057         var datum2 = targets && targets.length && targets[0];
71058         if (datum2 && datum2.__featurehash__) {
71059           _wasData = true;
71060           sidebar.show(dataEditor.datum(datum2));
71061           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
71062         } else if (datum2 instanceof osmNote) {
71063           if (context.mode().id === "drag-note")
71064             return;
71065           _wasNote = true;
71066           var osm = services.osm;
71067           if (osm) {
71068             datum2 = osm.getNote(datum2.id);
71069           }
71070           sidebar.show(noteEditor.note(datum2));
71071           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
71072         } else if (datum2 instanceof QAItem) {
71073           _wasQaItem = true;
71074           var errService = services[datum2.service];
71075           if (errService) {
71076             datum2 = errService.getError(datum2.id);
71077           }
71078           var errEditor;
71079           if (datum2.service === "keepRight") {
71080             errEditor = keepRightEditor;
71081           } else if (datum2.service === "osmose") {
71082             errEditor = osmoseEditor;
71083           } else {
71084             errEditor = improveOsmEditor;
71085           }
71086           context.container().selectAll(".qaItem." + datum2.service).classed("hover", function(d2) {
71087             return d2.id === datum2.id;
71088           });
71089           sidebar.show(errEditor.error(datum2));
71090           selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
71091         } else if (!_current && datum2 instanceof osmEntity) {
71092           featureListWrap.classed("inspector-hidden", true);
71093           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", true);
71094           if (!inspector.entityIDs() || !utilArrayIdentical(inspector.entityIDs(), [datum2.id]) || inspector.state() !== "hover") {
71095             inspector.state("hover").entityIDs([datum2.id]).newFeature(false);
71096             inspectorWrap.call(inspector);
71097           }
71098         } else if (!_current) {
71099           featureListWrap.classed("inspector-hidden", false);
71100           inspectorWrap.classed("inspector-hidden", true);
71101           inspector.state("hide");
71102         } else if (_wasData || _wasNote || _wasQaItem) {
71103           _wasNote = false;
71104           _wasData = false;
71105           _wasQaItem = false;
71106           context.container().selectAll(".note").classed("hover", false);
71107           context.container().selectAll(".qaItem").classed("hover", false);
71108           sidebar.hide();
71109         }
71110       }
71111       sidebar.hover = throttle_default(hover, 200);
71112       sidebar.intersects = function(extent) {
71113         var rect = selection2.node().getBoundingClientRect();
71114         return extent.intersects([
71115           context.projection.invert([0, rect.height]),
71116           context.projection.invert([rect.width, 0])
71117         ]);
71118       };
71119       sidebar.select = function(ids, newFeature) {
71120         sidebar.hide();
71121         if (ids && ids.length) {
71122           var entity = ids.length === 1 && context.entity(ids[0]);
71123           if (entity && newFeature && selection2.classed("collapsed")) {
71124             var extent = entity.extent(context.graph());
71125             sidebar.expand(sidebar.intersects(extent));
71126           }
71127           featureListWrap.classed("inspector-hidden", true);
71128           inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", false);
71129           inspector.state("select").entityIDs(ids).newFeature(newFeature);
71130           inspectorWrap.call(inspector);
71131         } else {
71132           inspector.state("hide");
71133         }
71134       };
71135       sidebar.showPresetList = function() {
71136         inspector.showList();
71137       };
71138       sidebar.show = function(component, element) {
71139         featureListWrap.classed("inspector-hidden", true);
71140         inspectorWrap.classed("inspector-hidden", true);
71141         if (_current)
71142           _current.remove();
71143         _current = selection2.append("div").attr("class", "sidebar-component").call(component, element);
71144       };
71145       sidebar.hide = function() {
71146         featureListWrap.classed("inspector-hidden", false);
71147         inspectorWrap.classed("inspector-hidden", true);
71148         if (_current)
71149           _current.remove();
71150         _current = null;
71151       };
71152       sidebar.expand = function(moveMap) {
71153         if (selection2.classed("collapsed")) {
71154           sidebar.toggle(moveMap);
71155         }
71156       };
71157       sidebar.collapse = function(moveMap) {
71158         if (!selection2.classed("collapsed")) {
71159           sidebar.toggle(moveMap);
71160         }
71161       };
71162       sidebar.toggle = function(moveMap) {
71163         if (context.inIntro())
71164           return;
71165         var isCollapsed = selection2.classed("collapsed");
71166         var isCollapsing = !isCollapsed;
71167         var isRTL = _mainLocalizer.textDirection() === "rtl";
71168         var scaleX = isRTL ? 0 : 1;
71169         var xMarginProperty = isRTL ? "margin-right" : "margin-left";
71170         sidebarWidth = selection2.node().getBoundingClientRect().width;
71171         selection2.style("width", sidebarWidth + "px");
71172         var startMargin, endMargin, lastMargin;
71173         if (isCollapsing) {
71174           startMargin = lastMargin = 0;
71175           endMargin = -sidebarWidth;
71176         } else {
71177           startMargin = lastMargin = -sidebarWidth;
71178           endMargin = 0;
71179         }
71180         if (!isCollapsing) {
71181           selection2.classed("collapsed", isCollapsing);
71182         }
71183         selection2.transition().style(xMarginProperty, endMargin + "px").tween("panner", function() {
71184           var i3 = number_default(startMargin, endMargin);
71185           return function(t2) {
71186             var dx = lastMargin - Math.round(i3(t2));
71187             lastMargin = lastMargin - dx;
71188             context.ui().onResize(moveMap ? void 0 : [dx * scaleX, 0]);
71189           };
71190         }).on("end", function() {
71191           if (isCollapsing) {
71192             selection2.classed("collapsed", isCollapsing);
71193           }
71194           if (!isCollapsing) {
71195             var containerWidth2 = container.node().getBoundingClientRect().width;
71196             var widthPct = sidebarWidth / containerWidth2 * 100;
71197             selection2.style(xMarginProperty, null).style("width", widthPct + "%");
71198           }
71199         });
71200       };
71201       resizer.on("dblclick", function(d3_event) {
71202         d3_event.preventDefault();
71203         if (d3_event.sourceEvent) {
71204           d3_event.sourceEvent.preventDefault();
71205         }
71206         sidebar.toggle();
71207       });
71208       context.map().on("crossEditableZoom.sidebar", function(within) {
71209         if (!within && !selection2.select(".inspector-hover").empty()) {
71210           hover([]);
71211         }
71212       });
71213     }
71214     sidebar.showPresetList = function() {
71215     };
71216     sidebar.hover = function() {
71217     };
71218     sidebar.hover.cancel = function() {
71219     };
71220     sidebar.intersects = function() {
71221     };
71222     sidebar.select = function() {
71223     };
71224     sidebar.show = function() {
71225     };
71226     sidebar.hide = function() {
71227     };
71228     sidebar.expand = function() {
71229     };
71230     sidebar.collapse = function() {
71231     };
71232     sidebar.toggle = function() {
71233     };
71234     return sidebar;
71235   }
71236
71237   // modules/modes/draw_area.js
71238   function modeDrawArea(context, wayID, startGraph, button) {
71239     var mode = {
71240       button,
71241       id: "draw-area"
71242     };
71243     var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawArea", function() {
71244       context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.areas"))();
71245     });
71246     mode.wayID = wayID;
71247     mode.enter = function() {
71248       context.install(behavior);
71249     };
71250     mode.exit = function() {
71251       context.uninstall(behavior);
71252     };
71253     mode.selectedIDs = function() {
71254       return [wayID];
71255     };
71256     mode.activeID = function() {
71257       return behavior && behavior.activeID() || [];
71258     };
71259     return mode;
71260   }
71261
71262   // modules/modes/add_area.js
71263   function modeAddArea(context, mode) {
71264     mode.id = "add-area";
71265     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
71266     function defaultTags(loc) {
71267       var defaultTags2 = { area: "yes" };
71268       if (mode.preset)
71269         defaultTags2 = mode.preset.setTags(defaultTags2, "area", false, loc);
71270       return defaultTags2;
71271     }
71272     function actionClose(wayId) {
71273       return function(graph) {
71274         return graph.replace(graph.entity(wayId).close());
71275       };
71276     }
71277     function start2(loc) {
71278       var startGraph = context.graph();
71279       var node = osmNode({ loc });
71280       var way = osmWay({ tags: defaultTags(loc) });
71281       context.perform(
71282         actionAddEntity(node),
71283         actionAddEntity(way),
71284         actionAddVertex(way.id, node.id),
71285         actionClose(way.id)
71286       );
71287       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
71288     }
71289     function startFromWay(loc, edge) {
71290       var startGraph = context.graph();
71291       var node = osmNode({ loc });
71292       var way = osmWay({ tags: defaultTags(loc) });
71293       context.perform(
71294         actionAddEntity(node),
71295         actionAddEntity(way),
71296         actionAddVertex(way.id, node.id),
71297         actionClose(way.id),
71298         actionAddMidpoint({ loc, edge }, node)
71299       );
71300       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
71301     }
71302     function startFromNode(node) {
71303       var startGraph = context.graph();
71304       var way = osmWay({ tags: defaultTags(node.loc) });
71305       context.perform(
71306         actionAddEntity(way),
71307         actionAddVertex(way.id, node.id),
71308         actionClose(way.id)
71309       );
71310       context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
71311     }
71312     mode.enter = function() {
71313       context.install(behavior);
71314     };
71315     mode.exit = function() {
71316       context.uninstall(behavior);
71317     };
71318     return mode;
71319   }
71320
71321   // modules/modes/add_line.js
71322   function modeAddLine(context, mode) {
71323     mode.id = "add-line";
71324     var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
71325     function defaultTags(loc) {
71326       var defaultTags2 = {};
71327       if (mode.preset)
71328         defaultTags2 = mode.preset.setTags(defaultTags2, "line", false, loc);
71329       return defaultTags2;
71330     }
71331     function start2(loc) {
71332       var startGraph = context.graph();
71333       var node = osmNode({ loc });
71334       var way = osmWay({ tags: defaultTags(loc) });
71335       context.perform(
71336         actionAddEntity(node),
71337         actionAddEntity(way),
71338         actionAddVertex(way.id, node.id)
71339       );
71340       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
71341     }
71342     function startFromWay(loc, edge) {
71343       var startGraph = context.graph();
71344       var node = osmNode({ loc });
71345       var way = osmWay({ tags: defaultTags(loc) });
71346       context.perform(
71347         actionAddEntity(node),
71348         actionAddEntity(way),
71349         actionAddVertex(way.id, node.id),
71350         actionAddMidpoint({ loc, edge }, node)
71351       );
71352       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
71353     }
71354     function startFromNode(node) {
71355       var startGraph = context.graph();
71356       var way = osmWay({ tags: defaultTags(node.loc) });
71357       context.perform(
71358         actionAddEntity(way),
71359         actionAddVertex(way.id, node.id)
71360       );
71361       context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
71362     }
71363     mode.enter = function() {
71364       context.install(behavior);
71365     };
71366     mode.exit = function() {
71367       context.uninstall(behavior);
71368     };
71369     return mode;
71370   }
71371
71372   // modules/modes/add_point.js
71373   function modeAddPoint(context, mode) {
71374     mode.id = "add-point";
71375     var behavior = behaviorDraw(context).on("click", add).on("clickWay", addWay).on("clickNode", addNode).on("cancel", cancel).on("finish", cancel);
71376     function defaultTags(loc) {
71377       var defaultTags2 = {};
71378       if (mode.preset)
71379         defaultTags2 = mode.preset.setTags(defaultTags2, "point", false, loc);
71380       return defaultTags2;
71381     }
71382     function add(loc) {
71383       var node = osmNode({ loc, tags: defaultTags(loc) });
71384       context.perform(
71385         actionAddEntity(node),
71386         _t("operations.add.annotation.point")
71387       );
71388       enterSelectMode(node);
71389     }
71390     function addWay(loc, edge) {
71391       var node = osmNode({ tags: defaultTags(loc) });
71392       context.perform(
71393         actionAddMidpoint({ loc, edge }, node),
71394         _t("operations.add.annotation.vertex")
71395       );
71396       enterSelectMode(node);
71397     }
71398     function enterSelectMode(node) {
71399       context.enter(
71400         modeSelect(context, [node.id]).newFeature(true)
71401       );
71402     }
71403     function addNode(node) {
71404       const _defaultTags = defaultTags(node.loc);
71405       if (Object.keys(_defaultTags).length === 0) {
71406         enterSelectMode(node);
71407         return;
71408       }
71409       var tags = Object.assign({}, node.tags);
71410       for (var key in _defaultTags) {
71411         tags[key] = _defaultTags[key];
71412       }
71413       context.perform(
71414         actionChangeTags(node.id, tags),
71415         _t("operations.add.annotation.point")
71416       );
71417       enterSelectMode(node);
71418     }
71419     function cancel() {
71420       context.enter(modeBrowse(context));
71421     }
71422     mode.enter = function() {
71423       context.install(behavior);
71424     };
71425     mode.exit = function() {
71426       context.uninstall(behavior);
71427     };
71428     return mode;
71429   }
71430
71431   // modules/modes/select_note.js
71432   function modeSelectNote(context, selectedNoteID) {
71433     var mode = {
71434       id: "select-note",
71435       button: "browse"
71436     };
71437     var _keybinding = utilKeybinding("select-note");
71438     var _noteEditor = uiNoteEditor(context).on("change", function() {
71439       context.map().pan([0, 0]);
71440       var note = checkSelectedID();
71441       if (!note)
71442         return;
71443       context.ui().sidebar.show(_noteEditor.note(note));
71444     });
71445     var _behaviors = [
71446       behaviorBreathe(context),
71447       behaviorHover(context),
71448       behaviorSelect(context),
71449       behaviorLasso(context),
71450       modeDragNode(context).behavior,
71451       modeDragNote(context).behavior
71452     ];
71453     var _newFeature = false;
71454     function checkSelectedID() {
71455       if (!services.osm)
71456         return;
71457       var note = services.osm.getNote(selectedNoteID);
71458       if (!note) {
71459         context.enter(modeBrowse(context));
71460       }
71461       return note;
71462     }
71463     function selectNote(d3_event, drawn) {
71464       if (!checkSelectedID())
71465         return;
71466       var selection2 = context.surface().selectAll(".layer-notes .note-" + selectedNoteID);
71467       if (selection2.empty()) {
71468         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
71469         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
71470           context.enter(modeBrowse(context));
71471         }
71472       } else {
71473         selection2.classed("selected", true);
71474         context.selectedNoteID(selectedNoteID);
71475       }
71476     }
71477     function esc() {
71478       if (context.container().select(".combobox").size())
71479         return;
71480       context.enter(modeBrowse(context));
71481     }
71482     mode.zoomToSelected = function() {
71483       if (!services.osm)
71484         return;
71485       var note = services.osm.getNote(selectedNoteID);
71486       if (note) {
71487         context.map().centerZoomEase(note.loc, 20);
71488       }
71489     };
71490     mode.newFeature = function(val) {
71491       if (!arguments.length)
71492         return _newFeature;
71493       _newFeature = val;
71494       return mode;
71495     };
71496     mode.enter = function() {
71497       var note = checkSelectedID();
71498       if (!note)
71499         return;
71500       _behaviors.forEach(context.install);
71501       _keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
71502       select_default2(document).call(_keybinding);
71503       selectNote();
71504       var sidebar = context.ui().sidebar;
71505       sidebar.show(_noteEditor.note(note).newNote(_newFeature));
71506       sidebar.expand(sidebar.intersects(note.extent()));
71507       context.map().on("drawn.select", selectNote);
71508     };
71509     mode.exit = function() {
71510       _behaviors.forEach(context.uninstall);
71511       select_default2(document).call(_keybinding.unbind);
71512       context.surface().selectAll(".layer-notes .selected").classed("selected hover", false);
71513       context.map().on("drawn.select", null);
71514       context.ui().sidebar.hide();
71515       context.selectedNoteID(null);
71516     };
71517     return mode;
71518   }
71519
71520   // modules/modes/add_note.js
71521   function modeAddNote(context) {
71522     var mode = {
71523       id: "add-note",
71524       button: "note",
71525       description: _t.append("modes.add_note.description"),
71526       key: _t("modes.add_note.key")
71527     };
71528     var behavior = behaviorDraw(context).on("click", add).on("cancel", cancel).on("finish", cancel);
71529     function add(loc) {
71530       var osm = services.osm;
71531       if (!osm)
71532         return;
71533       var note = osmNote({ loc, status: "open", comments: [] });
71534       osm.replaceNote(note);
71535       context.map().pan([0, 0]);
71536       context.selectedNoteID(note.id).enter(modeSelectNote(context, note.id).newFeature(true));
71537     }
71538     function cancel() {
71539       context.enter(modeBrowse(context));
71540     }
71541     mode.enter = function() {
71542       context.install(behavior);
71543     };
71544     mode.exit = function() {
71545       context.uninstall(behavior);
71546     };
71547     return mode;
71548   }
71549
71550   // modules/modes/save.js
71551   function modeSave(context) {
71552     var mode = { id: "save" };
71553     var keybinding = utilKeybinding("modeSave");
71554     var commit = uiCommit(context).on("cancel", cancel);
71555     var _conflictsUi;
71556     var _location;
71557     var _success;
71558     var uploader = context.uploader().on("saveStarted.modeSave", function() {
71559       keybindingOff();
71560     }).on("willAttemptUpload.modeSave", prepareForSuccess).on("progressChanged.modeSave", showProgress).on("resultNoChanges.modeSave", function() {
71561       cancel();
71562     }).on("resultErrors.modeSave", showErrors).on("resultConflicts.modeSave", showConflicts).on("resultSuccess.modeSave", showSuccess);
71563     function cancel() {
71564       context.enter(modeBrowse(context));
71565     }
71566     function showProgress(num, total) {
71567       var modal = context.container().select(".loading-modal .modal-section");
71568       var progress = modal.selectAll(".progress").data([0]);
71569       progress.enter().append("div").attr("class", "progress").merge(progress).text(_t("save.conflict_progress", { num, total }));
71570     }
71571     function showConflicts(changeset, conflicts, origChanges) {
71572       var selection2 = context.container().select(".sidebar").append("div").attr("class", "sidebar-component");
71573       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
71574       _conflictsUi = uiConflicts(context).conflictList(conflicts).origChanges(origChanges).on("cancel", function() {
71575         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
71576         selection2.remove();
71577         keybindingOn();
71578         uploader.cancelConflictResolution();
71579       }).on("save", function() {
71580         context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
71581         selection2.remove();
71582         uploader.processResolvedConflicts(changeset);
71583       });
71584       selection2.call(_conflictsUi);
71585     }
71586     function showErrors(errors) {
71587       keybindingOn();
71588       var selection2 = uiConfirm(context.container());
71589       selection2.select(".modal-section.header").append("h3").text(_t("save.error"));
71590       addErrors(selection2, errors);
71591       selection2.okButton();
71592     }
71593     function addErrors(selection2, data) {
71594       var message = selection2.select(".modal-section.message-text");
71595       var items = message.selectAll(".error-container").data(data);
71596       var enter = items.enter().append("div").attr("class", "error-container");
71597       enter.append("a").attr("class", "error-description").attr("href", "#").classed("hide-toggle", true).text(function(d2) {
71598         return d2.msg || _t("save.unknown_error_details");
71599       }).on("click", function(d3_event) {
71600         d3_event.preventDefault();
71601         var error = select_default2(this);
71602         var detail = select_default2(this.nextElementSibling);
71603         var exp2 = error.classed("expanded");
71604         detail.style("display", exp2 ? "none" : "block");
71605         error.classed("expanded", !exp2);
71606       });
71607       var details = enter.append("div").attr("class", "error-detail-container").style("display", "none");
71608       details.append("ul").attr("class", "error-detail-list").selectAll("li").data(function(d2) {
71609         return d2.details || [];
71610       }).enter().append("li").attr("class", "error-detail-item").text(function(d2) {
71611         return d2;
71612       });
71613       items.exit().remove();
71614     }
71615     function showSuccess(changeset) {
71616       commit.reset();
71617       var ui = _success.changeset(changeset).location(_location).on("cancel", function() {
71618         context.ui().sidebar.hide();
71619       });
71620       context.enter(modeBrowse(context).sidebar(ui));
71621     }
71622     function keybindingOn() {
71623       select_default2(document).call(keybinding.on("\u238B", cancel, true));
71624     }
71625     function keybindingOff() {
71626       select_default2(document).call(keybinding.unbind);
71627     }
71628     function prepareForSuccess() {
71629       _success = uiSuccess(context);
71630       _location = null;
71631       if (!services.geocoder)
71632         return;
71633       services.geocoder.reverse(context.map().center(), function(err, result) {
71634         if (err || !result || !result.address)
71635           return;
71636         var addr = result.address;
71637         var place = addr && (addr.town || addr.city || addr.county) || "";
71638         var region = addr && (addr.state || addr.country) || "";
71639         var separator = place && region ? _t("success.thank_you_where.separator") : "";
71640         _location = _t(
71641           "success.thank_you_where.format",
71642           { place, separator, region }
71643         );
71644       });
71645     }
71646     mode.selectedIDs = function() {
71647       return _conflictsUi ? _conflictsUi.shownEntityIds() : [];
71648     };
71649     mode.enter = function() {
71650       context.ui().sidebar.expand();
71651       function done() {
71652         context.ui().sidebar.show(commit);
71653       }
71654       keybindingOn();
71655       context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
71656       var osm = context.connection();
71657       if (!osm) {
71658         cancel();
71659         return;
71660       }
71661       if (osm.authenticated()) {
71662         done();
71663       } else {
71664         osm.authenticate(function(err) {
71665           if (err) {
71666             cancel();
71667           } else {
71668             done();
71669           }
71670         });
71671       }
71672     };
71673     mode.exit = function() {
71674       keybindingOff();
71675       context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
71676       context.ui().sidebar.hide();
71677     };
71678     return mode;
71679   }
71680
71681   // modules/modes/select_error.js
71682   function modeSelectError(context, selectedErrorID, selectedErrorService) {
71683     var mode = {
71684       id: "select-error",
71685       button: "browse"
71686     };
71687     var keybinding = utilKeybinding("select-error");
71688     var errorService = services[selectedErrorService];
71689     var errorEditor;
71690     switch (selectedErrorService) {
71691       case "improveOSM":
71692         errorEditor = uiImproveOsmEditor(context).on("change", function() {
71693           context.map().pan([0, 0]);
71694           var error = checkSelectedID();
71695           if (!error)
71696             return;
71697           context.ui().sidebar.show(errorEditor.error(error));
71698         });
71699         break;
71700       case "keepRight":
71701         errorEditor = uiKeepRightEditor(context).on("change", function() {
71702           context.map().pan([0, 0]);
71703           var error = checkSelectedID();
71704           if (!error)
71705             return;
71706           context.ui().sidebar.show(errorEditor.error(error));
71707         });
71708         break;
71709       case "osmose":
71710         errorEditor = uiOsmoseEditor(context).on("change", function() {
71711           context.map().pan([0, 0]);
71712           var error = checkSelectedID();
71713           if (!error)
71714             return;
71715           context.ui().sidebar.show(errorEditor.error(error));
71716         });
71717         break;
71718     }
71719     var behaviors = [
71720       behaviorBreathe(context),
71721       behaviorHover(context),
71722       behaviorSelect(context),
71723       behaviorLasso(context),
71724       modeDragNode(context).behavior,
71725       modeDragNote(context).behavior
71726     ];
71727     function checkSelectedID() {
71728       if (!errorService)
71729         return;
71730       var error = errorService.getError(selectedErrorID);
71731       if (!error) {
71732         context.enter(modeBrowse(context));
71733       }
71734       return error;
71735     }
71736     mode.zoomToSelected = function() {
71737       if (!errorService)
71738         return;
71739       var error = errorService.getError(selectedErrorID);
71740       if (error) {
71741         context.map().centerZoomEase(error.loc, 20);
71742       }
71743     };
71744     mode.enter = function() {
71745       var error = checkSelectedID();
71746       if (!error)
71747         return;
71748       behaviors.forEach(context.install);
71749       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
71750       select_default2(document).call(keybinding);
71751       selectError();
71752       var sidebar = context.ui().sidebar;
71753       sidebar.show(errorEditor.error(error));
71754       context.map().on("drawn.select-error", selectError);
71755       function selectError(d3_event, drawn) {
71756         if (!checkSelectedID())
71757           return;
71758         var selection2 = context.surface().selectAll(".itemId-" + selectedErrorID + "." + selectedErrorService);
71759         if (selection2.empty()) {
71760           var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
71761           if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
71762             context.enter(modeBrowse(context));
71763           }
71764         } else {
71765           selection2.classed("selected", true);
71766           context.selectedErrorID(selectedErrorID);
71767         }
71768       }
71769       function esc() {
71770         if (context.container().select(".combobox").size())
71771           return;
71772         context.enter(modeBrowse(context));
71773       }
71774     };
71775     mode.exit = function() {
71776       behaviors.forEach(context.uninstall);
71777       select_default2(document).call(keybinding.unbind);
71778       context.surface().selectAll(".qaItem.selected").classed("selected hover", false);
71779       context.map().on("drawn.select-error", null);
71780       context.ui().sidebar.hide();
71781       context.selectedErrorID(null);
71782       context.features().forceVisible([]);
71783     };
71784     return mode;
71785   }
71786
71787   // modules/ui/tools/modes.js
71788   function uiToolDrawModes(context) {
71789     var tool = {
71790       id: "old_modes",
71791       label: _t.append("toolbar.add_feature")
71792     };
71793     var modes = [
71794       modeAddPoint(context, {
71795         title: _t.append("modes.add_point.title"),
71796         button: "point",
71797         description: _t.append("modes.add_point.description"),
71798         preset: _mainPresetIndex.item("point"),
71799         key: "1"
71800       }),
71801       modeAddLine(context, {
71802         title: _t.append("modes.add_line.title"),
71803         button: "line",
71804         description: _t.append("modes.add_line.description"),
71805         preset: _mainPresetIndex.item("line"),
71806         key: "2"
71807       }),
71808       modeAddArea(context, {
71809         title: _t.append("modes.add_area.title"),
71810         button: "area",
71811         description: _t.append("modes.add_area.description"),
71812         preset: _mainPresetIndex.item("area"),
71813         key: "3"
71814       })
71815     ];
71816     function enabled(_mode) {
71817       return osmEditable();
71818     }
71819     function osmEditable() {
71820       return context.editable();
71821     }
71822     modes.forEach(function(mode) {
71823       context.keybinding().on(mode.key, function() {
71824         if (!enabled(mode))
71825           return;
71826         if (mode.id === context.mode().id) {
71827           context.enter(modeBrowse(context));
71828         } else {
71829           context.enter(mode);
71830         }
71831       });
71832     });
71833     tool.render = function(selection2) {
71834       var wrap2 = selection2.append("div").attr("class", "joined").style("display", "flex");
71835       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
71836       context.map().on("move.modes", debouncedUpdate).on("drawn.modes", debouncedUpdate);
71837       context.on("enter.modes", update);
71838       update();
71839       function update() {
71840         var buttons = wrap2.selectAll("button.add-button").data(modes, function(d2) {
71841           return d2.id;
71842         });
71843         buttons.exit().remove();
71844         var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
71845           return d2.id + " add-button bar-button";
71846         }).on("click.mode-buttons", function(d3_event, d2) {
71847           if (!enabled(d2))
71848             return;
71849           var currMode = context.mode().id;
71850           if (/^draw/.test(currMode))
71851             return;
71852           if (d2.id === currMode) {
71853             context.enter(modeBrowse(context));
71854           } else {
71855             context.enter(d2);
71856           }
71857         }).call(
71858           uiTooltip().placement("bottom").title(function(d2) {
71859             return d2.description;
71860           }).keys(function(d2) {
71861             return [d2.key];
71862           }).scrollContainer(context.container().select(".top-toolbar"))
71863         );
71864         buttonsEnter.each(function(d2) {
71865           select_default2(this).call(svgIcon("#iD-icon-" + d2.button));
71866         });
71867         buttonsEnter.append("span").attr("class", "label").text("").each(function(mode) {
71868           mode.title(select_default2(this));
71869         });
71870         if (buttons.enter().size() || buttons.exit().size()) {
71871           context.ui().checkOverflow(".top-toolbar", true);
71872         }
71873         buttons = buttons.merge(buttonsEnter).attr("aria-disabled", function(d2) {
71874           return !enabled(d2);
71875         }).classed("disabled", function(d2) {
71876           return !enabled(d2);
71877         }).attr("aria-pressed", function(d2) {
71878           return context.mode() && context.mode().button === d2.button;
71879         }).classed("active", function(d2) {
71880           return context.mode() && context.mode().button === d2.button;
71881         });
71882       }
71883     };
71884     return tool;
71885   }
71886
71887   // modules/ui/tools/notes.js
71888   function uiToolNotes(context) {
71889     var tool = {
71890       id: "notes",
71891       label: _t.append("modes.add_note.label")
71892     };
71893     var mode = modeAddNote(context);
71894     function enabled() {
71895       return notesEnabled() && notesEditable();
71896     }
71897     function notesEnabled() {
71898       var noteLayer = context.layers().layer("notes");
71899       return noteLayer && noteLayer.enabled();
71900     }
71901     function notesEditable() {
71902       var mode2 = context.mode();
71903       return context.map().notesEditable() && mode2 && mode2.id !== "save";
71904     }
71905     context.keybinding().on(mode.key, function() {
71906       if (!enabled())
71907         return;
71908       if (mode.id === context.mode().id) {
71909         context.enter(modeBrowse(context));
71910       } else {
71911         context.enter(mode);
71912       }
71913     });
71914     tool.render = function(selection2) {
71915       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
71916       context.map().on("move.notes", debouncedUpdate).on("drawn.notes", debouncedUpdate);
71917       context.on("enter.notes", update);
71918       update();
71919       function update() {
71920         var showNotes = notesEnabled();
71921         var data = showNotes ? [mode] : [];
71922         var buttons = selection2.selectAll("button.add-button").data(data, function(d2) {
71923           return d2.id;
71924         });
71925         buttons.exit().remove();
71926         var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
71927           return d2.id + " add-button bar-button";
71928         }).on("click.notes", function(d3_event, d2) {
71929           if (!enabled())
71930             return;
71931           var currMode = context.mode().id;
71932           if (/^draw/.test(currMode))
71933             return;
71934           if (d2.id === currMode) {
71935             context.enter(modeBrowse(context));
71936           } else {
71937             context.enter(d2);
71938           }
71939         }).call(
71940           uiTooltip().placement("bottom").title(function(d2) {
71941             return d2.description;
71942           }).keys(function(d2) {
71943             return [d2.key];
71944           }).scrollContainer(context.container().select(".top-toolbar"))
71945         );
71946         buttonsEnter.each(function(d2) {
71947           select_default2(this).call(svgIcon(d2.icon || "#iD-icon-" + d2.button));
71948         });
71949         if (buttons.enter().size() || buttons.exit().size()) {
71950           context.ui().checkOverflow(".top-toolbar", true);
71951         }
71952         buttons = buttons.merge(buttonsEnter).classed("disabled", function() {
71953           return !enabled();
71954         }).attr("aria-disabled", function() {
71955           return !enabled();
71956         }).classed("active", function(d2) {
71957           return context.mode() && context.mode().button === d2.button;
71958         }).attr("aria-pressed", function(d2) {
71959           return context.mode() && context.mode().button === d2.button;
71960         });
71961       }
71962     };
71963     tool.uninstall = function() {
71964       context.on("enter.editor.notes", null).on("exit.editor.notes", null).on("enter.notes", null);
71965       context.map().on("move.notes", null).on("drawn.notes", null);
71966     };
71967     return tool;
71968   }
71969
71970   // modules/ui/tools/save.js
71971   function uiToolSave(context) {
71972     var tool = {
71973       id: "save",
71974       label: _t.append("save.title")
71975     };
71976     var button = null;
71977     var tooltipBehavior = null;
71978     var history = context.history();
71979     var key = uiCmd("\u2318S");
71980     var _numChanges = 0;
71981     function isSaving() {
71982       var mode = context.mode();
71983       return mode && mode.id === "save";
71984     }
71985     function isDisabled() {
71986       return _numChanges === 0 || isSaving();
71987     }
71988     function save(d3_event) {
71989       d3_event.preventDefault();
71990       if (!context.inIntro() && !isSaving() && history.hasChanges()) {
71991         context.enter(modeSave(context));
71992       }
71993     }
71994     function bgColor(numChanges) {
71995       var step;
71996       if (numChanges === 0) {
71997         return null;
71998       } else if (numChanges <= 50) {
71999         step = numChanges / 50;
72000         return rgb_default("#fff", "#ff8")(step);
72001       } else {
72002         step = Math.min((numChanges - 50) / 50, 1);
72003         return rgb_default("#ff8", "#f88")(step);
72004       }
72005     }
72006     function updateCount() {
72007       var val = history.difference().summary().length;
72008       if (val === _numChanges)
72009         return;
72010       _numChanges = val;
72011       if (tooltipBehavior) {
72012         tooltipBehavior.title(() => _t.append(_numChanges > 0 ? "save.help" : "save.no_changes")).keys([key]);
72013       }
72014       if (button) {
72015         button.classed("disabled", isDisabled()).style("background", bgColor(_numChanges));
72016         button.select("span.count").text(_numChanges);
72017       }
72018     }
72019     tool.render = function(selection2) {
72020       tooltipBehavior = uiTooltip().placement("bottom").title(() => _t.append("save.no_changes")).keys([key]).scrollContainer(context.container().select(".top-toolbar"));
72021       var lastPointerUpType;
72022       button = selection2.append("button").attr("class", "save disabled bar-button").on("pointerup", function(d3_event) {
72023         lastPointerUpType = d3_event.pointerType;
72024       }).on("click", function(d3_event) {
72025         save(d3_event);
72026         if (_numChanges === 0 && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
72027           context.ui().flash.duration(2e3).iconName("#iD-icon-save").iconClass("disabled").label(_t.append("save.no_changes"))();
72028         }
72029         lastPointerUpType = null;
72030       }).call(tooltipBehavior);
72031       button.call(svgIcon("#iD-icon-save"));
72032       button.append("span").attr("class", "count").attr("aria-hidden", "true").text("0");
72033       updateCount();
72034       context.keybinding().on(key, save, true);
72035       context.history().on("change.save", updateCount);
72036       context.on("enter.save", function() {
72037         if (button) {
72038           button.classed("disabled", isDisabled());
72039           if (isSaving()) {
72040             button.call(tooltipBehavior.hide);
72041           }
72042         }
72043       });
72044     };
72045     tool.uninstall = function() {
72046       context.keybinding().off(key, true);
72047       context.history().on("change.save", null);
72048       context.on("enter.save", null);
72049       button = null;
72050       tooltipBehavior = null;
72051     };
72052     return tool;
72053   }
72054
72055   // modules/ui/tools/sidebar_toggle.js
72056   function uiToolSidebarToggle(context) {
72057     var tool = {
72058       id: "sidebar_toggle",
72059       label: _t.append("toolbar.inspect")
72060     };
72061     tool.render = function(selection2) {
72062       selection2.append("button").attr("class", "bar-button").attr("aria-label", _t("sidebar.tooltip")).on("click", function() {
72063         context.ui().sidebar.toggle();
72064       }).call(
72065         uiTooltip().placement("bottom").title(() => _t.append("sidebar.tooltip")).keys([_t("sidebar.key")]).scrollContainer(context.container().select(".top-toolbar"))
72066       ).call(svgIcon("#iD-icon-sidebar-" + (_mainLocalizer.textDirection() === "rtl" ? "right" : "left")));
72067     };
72068     return tool;
72069   }
72070
72071   // modules/ui/tools/undo_redo.js
72072   function uiToolUndoRedo(context) {
72073     var tool = {
72074       id: "undo_redo",
72075       label: _t.append("toolbar.undo_redo")
72076     };
72077     var commands = [{
72078       id: "undo",
72079       cmd: uiCmd("\u2318Z"),
72080       action: function() {
72081         context.undo();
72082       },
72083       annotation: function() {
72084         return context.history().undoAnnotation();
72085       },
72086       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")
72087     }, {
72088       id: "redo",
72089       cmd: uiCmd("\u2318\u21E7Z"),
72090       action: function() {
72091         context.redo();
72092       },
72093       annotation: function() {
72094         return context.history().redoAnnotation();
72095       },
72096       icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "undo" : "redo")
72097     }];
72098     function editable() {
72099       return context.mode() && context.mode().id !== "save" && context.map().editableDataEnabled(
72100         true
72101         /* ignore min zoom */
72102       );
72103     }
72104     tool.render = function(selection2) {
72105       var tooltipBehavior = uiTooltip().placement("bottom").title(function(d2) {
72106         return d2.annotation() ? _t.append(d2.id + ".tooltip", { action: d2.annotation() }) : _t.append(d2.id + ".nothing");
72107       }).keys(function(d2) {
72108         return [d2.cmd];
72109       }).scrollContainer(context.container().select(".top-toolbar"));
72110       var lastPointerUpType;
72111       var buttons = selection2.selectAll("button").data(commands).enter().append("button").attr("class", function(d2) {
72112         return "disabled " + d2.id + "-button bar-button";
72113       }).on("pointerup", function(d3_event) {
72114         lastPointerUpType = d3_event.pointerType;
72115       }).on("click", function(d3_event, d2) {
72116         d3_event.preventDefault();
72117         var annotation = d2.annotation();
72118         if (editable() && annotation) {
72119           d2.action();
72120         }
72121         if (editable() && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
72122           var label = annotation ? _t.append(d2.id + ".tooltip", { action: annotation }) : _t.append(d2.id + ".nothing");
72123           context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass(annotation ? "" : "disabled").label(label)();
72124         }
72125         lastPointerUpType = null;
72126       }).call(tooltipBehavior);
72127       buttons.each(function(d2) {
72128         select_default2(this).call(svgIcon("#" + d2.icon));
72129       });
72130       context.keybinding().on(commands[0].cmd, function(d3_event) {
72131         d3_event.preventDefault();
72132         if (editable())
72133           commands[0].action();
72134       }).on(commands[1].cmd, function(d3_event) {
72135         d3_event.preventDefault();
72136         if (editable())
72137           commands[1].action();
72138       });
72139       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
72140       context.map().on("move.undo_redo", debouncedUpdate).on("drawn.undo_redo", debouncedUpdate);
72141       context.history().on("change.undo_redo", function(difference) {
72142         if (difference)
72143           update();
72144       });
72145       context.on("enter.undo_redo", update);
72146       function update() {
72147         buttons.classed("disabled", function(d2) {
72148           return !editable() || !d2.annotation();
72149         }).each(function() {
72150           var selection3 = select_default2(this);
72151           if (!selection3.select(".tooltip.in").empty()) {
72152             selection3.call(tooltipBehavior.updateContent);
72153           }
72154         });
72155       }
72156     };
72157     tool.uninstall = function() {
72158       context.keybinding().off(commands[0].cmd).off(commands[1].cmd);
72159       context.map().on("move.undo_redo", null).on("drawn.undo_redo", null);
72160       context.history().on("change.undo_redo", null);
72161       context.on("enter.undo_redo", null);
72162     };
72163     return tool;
72164   }
72165
72166   // modules/ui/top_toolbar.js
72167   function uiTopToolbar(context) {
72168     var sidebarToggle = uiToolSidebarToggle(context), modes = uiToolDrawModes(context), notes = uiToolNotes(context), undoRedo = uiToolUndoRedo(context), save = uiToolSave(context);
72169     function notesEnabled() {
72170       var noteLayer = context.layers().layer("notes");
72171       return noteLayer && noteLayer.enabled();
72172     }
72173     function topToolbar(bar) {
72174       bar.on("wheel.topToolbar", function(d3_event) {
72175         if (!d3_event.deltaX) {
72176           bar.node().scrollLeft += d3_event.deltaY;
72177         }
72178       });
72179       var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
72180       context.layers().on("change.topToolbar", debouncedUpdate);
72181       update();
72182       function update() {
72183         var tools = [
72184           sidebarToggle,
72185           "spacer",
72186           modes
72187         ];
72188         tools.push("spacer");
72189         if (notesEnabled()) {
72190           tools = tools.concat([notes, "spacer"]);
72191         }
72192         tools = tools.concat([undoRedo, save]);
72193         var toolbarItems = bar.selectAll(".toolbar-item").data(tools, function(d2) {
72194           return d2.id || d2;
72195         });
72196         toolbarItems.exit().each(function(d2) {
72197           if (d2.uninstall) {
72198             d2.uninstall();
72199           }
72200         }).remove();
72201         var itemsEnter = toolbarItems.enter().append("div").attr("class", function(d2) {
72202           var classes = "toolbar-item " + (d2.id || d2).replace("_", "-");
72203           if (d2.klass)
72204             classes += " " + d2.klass;
72205           return classes;
72206         });
72207         var actionableItems = itemsEnter.filter(function(d2) {
72208           return d2 !== "spacer";
72209         });
72210         actionableItems.append("div").attr("class", "item-content").each(function(d2) {
72211           select_default2(this).call(d2.render, bar);
72212         });
72213         actionableItems.append("div").attr("class", "item-label").each(function(d2) {
72214           d2.label(select_default2(this));
72215         });
72216       }
72217     }
72218     return topToolbar;
72219   }
72220
72221   // modules/ui/zoom_to_selection.js
72222   function uiZoomToSelection(context) {
72223     function isDisabled() {
72224       var mode = context.mode();
72225       return !mode || !mode.zoomToSelected;
72226     }
72227     var _lastPointerUpType;
72228     function pointerup(d3_event) {
72229       _lastPointerUpType = d3_event.pointerType;
72230     }
72231     function click(d3_event) {
72232       d3_event.preventDefault();
72233       if (isDisabled()) {
72234         if (_lastPointerUpType === "touch" || _lastPointerUpType === "pen") {
72235           context.ui().flash.duration(2e3).iconName("#iD-icon-framed-dot").iconClass("disabled").label(_t.append("inspector.zoom_to.no_selection"))();
72236         }
72237       } else {
72238         var mode = context.mode();
72239         if (mode && mode.zoomToSelected) {
72240           mode.zoomToSelected();
72241         }
72242       }
72243       _lastPointerUpType = null;
72244     }
72245     return function(selection2) {
72246       var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function() {
72247         if (isDisabled()) {
72248           return _t.append("inspector.zoom_to.no_selection");
72249         }
72250         return _t.append("inspector.zoom_to.title");
72251       }).keys([_t("inspector.zoom_to.key")]);
72252       var button = selection2.append("button").on("pointerup", pointerup).on("click", click).call(svgIcon("#iD-icon-framed-dot", "light")).call(tooltipBehavior);
72253       function setEnabledState() {
72254         button.classed("disabled", isDisabled());
72255         if (!button.select(".tooltip.in").empty()) {
72256           button.call(tooltipBehavior.updateContent);
72257         }
72258       }
72259       context.on("enter.uiZoomToSelection", setEnabledState);
72260       setEnabledState();
72261     };
72262   }
72263
72264   // modules/ui/pane.js
72265   function uiPane(id2, context) {
72266     var _key;
72267     var _label = "";
72268     var _description = "";
72269     var _iconName = "";
72270     var _sections;
72271     var _paneSelection = select_default2(null);
72272     var _paneTooltip;
72273     var pane = {
72274       id: id2
72275     };
72276     pane.label = function(val) {
72277       if (!arguments.length)
72278         return _label;
72279       _label = val;
72280       return pane;
72281     };
72282     pane.key = function(val) {
72283       if (!arguments.length)
72284         return _key;
72285       _key = val;
72286       return pane;
72287     };
72288     pane.description = function(val) {
72289       if (!arguments.length)
72290         return _description;
72291       _description = val;
72292       return pane;
72293     };
72294     pane.iconName = function(val) {
72295       if (!arguments.length)
72296         return _iconName;
72297       _iconName = val;
72298       return pane;
72299     };
72300     pane.sections = function(val) {
72301       if (!arguments.length)
72302         return _sections;
72303       _sections = val;
72304       return pane;
72305     };
72306     pane.selection = function() {
72307       return _paneSelection;
72308     };
72309     function hidePane() {
72310       context.ui().togglePanes();
72311     }
72312     pane.togglePane = function(d3_event) {
72313       if (d3_event)
72314         d3_event.preventDefault();
72315       _paneTooltip.hide();
72316       context.ui().togglePanes(!_paneSelection.classed("shown") ? _paneSelection : void 0);
72317     };
72318     pane.renderToggleButton = function(selection2) {
72319       if (!_paneTooltip) {
72320         _paneTooltip = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _description).keys([_key]);
72321       }
72322       selection2.append("button").on("click", pane.togglePane).call(svgIcon("#" + _iconName, "light")).call(_paneTooltip);
72323     };
72324     pane.renderContent = function(selection2) {
72325       if (_sections) {
72326         _sections.forEach(function(section) {
72327           selection2.call(section.render);
72328         });
72329       }
72330     };
72331     pane.renderPane = function(selection2) {
72332       _paneSelection = selection2.append("div").attr("class", "fillL map-pane hide " + id2 + "-pane").attr("pane", id2);
72333       var heading = _paneSelection.append("div").attr("class", "pane-heading");
72334       heading.append("h2").text("").call(_label);
72335       heading.append("button").attr("title", _t("icons.close")).on("click", hidePane).call(svgIcon("#iD-icon-close"));
72336       _paneSelection.append("div").attr("class", "pane-content").call(pane.renderContent);
72337       if (_key) {
72338         context.keybinding().on(_key, pane.togglePane);
72339       }
72340     };
72341     return pane;
72342   }
72343
72344   // modules/ui/sections/background_display_options.js
72345   function uiSectionBackgroundDisplayOptions(context) {
72346     var section = uiSection("background-display-options", context).label(() => _t.append("background.display_options")).disclosureContent(renderDisclosureContent);
72347     var _storedOpacity = corePreferences("background-opacity");
72348     var _minVal = 0;
72349     var _maxVal = 3;
72350     var _sliders = ["brightness", "contrast", "saturation", "sharpness"];
72351     var _options = {
72352       brightness: _storedOpacity !== null ? +_storedOpacity : 1,
72353       contrast: 1,
72354       saturation: 1,
72355       sharpness: 1
72356     };
72357     function clamp3(x2, min3, max3) {
72358       return Math.max(min3, Math.min(x2, max3));
72359     }
72360     function updateValue(d2, val) {
72361       val = clamp3(val, _minVal, _maxVal);
72362       _options[d2] = val;
72363       context.background()[d2](val);
72364       if (d2 === "brightness") {
72365         corePreferences("background-opacity", val);
72366       }
72367       section.reRender();
72368     }
72369     function renderDisclosureContent(selection2) {
72370       var container = selection2.selectAll(".display-options-container").data([0]);
72371       var containerEnter = container.enter().append("div").attr("class", "display-options-container controls-list");
72372       var slidersEnter = containerEnter.selectAll(".display-control").data(_sliders).enter().append("label").attr("class", function(d2) {
72373         return "display-control display-control-" + d2;
72374       });
72375       slidersEnter.html(function(d2) {
72376         return _t.html("background." + d2);
72377       }).append("span").attr("class", function(d2) {
72378         return "display-option-value display-option-value-" + d2;
72379       });
72380       var sildersControlEnter = slidersEnter.append("div").attr("class", "control-wrap");
72381       sildersControlEnter.append("input").attr("class", function(d2) {
72382         return "display-option-input display-option-input-" + d2;
72383       }).attr("type", "range").attr("min", _minVal).attr("max", _maxVal).attr("step", "0.05").on("input", function(d3_event, d2) {
72384         var val = select_default2(this).property("value");
72385         if (!val && d3_event && d3_event.target) {
72386           val = d3_event.target.value;
72387         }
72388         updateValue(d2, val);
72389       });
72390       sildersControlEnter.append("button").attr("title", function(d2) {
72391         return "".concat(_t("background.reset"), " ").concat(_t("background." + d2));
72392       }).attr("class", function(d2) {
72393         return "display-option-reset display-option-reset-" + d2;
72394       }).on("click", function(d3_event, d2) {
72395         if (d3_event.button !== 0)
72396           return;
72397         updateValue(d2, 1);
72398       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
72399       containerEnter.append("a").attr("class", "display-option-resetlink").attr("role", "button").attr("href", "#").call(_t.append("background.reset_all")).on("click", function(d3_event) {
72400         d3_event.preventDefault();
72401         for (var i3 = 0; i3 < _sliders.length; i3++) {
72402           updateValue(_sliders[i3], 1);
72403         }
72404       });
72405       container = containerEnter.merge(container);
72406       container.selectAll(".display-option-input").property("value", function(d2) {
72407         return _options[d2];
72408       });
72409       container.selectAll(".display-option-value").text(function(d2) {
72410         return Math.floor(_options[d2] * 100) + "%";
72411       });
72412       container.selectAll(".display-option-reset").classed("disabled", function(d2) {
72413         return _options[d2] === 1;
72414       });
72415       if (containerEnter.size() && _options.brightness !== 1) {
72416         context.background().brightness(_options.brightness);
72417       }
72418     }
72419     return section;
72420   }
72421
72422   // modules/ui/settings/custom_background.js
72423   function uiSettingsCustomBackground() {
72424     var dispatch14 = dispatch_default("change");
72425     function render(selection2) {
72426       var _origSettings = {
72427         template: corePreferences("background-custom-template")
72428       };
72429       var _currSettings = {
72430         template: corePreferences("background-custom-template")
72431       };
72432       var example = "https://{switch:a,b,c}.tile.openstreetmap.org/{zoom}/{x}/{y}.png";
72433       var modal = uiConfirm(selection2).okButton();
72434       modal.classed("settings-modal settings-custom-background", true);
72435       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_background.header"));
72436       var textSection = modal.select(".modal-section.message-text");
72437       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, "`");
72438       textSection.append("div").attr("class", "instructions-template").html(marked(instructions));
72439       textSection.append("textarea").attr("class", "field-template").attr("placeholder", _t("settings.custom_background.template.placeholder")).call(utilNoAuto).property("value", _currSettings.template);
72440       var buttonSection = modal.select(".modal-section.buttons");
72441       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
72442       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
72443       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
72444       function isSaveDisabled() {
72445         return null;
72446       }
72447       function clickCancel() {
72448         textSection.select(".field-template").property("value", _origSettings.template);
72449         corePreferences("background-custom-template", _origSettings.template);
72450         this.blur();
72451         modal.close();
72452       }
72453       function clickSave() {
72454         _currSettings.template = textSection.select(".field-template").property("value");
72455         corePreferences("background-custom-template", _currSettings.template);
72456         this.blur();
72457         modal.close();
72458         dispatch14.call("change", this, _currSettings);
72459       }
72460     }
72461     return utilRebind(render, dispatch14, "on");
72462   }
72463
72464   // modules/ui/sections/background_list.js
72465   function uiSectionBackgroundList(context) {
72466     var _backgroundList = select_default2(null);
72467     var _customSource = context.background().findSource("custom");
72468     var _settingsCustomBackground = uiSettingsCustomBackground(context).on("change", customChanged);
72469     var section = uiSection("background-list", context).label(() => _t.append("background.backgrounds")).disclosureContent(renderDisclosureContent);
72470     function previousBackgroundID() {
72471       return corePreferences("background-last-used-toggle");
72472     }
72473     function renderDisclosureContent(selection2) {
72474       var container = selection2.selectAll(".layer-background-list").data([0]);
72475       _backgroundList = container.enter().append("ul").attr("class", "layer-list layer-background-list").attr("dir", "auto").merge(container);
72476       var bgExtrasListEnter = selection2.selectAll(".bg-extras-list").data([0]).enter().append("ul").attr("class", "layer-list bg-extras-list");
72477       var minimapLabelEnter = bgExtrasListEnter.append("li").attr("class", "minimap-toggle-item").append("label").call(
72478         uiTooltip().title(() => _t.append("background.minimap.tooltip")).keys([_t("background.minimap.key")]).placement("top")
72479       );
72480       minimapLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
72481         d3_event.preventDefault();
72482         uiMapInMap.toggle();
72483       });
72484       minimapLabelEnter.append("span").call(_t.append("background.minimap.description"));
72485       var panelLabelEnter = bgExtrasListEnter.append("li").attr("class", "background-panel-toggle-item").append("label").call(
72486         uiTooltip().title(() => _t.append("background.panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.background.key"))]).placement("top")
72487       );
72488       panelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
72489         d3_event.preventDefault();
72490         context.ui().info.toggle("background");
72491       });
72492       panelLabelEnter.append("span").call(_t.append("background.panel.description"));
72493       var locPanelLabelEnter = bgExtrasListEnter.append("li").attr("class", "location-panel-toggle-item").append("label").call(
72494         uiTooltip().title(() => _t.append("background.location_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.location.key"))]).placement("top")
72495       );
72496       locPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
72497         d3_event.preventDefault();
72498         context.ui().info.toggle("location");
72499       });
72500       locPanelLabelEnter.append("span").call(_t.append("background.location_panel.description"));
72501       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"));
72502       _backgroundList.call(drawListItems, "radio", function(d3_event, d2) {
72503         chooseBackground(d2);
72504       }, function(d2) {
72505         return !d2.isHidden() && !d2.overlay;
72506       });
72507     }
72508     function setTooltips(selection2) {
72509       selection2.each(function(d2, i3, nodes) {
72510         var item = select_default2(this).select("label");
72511         var span = item.select("span");
72512         var placement = i3 < nodes.length / 2 ? "bottom" : "top";
72513         var hasDescription = d2.hasDescription();
72514         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
72515         item.call(uiTooltip().destroyAny);
72516         if (d2.id === previousBackgroundID()) {
72517           item.call(
72518             uiTooltip().placement(placement).title(() => _t.append("background.switch")).keys([uiCmd("\u2318" + _t("background.key"))])
72519           );
72520         } else if (hasDescription || isOverflowing) {
72521           item.call(
72522             uiTooltip().placement(placement).title(() => hasDescription ? d2.description() : d2.label())
72523           );
72524         }
72525       });
72526     }
72527     function drawListItems(layerList, type2, change, filter2) {
72528       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2).sort(function(a2, b2) {
72529         return a2.best() && !b2.best() ? -1 : b2.best() && !a2.best() ? 1 : descending(a2.area(), b2.area()) || ascending(a2.name(), b2.name()) || 0;
72530       });
72531       var layerLinks = layerList.selectAll("li").data(sources, function(d2, i3) {
72532         return d2.id + "---" + i3;
72533       });
72534       layerLinks.exit().remove();
72535       var enter = layerLinks.enter().append("li").classed("layer-custom", function(d2) {
72536         return d2.id === "custom";
72537       }).classed("best", function(d2) {
72538         return d2.best();
72539       });
72540       var label = enter.append("label");
72541       label.append("input").attr("type", type2).attr("name", "background-layer").attr("value", function(d2) {
72542         return d2.id;
72543       }).on("change", change);
72544       label.append("span").each(function(d2) {
72545         d2.label()(select_default2(this));
72546       });
72547       enter.filter(function(d2) {
72548         return d2.id === "custom";
72549       }).append("button").attr("class", "layer-browse").call(
72550         uiTooltip().title(() => _t.append("settings.custom_background.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
72551       ).on("click", function(d3_event) {
72552         d3_event.preventDefault();
72553         editCustom();
72554       }).call(svgIcon("#iD-icon-more"));
72555       enter.filter(function(d2) {
72556         return d2.best();
72557       }).append("div").attr("class", "best").call(
72558         uiTooltip().title(() => _t.append("background.best_imagery")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
72559       ).append("span").text("\u2605");
72560       layerList.call(updateLayerSelections);
72561     }
72562     function updateLayerSelections(selection2) {
72563       function active(d2) {
72564         return context.background().showsLayer(d2);
72565       }
72566       selection2.selectAll("li").classed("active", active).classed("switch", function(d2) {
72567         return d2.id === previousBackgroundID();
72568       }).call(setTooltips).selectAll("input").property("checked", active);
72569     }
72570     function chooseBackground(d2) {
72571       if (d2.id === "custom" && !d2.template()) {
72572         return editCustom();
72573       }
72574       var previousBackground = context.background().baseLayerSource();
72575       corePreferences("background-last-used-toggle", previousBackground.id);
72576       corePreferences("background-last-used", d2.id);
72577       context.background().baseLayerSource(d2);
72578     }
72579     function customChanged(d2) {
72580       if (d2 && d2.template) {
72581         _customSource.template(d2.template);
72582         chooseBackground(_customSource);
72583       } else {
72584         _customSource.template("");
72585         chooseBackground(context.background().findSource("none"));
72586       }
72587     }
72588     function editCustom() {
72589       context.container().call(_settingsCustomBackground);
72590     }
72591     context.background().on("change.background_list", function() {
72592       _backgroundList.call(updateLayerSelections);
72593     });
72594     context.map().on(
72595       "move.background_list",
72596       debounce_default(function() {
72597         window.requestIdleCallback(section.reRender);
72598       }, 1e3)
72599     );
72600     return section;
72601   }
72602
72603   // modules/ui/sections/background_offset.js
72604   function uiSectionBackgroundOffset(context) {
72605     var section = uiSection("background-offset", context).label(() => _t.append("background.fix_misalignment")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
72606     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
72607     var _directions = [
72608       ["top", [0, -0.5]],
72609       ["left", [-0.5, 0]],
72610       ["right", [0.5, 0]],
72611       ["bottom", [0, 0.5]]
72612     ];
72613     function updateValue() {
72614       var meters = geoOffsetToMeters(context.background().offset());
72615       var x2 = +meters[0].toFixed(2);
72616       var y2 = +meters[1].toFixed(2);
72617       context.container().selectAll(".nudge-inner-rect").select("input").classed("error", false).property("value", x2 + ", " + y2);
72618       context.container().selectAll(".nudge-reset").classed("disabled", function() {
72619         return x2 === 0 && y2 === 0;
72620       });
72621     }
72622     function resetOffset() {
72623       context.background().offset([0, 0]);
72624       updateValue();
72625     }
72626     function nudge(d2) {
72627       context.background().nudge(d2, context.map().zoom());
72628       updateValue();
72629     }
72630     function inputOffset() {
72631       var input = select_default2(this);
72632       var d2 = input.node().value;
72633       if (d2 === "")
72634         return resetOffset();
72635       d2 = d2.replace(/;/g, ",").split(",").map(function(n3) {
72636         return !isNaN(n3) && n3;
72637       });
72638       if (d2.length !== 2 || !d2[0] || !d2[1]) {
72639         input.classed("error", true);
72640         return;
72641       }
72642       context.background().offset(geoMetersToOffset(d2));
72643       updateValue();
72644     }
72645     function dragOffset(d3_event) {
72646       if (d3_event.button !== 0)
72647         return;
72648       var origin = [d3_event.clientX, d3_event.clientY];
72649       var pointerId = d3_event.pointerId || "mouse";
72650       context.container().append("div").attr("class", "nudge-surface");
72651       select_default2(window).on(_pointerPrefix + "move.drag-bg-offset", pointermove).on(_pointerPrefix + "up.drag-bg-offset", pointerup);
72652       if (_pointerPrefix === "pointer") {
72653         select_default2(window).on("pointercancel.drag-bg-offset", pointerup);
72654       }
72655       function pointermove(d3_event2) {
72656         if (pointerId !== (d3_event2.pointerId || "mouse"))
72657           return;
72658         var latest = [d3_event2.clientX, d3_event2.clientY];
72659         var d2 = [
72660           -(origin[0] - latest[0]) / 4,
72661           -(origin[1] - latest[1]) / 4
72662         ];
72663         origin = latest;
72664         nudge(d2);
72665       }
72666       function pointerup(d3_event2) {
72667         if (pointerId !== (d3_event2.pointerId || "mouse"))
72668           return;
72669         if (d3_event2.button !== 0)
72670           return;
72671         context.container().selectAll(".nudge-surface").remove();
72672         select_default2(window).on(".drag-bg-offset", null);
72673       }
72674     }
72675     function renderDisclosureContent(selection2) {
72676       var container = selection2.selectAll(".nudge-container").data([0]);
72677       var containerEnter = container.enter().append("div").attr("class", "nudge-container");
72678       containerEnter.append("div").attr("class", "nudge-instructions").call(_t.append("background.offset"));
72679       var nudgeWrapEnter = containerEnter.append("div").attr("class", "nudge-controls-wrap");
72680       var nudgeEnter = nudgeWrapEnter.append("div").attr("class", "nudge-outer-rect").on(_pointerPrefix + "down", dragOffset);
72681       nudgeEnter.append("div").attr("class", "nudge-inner-rect").append("input").attr("type", "text").attr("aria-label", _t("background.offset_label")).on("change", inputOffset);
72682       nudgeWrapEnter.append("div").selectAll("button").data(_directions).enter().append("button").attr("title", function(d2) {
72683         return _t("background.nudge.".concat(d2[0]));
72684       }).attr("class", function(d2) {
72685         return d2[0] + " nudge";
72686       }).on("click", function(d3_event, d2) {
72687         nudge(d2[1]);
72688       });
72689       nudgeWrapEnter.append("button").attr("title", _t("background.reset")).attr("class", "nudge-reset disabled").on("click", function(d3_event) {
72690         d3_event.preventDefault();
72691         resetOffset();
72692       }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
72693       updateValue();
72694     }
72695     context.background().on("change.backgroundOffset-update", updateValue);
72696     return section;
72697   }
72698
72699   // modules/ui/sections/overlay_list.js
72700   function uiSectionOverlayList(context) {
72701     var section = uiSection("overlay-list", context).label(() => _t.append("background.overlays")).disclosureContent(renderDisclosureContent);
72702     var _overlayList = select_default2(null);
72703     function setTooltips(selection2) {
72704       selection2.each(function(d2, i3, nodes) {
72705         var item = select_default2(this).select("label");
72706         var span = item.select("span");
72707         var placement = i3 < nodes.length / 2 ? "bottom" : "top";
72708         var description = d2.description();
72709         var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
72710         item.call(uiTooltip().destroyAny);
72711         if (description || isOverflowing) {
72712           item.call(
72713             uiTooltip().placement(placement).title(() => description || d2.name())
72714           );
72715         }
72716       });
72717     }
72718     function updateLayerSelections(selection2) {
72719       function active(d2) {
72720         return context.background().showsLayer(d2);
72721       }
72722       selection2.selectAll("li").classed("active", active).call(setTooltips).selectAll("input").property("checked", active);
72723     }
72724     function chooseOverlay(d3_event, d2) {
72725       d3_event.preventDefault();
72726       context.background().toggleOverlayLayer(d2);
72727       _overlayList.call(updateLayerSelections);
72728       document.activeElement.blur();
72729     }
72730     function drawListItems(layerList, type2, change, filter2) {
72731       var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2);
72732       var layerLinks = layerList.selectAll("li").data(sources, function(d2) {
72733         return d2.name();
72734       });
72735       layerLinks.exit().remove();
72736       var enter = layerLinks.enter().append("li");
72737       var label = enter.append("label");
72738       label.append("input").attr("type", type2).attr("name", "layers").on("change", change);
72739       label.append("span").each(function(d2) {
72740         d2.label()(select_default2(this));
72741       });
72742       layerList.selectAll("li").sort(sortSources);
72743       layerList.call(updateLayerSelections);
72744       function sortSources(a2, b2) {
72745         return a2.best() && !b2.best() ? -1 : b2.best() && !a2.best() ? 1 : descending(a2.area(), b2.area()) || ascending(a2.name(), b2.name()) || 0;
72746       }
72747     }
72748     function renderDisclosureContent(selection2) {
72749       var container = selection2.selectAll(".layer-overlay-list").data([0]);
72750       _overlayList = container.enter().append("ul").attr("class", "layer-list layer-overlay-list").attr("dir", "auto").merge(container);
72751       _overlayList.call(drawListItems, "checkbox", chooseOverlay, function(d2) {
72752         return !d2.isHidden() && d2.overlay;
72753       });
72754     }
72755     context.map().on(
72756       "move.overlay_list",
72757       debounce_default(function() {
72758         window.requestIdleCallback(section.reRender);
72759       }, 1e3)
72760     );
72761     return section;
72762   }
72763
72764   // modules/ui/panes/background.js
72765   function uiPaneBackground(context) {
72766     var backgroundPane = uiPane("background", context).key(_t("background.key")).label(_t.append("background.title")).description(_t.append("background.description")).iconName("iD-icon-layers").sections([
72767       uiSectionBackgroundList(context),
72768       uiSectionOverlayList(context),
72769       uiSectionBackgroundDisplayOptions(context),
72770       uiSectionBackgroundOffset(context)
72771     ]);
72772     return backgroundPane;
72773   }
72774
72775   // modules/ui/panes/help.js
72776   function uiPaneHelp(context) {
72777     var docKeys = [
72778       ["help", [
72779         "welcome",
72780         "open_data_h",
72781         "open_data",
72782         "before_start_h",
72783         "before_start",
72784         "open_source_h",
72785         "open_source",
72786         "open_source_attribution",
72787         "open_source_help"
72788       ]],
72789       ["overview", [
72790         "navigation_h",
72791         "navigation_drag",
72792         "navigation_zoom",
72793         "features_h",
72794         "features",
72795         "nodes_ways"
72796       ]],
72797       ["editing", [
72798         "select_h",
72799         "select_left_click",
72800         "select_right_click",
72801         "select_space",
72802         "multiselect_h",
72803         "multiselect",
72804         "multiselect_shift_click",
72805         "multiselect_lasso",
72806         "undo_redo_h",
72807         "undo_redo",
72808         "save_h",
72809         "save",
72810         "save_validation",
72811         "upload_h",
72812         "upload",
72813         "backups_h",
72814         "backups",
72815         "keyboard_h",
72816         "keyboard"
72817       ]],
72818       ["feature_editor", [
72819         "intro",
72820         "definitions",
72821         "type_h",
72822         "type",
72823         "type_picker",
72824         "fields_h",
72825         "fields_all_fields",
72826         "fields_example",
72827         "fields_add_field",
72828         "tags_h",
72829         "tags_all_tags",
72830         "tags_resources"
72831       ]],
72832       ["points", [
72833         "intro",
72834         "add_point_h",
72835         "add_point",
72836         "add_point_finish",
72837         "move_point_h",
72838         "move_point",
72839         "delete_point_h",
72840         "delete_point",
72841         "delete_point_command"
72842       ]],
72843       ["lines", [
72844         "intro",
72845         "add_line_h",
72846         "add_line",
72847         "add_line_draw",
72848         "add_line_continue",
72849         "add_line_finish",
72850         "modify_line_h",
72851         "modify_line_dragnode",
72852         "modify_line_addnode",
72853         "connect_line_h",
72854         "connect_line",
72855         "connect_line_display",
72856         "connect_line_drag",
72857         "connect_line_tag",
72858         "disconnect_line_h",
72859         "disconnect_line_command",
72860         "move_line_h",
72861         "move_line_command",
72862         "move_line_connected",
72863         "delete_line_h",
72864         "delete_line",
72865         "delete_line_command"
72866       ]],
72867       ["areas", [
72868         "intro",
72869         "point_or_area_h",
72870         "point_or_area",
72871         "add_area_h",
72872         "add_area_command",
72873         "add_area_draw",
72874         "add_area_continue",
72875         "add_area_finish",
72876         "square_area_h",
72877         "square_area_command",
72878         "modify_area_h",
72879         "modify_area_dragnode",
72880         "modify_area_addnode",
72881         "delete_area_h",
72882         "delete_area",
72883         "delete_area_command"
72884       ]],
72885       ["relations", [
72886         "intro",
72887         "edit_relation_h",
72888         "edit_relation",
72889         "edit_relation_add",
72890         "edit_relation_delete",
72891         "maintain_relation_h",
72892         "maintain_relation",
72893         "relation_types_h",
72894         "multipolygon_h",
72895         "multipolygon",
72896         "multipolygon_create",
72897         "multipolygon_merge",
72898         "turn_restriction_h",
72899         "turn_restriction",
72900         "turn_restriction_field",
72901         "turn_restriction_editing",
72902         "route_h",
72903         "route",
72904         "route_add",
72905         "boundary_h",
72906         "boundary",
72907         "boundary_add"
72908       ]],
72909       ["operations", [
72910         "intro",
72911         "intro_2",
72912         "straighten",
72913         "orthogonalize",
72914         "circularize",
72915         "move",
72916         "rotate",
72917         "reflect",
72918         "continue",
72919         "reverse",
72920         "disconnect",
72921         "split",
72922         "extract",
72923         "merge",
72924         "delete",
72925         "downgrade",
72926         "copy_paste"
72927       ]],
72928       ["notes", [
72929         "intro",
72930         "add_note_h",
72931         "add_note",
72932         "place_note",
72933         "move_note",
72934         "update_note_h",
72935         "update_note",
72936         "save_note_h",
72937         "save_note"
72938       ]],
72939       ["imagery", [
72940         "intro",
72941         "sources_h",
72942         "choosing",
72943         "sources",
72944         "offsets_h",
72945         "offset",
72946         "offset_change"
72947       ]],
72948       ["streetlevel", [
72949         "intro",
72950         "using_h",
72951         "using",
72952         "photos",
72953         "viewer"
72954       ]],
72955       ["gps", [
72956         "intro",
72957         "survey",
72958         "using_h",
72959         "using",
72960         "tracing",
72961         "upload"
72962       ]],
72963       ["qa", [
72964         "intro",
72965         "tools_h",
72966         "tools",
72967         "issues_h",
72968         "issues"
72969       ]]
72970     ];
72971     var headings = {
72972       "help.help.open_data_h": 3,
72973       "help.help.before_start_h": 3,
72974       "help.help.open_source_h": 3,
72975       "help.overview.navigation_h": 3,
72976       "help.overview.features_h": 3,
72977       "help.editing.select_h": 3,
72978       "help.editing.multiselect_h": 3,
72979       "help.editing.undo_redo_h": 3,
72980       "help.editing.save_h": 3,
72981       "help.editing.upload_h": 3,
72982       "help.editing.backups_h": 3,
72983       "help.editing.keyboard_h": 3,
72984       "help.feature_editor.type_h": 3,
72985       "help.feature_editor.fields_h": 3,
72986       "help.feature_editor.tags_h": 3,
72987       "help.points.add_point_h": 3,
72988       "help.points.move_point_h": 3,
72989       "help.points.delete_point_h": 3,
72990       "help.lines.add_line_h": 3,
72991       "help.lines.modify_line_h": 3,
72992       "help.lines.connect_line_h": 3,
72993       "help.lines.disconnect_line_h": 3,
72994       "help.lines.move_line_h": 3,
72995       "help.lines.delete_line_h": 3,
72996       "help.areas.point_or_area_h": 3,
72997       "help.areas.add_area_h": 3,
72998       "help.areas.square_area_h": 3,
72999       "help.areas.modify_area_h": 3,
73000       "help.areas.delete_area_h": 3,
73001       "help.relations.edit_relation_h": 3,
73002       "help.relations.maintain_relation_h": 3,
73003       "help.relations.relation_types_h": 2,
73004       "help.relations.multipolygon_h": 3,
73005       "help.relations.turn_restriction_h": 3,
73006       "help.relations.route_h": 3,
73007       "help.relations.boundary_h": 3,
73008       "help.notes.add_note_h": 3,
73009       "help.notes.update_note_h": 3,
73010       "help.notes.save_note_h": 3,
73011       "help.imagery.sources_h": 3,
73012       "help.imagery.offsets_h": 3,
73013       "help.streetlevel.using_h": 3,
73014       "help.gps.using_h": 3,
73015       "help.qa.tools_h": 3,
73016       "help.qa.issues_h": 3
73017     };
73018     var docs = docKeys.map(function(key) {
73019       var helpkey = "help." + key[0];
73020       var helpPaneReplacements = { version: context.version };
73021       var text2 = key[1].reduce(function(all, part) {
73022         var subkey = helpkey + "." + part;
73023         var depth = headings[subkey];
73024         var hhh = depth ? Array(depth + 1).join("#") + " " : "";
73025         return all + hhh + helpHtml(subkey, helpPaneReplacements) + "\n\n";
73026       }, "");
73027       return {
73028         title: _t.html(helpkey + ".title"),
73029         content: marked(text2.trim()).replace(/<code>/g, "<kbd>").replace(/<\/code>/g, "</kbd>")
73030       };
73031     });
73032     var helpPane = uiPane("help", context).key(_t("help.key")).label(_t.append("help.title")).description(_t.append("help.title")).iconName("iD-icon-help");
73033     helpPane.renderContent = function(content) {
73034       function clickHelp(d2, i3) {
73035         var rtl = _mainLocalizer.textDirection() === "rtl";
73036         content.property("scrollTop", 0);
73037         helpPane.selection().select(".pane-heading h2").html(d2.title);
73038         body.html(d2.content);
73039         body.selectAll("a").attr("target", "_blank");
73040         menuItems.classed("selected", function(m2) {
73041           return m2.title === d2.title;
73042         });
73043         nav.html("");
73044         if (rtl) {
73045           nav.call(drawNext).call(drawPrevious);
73046         } else {
73047           nav.call(drawPrevious).call(drawNext);
73048         }
73049         function drawNext(selection2) {
73050           if (i3 < docs.length - 1) {
73051             var nextLink = selection2.append("a").attr("href", "#").attr("class", "next").on("click", function(d3_event) {
73052               d3_event.preventDefault();
73053               clickHelp(docs[i3 + 1], i3 + 1);
73054             });
73055             nextLink.append("span").html(docs[i3 + 1].title).call(svgIcon(rtl ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
73056           }
73057         }
73058         function drawPrevious(selection2) {
73059           if (i3 > 0) {
73060             var prevLink = selection2.append("a").attr("href", "#").attr("class", "previous").on("click", function(d3_event) {
73061               d3_event.preventDefault();
73062               clickHelp(docs[i3 - 1], i3 - 1);
73063             });
73064             prevLink.call(svgIcon(rtl ? "#iD-icon-forward" : "#iD-icon-backward", "inline")).append("span").html(docs[i3 - 1].title);
73065           }
73066         }
73067       }
73068       function clickWalkthrough(d3_event) {
73069         d3_event.preventDefault();
73070         if (context.inIntro())
73071           return;
73072         context.container().call(uiIntro(context));
73073         context.ui().togglePanes();
73074       }
73075       function clickShortcuts(d3_event) {
73076         d3_event.preventDefault();
73077         context.container().call(context.ui().shortcuts, true);
73078       }
73079       var toc = content.append("ul").attr("class", "toc");
73080       var menuItems = toc.selectAll("li").data(docs).enter().append("li").append("a").attr("role", "button").attr("href", "#").html(function(d2) {
73081         return d2.title;
73082       }).on("click", function(d3_event, d2) {
73083         d3_event.preventDefault();
73084         clickHelp(d2, docs.indexOf(d2));
73085       });
73086       var shortcuts = toc.append("li").attr("class", "shortcuts").call(
73087         uiTooltip().title(() => _t.append("shortcuts.tooltip")).keys(["?"]).placement("top")
73088       ).append("a").attr("href", "#").on("click", clickShortcuts);
73089       shortcuts.append("div").call(_t.append("shortcuts.title"));
73090       var walkthrough = toc.append("li").attr("class", "walkthrough").append("a").attr("href", "#").on("click", clickWalkthrough);
73091       walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
73092       walkthrough.append("div").call(_t.append("splash.walkthrough"));
73093       var helpContent = content.append("div").attr("class", "left-content");
73094       var body = helpContent.append("div").attr("class", "body");
73095       var nav = helpContent.append("div").attr("class", "nav");
73096       clickHelp(docs[0], 0);
73097     };
73098     return helpPane;
73099   }
73100
73101   // modules/ui/sections/validation_issues.js
73102   function uiSectionValidationIssues(id2, severity, context) {
73103     var _issues = [];
73104     var section = uiSection(id2, context).label(function() {
73105       if (!_issues)
73106         return "";
73107       var issueCountText = _issues.length > 1e3 ? "1000+" : String(_issues.length);
73108       return _t.append("inspector.title_count", { title: _t("issues." + severity + "s.list_title"), count: issueCountText });
73109     }).disclosureContent(renderDisclosureContent).shouldDisplay(function() {
73110       return _issues && _issues.length;
73111     });
73112     function getOptions() {
73113       return {
73114         what: corePreferences("validate-what") || "edited",
73115         where: corePreferences("validate-where") || "all"
73116       };
73117     }
73118     function reloadIssues() {
73119       _issues = context.validator().getIssuesBySeverity(getOptions())[severity];
73120     }
73121     function renderDisclosureContent(selection2) {
73122       var center = context.map().center();
73123       var graph = context.graph();
73124       var issues = _issues.map(function withDistance(issue) {
73125         var extent = issue.extent(graph);
73126         var dist = extent ? geoSphericalDistance(center, extent.center()) : 0;
73127         return Object.assign(issue, { dist });
73128       }).sort(function byDistance(a2, b2) {
73129         return a2.dist - b2.dist;
73130       });
73131       issues = issues.slice(0, 1e3);
73132       selection2.call(drawIssuesList, issues);
73133     }
73134     function drawIssuesList(selection2, issues) {
73135       var list = selection2.selectAll(".issues-list").data([0]);
73136       list = list.enter().append("ul").attr("class", "layer-list issues-list " + severity + "s-list").merge(list);
73137       var items = list.selectAll("li").data(issues, function(d2) {
73138         return d2.key;
73139       });
73140       items.exit().remove();
73141       var itemsEnter = items.enter().append("li").attr("class", function(d2) {
73142         return "issue severity-" + d2.severity;
73143       });
73144       var labelsEnter = itemsEnter.append("button").attr("class", "issue-label").on("click", function(d3_event, d2) {
73145         context.validator().focusIssue(d2);
73146       }).on("mouseover", function(d3_event, d2) {
73147         utilHighlightEntities(d2.entityIds, true, context);
73148       }).on("mouseout", function(d3_event, d2) {
73149         utilHighlightEntities(d2.entityIds, false, context);
73150       });
73151       var textEnter = labelsEnter.append("span").attr("class", "issue-text");
73152       textEnter.append("span").attr("class", "issue-icon").each(function(d2) {
73153         var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
73154         select_default2(this).call(svgIcon(iconName));
73155       });
73156       textEnter.append("span").attr("class", "issue-message");
73157       items = items.merge(itemsEnter).order();
73158       items.selectAll(".issue-message").text("").each(function(d2) {
73159         return d2.message(context)(select_default2(this));
73160       });
73161     }
73162     context.validator().on("validated.uiSectionValidationIssues" + id2, function() {
73163       window.requestIdleCallback(function() {
73164         reloadIssues();
73165         section.reRender();
73166       });
73167     });
73168     context.map().on(
73169       "move.uiSectionValidationIssues" + id2,
73170       debounce_default(function() {
73171         window.requestIdleCallback(function() {
73172           if (getOptions().where === "visible") {
73173             reloadIssues();
73174           }
73175           section.reRender();
73176         });
73177       }, 1e3)
73178     );
73179     return section;
73180   }
73181
73182   // modules/ui/sections/validation_options.js
73183   function uiSectionValidationOptions(context) {
73184     var section = uiSection("issues-options", context).content(renderContent);
73185     function renderContent(selection2) {
73186       var container = selection2.selectAll(".issues-options-container").data([0]);
73187       container = container.enter().append("div").attr("class", "issues-options-container").merge(container);
73188       var data = [
73189         { key: "what", values: ["edited", "all"] },
73190         { key: "where", values: ["visible", "all"] }
73191       ];
73192       var options2 = container.selectAll(".issues-option").data(data, function(d2) {
73193         return d2.key;
73194       });
73195       var optionsEnter = options2.enter().append("div").attr("class", function(d2) {
73196         return "issues-option issues-option-" + d2.key;
73197       });
73198       optionsEnter.append("div").attr("class", "issues-option-title").html(function(d2) {
73199         return _t.html("issues.options." + d2.key + ".title");
73200       });
73201       var valuesEnter = optionsEnter.selectAll("label").data(function(d2) {
73202         return d2.values.map(function(val) {
73203           return { value: val, key: d2.key };
73204         });
73205       }).enter().append("label");
73206       valuesEnter.append("input").attr("type", "radio").attr("name", function(d2) {
73207         return "issues-option-" + d2.key;
73208       }).attr("value", function(d2) {
73209         return d2.value;
73210       }).property("checked", function(d2) {
73211         return getOptions()[d2.key] === d2.value;
73212       }).on("change", function(d3_event, d2) {
73213         updateOptionValue(d3_event, d2.key, d2.value);
73214       });
73215       valuesEnter.append("span").html(function(d2) {
73216         return _t.html("issues.options." + d2.key + "." + d2.value);
73217       });
73218     }
73219     function getOptions() {
73220       return {
73221         what: corePreferences("validate-what") || "edited",
73222         // 'all', 'edited'
73223         where: corePreferences("validate-where") || "all"
73224         // 'all', 'visible'
73225       };
73226     }
73227     function updateOptionValue(d3_event, d2, val) {
73228       if (!val && d3_event && d3_event.target) {
73229         val = d3_event.target.value;
73230       }
73231       corePreferences("validate-" + d2, val);
73232       context.validator().validate();
73233     }
73234     return section;
73235   }
73236
73237   // modules/ui/sections/validation_rules.js
73238   function uiSectionValidationRules(context) {
73239     var MINSQUARE = 0;
73240     var MAXSQUARE = 20;
73241     var DEFAULTSQUARE = 5;
73242     var section = uiSection("issues-rules", context).disclosureContent(renderDisclosureContent).label(() => _t.append("issues.rules.title"));
73243     var _ruleKeys = context.validator().getRuleKeys().filter(function(key) {
73244       return key !== "maprules";
73245     }).sort(function(key1, key2) {
73246       return _t("issues." + key1 + ".title") < _t("issues." + key2 + ".title") ? -1 : 1;
73247     });
73248     function renderDisclosureContent(selection2) {
73249       var container = selection2.selectAll(".issues-rulelist-container").data([0]);
73250       var containerEnter = container.enter().append("div").attr("class", "issues-rulelist-container");
73251       containerEnter.append("ul").attr("class", "layer-list issue-rules-list");
73252       var ruleLinks = containerEnter.append("div").attr("class", "issue-rules-links section-footer");
73253       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
73254         d3_event.preventDefault();
73255         context.validator().disableRules(_ruleKeys);
73256       });
73257       ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
73258         d3_event.preventDefault();
73259         context.validator().disableRules([]);
73260       });
73261       container = container.merge(containerEnter);
73262       container.selectAll(".issue-rules-list").call(drawListItems, _ruleKeys, "checkbox", "rule", toggleRule, isRuleEnabled);
73263     }
73264     function drawListItems(selection2, data, type2, name, change, active) {
73265       var items = selection2.selectAll("li").data(data);
73266       items.exit().remove();
73267       var enter = items.enter().append("li");
73268       if (name === "rule") {
73269         enter.call(
73270           uiTooltip().title(function(d2) {
73271             return _t.append("issues." + d2 + ".tip");
73272           }).placement("top")
73273         );
73274       }
73275       var label = enter.append("label");
73276       label.append("input").attr("type", type2).attr("name", name).on("change", change);
73277       label.append("span").html(function(d2) {
73278         var params = {};
73279         if (d2 === "unsquare_way") {
73280           params.val = { html: '<span class="square-degrees"></span>' };
73281         }
73282         return _t.html("issues." + d2 + ".title", params);
73283       });
73284       items = items.merge(enter);
73285       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
73286       var degStr = corePreferences("validate-square-degrees");
73287       if (degStr === null) {
73288         degStr = DEFAULTSQUARE.toString();
73289       }
73290       var span = items.selectAll(".square-degrees");
73291       var input = span.selectAll(".square-degrees-input").data([0]);
73292       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) {
73293         d3_event.preventDefault();
73294         d3_event.stopPropagation();
73295         this.select();
73296       }).on("keyup", function(d3_event) {
73297         if (d3_event.keyCode === 13) {
73298           this.blur();
73299           this.select();
73300         }
73301       }).on("blur", changeSquare).merge(input).property("value", degStr);
73302     }
73303     function changeSquare() {
73304       var input = select_default2(this);
73305       var degStr = utilGetSetValue(input).trim();
73306       var degNum = Number(degStr);
73307       if (!isFinite(degNum)) {
73308         degNum = DEFAULTSQUARE;
73309       } else if (degNum > MAXSQUARE) {
73310         degNum = MAXSQUARE;
73311       } else if (degNum < MINSQUARE) {
73312         degNum = MINSQUARE;
73313       }
73314       degNum = Math.round(degNum * 10) / 10;
73315       degStr = degNum.toString();
73316       input.property("value", degStr);
73317       corePreferences("validate-square-degrees", degStr);
73318       context.validator().revalidateUnsquare();
73319     }
73320     function isRuleEnabled(d2) {
73321       return context.validator().isRuleEnabled(d2);
73322     }
73323     function toggleRule(d3_event, d2) {
73324       context.validator().toggleRule(d2);
73325     }
73326     context.validator().on("validated.uiSectionValidationRules", function() {
73327       window.requestIdleCallback(section.reRender);
73328     });
73329     return section;
73330   }
73331
73332   // modules/ui/sections/validation_status.js
73333   function uiSectionValidationStatus(context) {
73334     var section = uiSection("issues-status", context).content(renderContent).shouldDisplay(function() {
73335       var issues = context.validator().getIssues(getOptions());
73336       return issues.length === 0;
73337     });
73338     function getOptions() {
73339       return {
73340         what: corePreferences("validate-what") || "edited",
73341         where: corePreferences("validate-where") || "all"
73342       };
73343     }
73344     function renderContent(selection2) {
73345       var box = selection2.selectAll(".box").data([0]);
73346       var boxEnter = box.enter().append("div").attr("class", "box");
73347       boxEnter.append("div").call(svgIcon("#iD-icon-apply", "pre-text"));
73348       var noIssuesMessage = boxEnter.append("span");
73349       noIssuesMessage.append("strong").attr("class", "message");
73350       noIssuesMessage.append("br");
73351       noIssuesMessage.append("span").attr("class", "details");
73352       renderIgnoredIssuesReset(selection2);
73353       setNoIssuesText(selection2);
73354     }
73355     function renderIgnoredIssuesReset(selection2) {
73356       var ignoredIssues = context.validator().getIssues({ what: "all", where: "all", includeDisabledRules: true, includeIgnored: "only" });
73357       var resetIgnored = selection2.selectAll(".reset-ignored").data(ignoredIssues.length ? [0] : []);
73358       resetIgnored.exit().remove();
73359       var resetIgnoredEnter = resetIgnored.enter().append("div").attr("class", "reset-ignored section-footer");
73360       resetIgnoredEnter.append("a").attr("href", "#");
73361       resetIgnored = resetIgnored.merge(resetIgnoredEnter);
73362       resetIgnored.select("a").html(_t.html("inspector.title_count", { title: { html: _t.html("issues.reset_ignored") }, count: ignoredIssues.length }));
73363       resetIgnored.on("click", function(d3_event) {
73364         d3_event.preventDefault();
73365         context.validator().resetIgnoredIssues();
73366       });
73367     }
73368     function setNoIssuesText(selection2) {
73369       var opts = getOptions();
73370       function checkForHiddenIssues(cases) {
73371         for (var type2 in cases) {
73372           var hiddenOpts = cases[type2];
73373           var hiddenIssues = context.validator().getIssues(hiddenOpts);
73374           if (hiddenIssues.length) {
73375             selection2.select(".box .details").html("").call(_t.append(
73376               "issues.no_issues.hidden_issues." + type2,
73377               { count: hiddenIssues.length.toString() }
73378             ));
73379             return;
73380           }
73381         }
73382         selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues.none"));
73383       }
73384       var messageType;
73385       if (opts.what === "edited" && opts.where === "visible") {
73386         messageType = "edits_in_view";
73387         checkForHiddenIssues({
73388           elsewhere: { what: "edited", where: "all" },
73389           everything_else: { what: "all", where: "visible" },
73390           disabled_rules: { what: "edited", where: "visible", includeDisabledRules: "only" },
73391           everything_else_elsewhere: { what: "all", where: "all" },
73392           disabled_rules_elsewhere: { what: "edited", where: "all", includeDisabledRules: "only" },
73393           ignored_issues: { what: "edited", where: "visible", includeIgnored: "only" },
73394           ignored_issues_elsewhere: { what: "edited", where: "all", includeIgnored: "only" }
73395         });
73396       } else if (opts.what === "edited" && opts.where === "all") {
73397         messageType = "edits";
73398         checkForHiddenIssues({
73399           everything_else: { what: "all", where: "all" },
73400           disabled_rules: { what: "edited", where: "all", includeDisabledRules: "only" },
73401           ignored_issues: { what: "edited", where: "all", includeIgnored: "only" }
73402         });
73403       } else if (opts.what === "all" && opts.where === "visible") {
73404         messageType = "everything_in_view";
73405         checkForHiddenIssues({
73406           elsewhere: { what: "all", where: "all" },
73407           disabled_rules: { what: "all", where: "visible", includeDisabledRules: "only" },
73408           disabled_rules_elsewhere: { what: "all", where: "all", includeDisabledRules: "only" },
73409           ignored_issues: { what: "all", where: "visible", includeIgnored: "only" },
73410           ignored_issues_elsewhere: { what: "all", where: "all", includeIgnored: "only" }
73411         });
73412       } else if (opts.what === "all" && opts.where === "all") {
73413         messageType = "everything";
73414         checkForHiddenIssues({
73415           disabled_rules: { what: "all", where: "all", includeDisabledRules: "only" },
73416           ignored_issues: { what: "all", where: "all", includeIgnored: "only" }
73417         });
73418       }
73419       if (opts.what === "edited" && context.history().difference().summary().length === 0) {
73420         messageType = "no_edits";
73421       }
73422       selection2.select(".box .message").html("").call(_t.append("issues.no_issues.message." + messageType));
73423     }
73424     context.validator().on("validated.uiSectionValidationStatus", function() {
73425       window.requestIdleCallback(section.reRender);
73426     });
73427     context.map().on(
73428       "move.uiSectionValidationStatus",
73429       debounce_default(function() {
73430         window.requestIdleCallback(section.reRender);
73431       }, 1e3)
73432     );
73433     return section;
73434   }
73435
73436   // modules/ui/panes/issues.js
73437   function uiPaneIssues(context) {
73438     var issuesPane = uiPane("issues", context).key(_t("issues.key")).label(_t.append("issues.title")).description(_t.append("issues.title")).iconName("iD-icon-alert").sections([
73439       uiSectionValidationOptions(context),
73440       uiSectionValidationStatus(context),
73441       uiSectionValidationIssues("issues-errors", "error", context),
73442       uiSectionValidationIssues("issues-warnings", "warning", context),
73443       uiSectionValidationRules(context)
73444     ]);
73445     return issuesPane;
73446   }
73447
73448   // modules/ui/settings/custom_data.js
73449   function uiSettingsCustomData(context) {
73450     var dispatch14 = dispatch_default("change");
73451     function render(selection2) {
73452       var dataLayer = context.layers().layer("data");
73453       var _origSettings = {
73454         fileList: dataLayer && dataLayer.fileList() || null,
73455         url: corePreferences("settings-custom-data-url")
73456       };
73457       var _currSettings = {
73458         fileList: dataLayer && dataLayer.fileList() || null
73459         // url: prefs('settings-custom-data-url')
73460       };
73461       var modal = uiConfirm(selection2).okButton();
73462       modal.classed("settings-modal settings-custom-data", true);
73463       modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_data.header"));
73464       var textSection = modal.select(".modal-section.message-text");
73465       textSection.append("pre").attr("class", "instructions-file").call(_t.append("settings.custom_data.file.instructions"));
73466       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) {
73467         var files = d3_event.target.files;
73468         if (files && files.length) {
73469           _currSettings.url = "";
73470           textSection.select(".field-url").property("value", "");
73471           _currSettings.fileList = files;
73472         } else {
73473           _currSettings.fileList = null;
73474         }
73475       });
73476       textSection.append("h4").call(_t.append("settings.custom_data.or"));
73477       textSection.append("pre").attr("class", "instructions-url").call(_t.append("settings.custom_data.url.instructions"));
73478       textSection.append("textarea").attr("class", "field-url").attr("placeholder", _t("settings.custom_data.url.placeholder")).call(utilNoAuto).property("value", _currSettings.url);
73479       var buttonSection = modal.select(".modal-section.buttons");
73480       buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
73481       buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
73482       buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
73483       function isSaveDisabled() {
73484         return null;
73485       }
73486       function clickCancel() {
73487         textSection.select(".field-url").property("value", _origSettings.url);
73488         corePreferences("settings-custom-data-url", _origSettings.url);
73489         this.blur();
73490         modal.close();
73491       }
73492       function clickSave() {
73493         _currSettings.url = textSection.select(".field-url").property("value").trim();
73494         if (_currSettings.url) {
73495           _currSettings.fileList = null;
73496         }
73497         if (_currSettings.fileList) {
73498           _currSettings.url = "";
73499         }
73500         corePreferences("settings-custom-data-url", _currSettings.url);
73501         this.blur();
73502         modal.close();
73503         dispatch14.call("change", this, _currSettings);
73504       }
73505     }
73506     return utilRebind(render, dispatch14, "on");
73507   }
73508
73509   // modules/ui/sections/data_layers.js
73510   function uiSectionDataLayers(context) {
73511     var settingsCustomData = uiSettingsCustomData(context).on("change", customChanged);
73512     var layers = context.layers();
73513     var section = uiSection("data-layers", context).label(() => _t.append("map_data.data_layers")).disclosureContent(renderDisclosureContent);
73514     function renderDisclosureContent(selection2) {
73515       var container = selection2.selectAll(".data-layer-container").data([0]);
73516       container.enter().append("div").attr("class", "data-layer-container").merge(container).call(drawOsmItems).call(drawQAItems).call(drawCustomDataItems).call(drawVectorItems).call(drawPanelItems);
73517     }
73518     function showsLayer(which) {
73519       var layer = layers.layer(which);
73520       if (layer) {
73521         return layer.enabled();
73522       }
73523       return false;
73524     }
73525     function setLayer(which, enabled) {
73526       var mode = context.mode();
73527       if (mode && /^draw/.test(mode.id))
73528         return;
73529       var layer = layers.layer(which);
73530       if (layer) {
73531         layer.enabled(enabled);
73532         if (!enabled && (which === "osm" || which === "notes")) {
73533           context.enter(modeBrowse(context));
73534         }
73535       }
73536     }
73537     function toggleLayer(which) {
73538       setLayer(which, !showsLayer(which));
73539     }
73540     function drawOsmItems(selection2) {
73541       var osmKeys = ["osm", "notes"];
73542       var osmLayers = layers.all().filter(function(obj) {
73543         return osmKeys.indexOf(obj.id) !== -1;
73544       });
73545       var ul = selection2.selectAll(".layer-list-osm").data([0]);
73546       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-osm").merge(ul);
73547       var li = ul.selectAll(".list-item").data(osmLayers);
73548       li.exit().remove();
73549       var liEnter = li.enter().append("li").attr("class", function(d2) {
73550         return "list-item list-item-" + d2.id;
73551       });
73552       var labelEnter = liEnter.append("label").each(function(d2) {
73553         if (d2.id === "osm") {
73554           select_default2(this).call(
73555             uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).keys([uiCmd("\u2325" + _t("area_fill.wireframe.key"))]).placement("bottom")
73556           );
73557         } else {
73558           select_default2(this).call(
73559             uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
73560           );
73561         }
73562       });
73563       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
73564         toggleLayer(d2.id);
73565       });
73566       labelEnter.append("span").html(function(d2) {
73567         return _t.html("map_data.layers." + d2.id + ".title");
73568       });
73569       li.merge(liEnter).classed("active", function(d2) {
73570         return d2.layer.enabled();
73571       }).selectAll("input").property("checked", function(d2) {
73572         return d2.layer.enabled();
73573       });
73574     }
73575     function drawQAItems(selection2) {
73576       var qaKeys = ["keepRight", "improveOSM", "osmose"];
73577       var qaLayers = layers.all().filter(function(obj) {
73578         return qaKeys.indexOf(obj.id) !== -1;
73579       });
73580       var ul = selection2.selectAll(".layer-list-qa").data([0]);
73581       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-qa").merge(ul);
73582       var li = ul.selectAll(".list-item").data(qaLayers);
73583       li.exit().remove();
73584       var liEnter = li.enter().append("li").attr("class", function(d2) {
73585         return "list-item list-item-" + d2.id;
73586       });
73587       var labelEnter = liEnter.append("label").each(function(d2) {
73588         select_default2(this).call(
73589           uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
73590         );
73591       });
73592       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
73593         toggleLayer(d2.id);
73594       });
73595       labelEnter.append("span").each(function(d2) {
73596         _t.append("map_data.layers." + d2.id + ".title")(select_default2(this));
73597       });
73598       li.merge(liEnter).classed("active", function(d2) {
73599         return d2.layer.enabled();
73600       }).selectAll("input").property("checked", function(d2) {
73601         return d2.layer.enabled();
73602       });
73603     }
73604     function drawVectorItems(selection2) {
73605       var dataLayer = layers.layer("data");
73606       var vtData = [
73607         {
73608           name: "Detroit Neighborhoods/Parks",
73609           src: "neighborhoods-parks",
73610           tooltip: "Neighborhood boundaries and parks as compiled by City of Detroit in concert with community groups.",
73611           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"
73612         },
73613         {
73614           name: "Detroit Composite POIs",
73615           src: "composite-poi",
73616           tooltip: "Fire Inspections, Business Licenses, and other public location data collated from the City of Detroit.",
73617           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"
73618         },
73619         {
73620           name: "Detroit All-The-Places POIs",
73621           src: "alltheplaces-poi",
73622           tooltip: "Public domain business location data created by web scrapers.",
73623           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"
73624         }
73625       ];
73626       var detroit = geoExtent([-83.5, 42.1], [-82.8, 42.5]);
73627       var showVectorItems = context.map().zoom() > 9 && detroit.contains(context.map().center());
73628       var container = selection2.selectAll(".vectortile-container").data(showVectorItems ? [0] : []);
73629       container.exit().remove();
73630       var containerEnter = container.enter().append("div").attr("class", "vectortile-container");
73631       containerEnter.append("h4").attr("class", "vectortile-header").text("Detroit Vector Tiles (Beta)");
73632       containerEnter.append("ul").attr("class", "layer-list layer-list-vectortile");
73633       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");
73634       container = container.merge(containerEnter);
73635       var ul = container.selectAll(".layer-list-vectortile");
73636       var li = ul.selectAll(".list-item").data(vtData);
73637       li.exit().remove();
73638       var liEnter = li.enter().append("li").attr("class", function(d2) {
73639         return "list-item list-item-" + d2.src;
73640       });
73641       var labelEnter = liEnter.append("label").each(function(d2) {
73642         select_default2(this).call(
73643           uiTooltip().title(d2.tooltip).placement("top")
73644         );
73645       });
73646       labelEnter.append("input").attr("type", "radio").attr("name", "vectortile").on("change", selectVTLayer);
73647       labelEnter.append("span").text(function(d2) {
73648         return d2.name;
73649       });
73650       li.merge(liEnter).classed("active", isVTLayerSelected).selectAll("input").property("checked", isVTLayerSelected);
73651       function isVTLayerSelected(d2) {
73652         return dataLayer && dataLayer.template() === d2.template;
73653       }
73654       function selectVTLayer(d3_event, d2) {
73655         corePreferences("settings-custom-data-url", d2.template);
73656         if (dataLayer) {
73657           dataLayer.template(d2.template, d2.src);
73658           dataLayer.enabled(true);
73659         }
73660       }
73661     }
73662     function drawCustomDataItems(selection2) {
73663       var dataLayer = layers.layer("data");
73664       var hasData = dataLayer && dataLayer.hasData();
73665       var showsData = hasData && dataLayer.enabled();
73666       var ul = selection2.selectAll(".layer-list-data").data(dataLayer ? [0] : []);
73667       ul.exit().remove();
73668       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-data");
73669       var liEnter = ulEnter.append("li").attr("class", "list-item-data");
73670       var labelEnter = liEnter.append("label").call(
73671         uiTooltip().title(() => _t.append("map_data.layers.custom.tooltip")).placement("top")
73672       );
73673       labelEnter.append("input").attr("type", "checkbox").on("change", function() {
73674         toggleLayer("data");
73675       });
73676       labelEnter.append("span").call(_t.append("map_data.layers.custom.title"));
73677       liEnter.append("button").attr("class", "open-data-options").call(
73678         uiTooltip().title(() => _t.append("settings.custom_data.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
73679       ).on("click", function(d3_event) {
73680         d3_event.preventDefault();
73681         editCustom();
73682       }).call(svgIcon("#iD-icon-more"));
73683       liEnter.append("button").attr("class", "zoom-to-data").call(
73684         uiTooltip().title(() => _t.append("map_data.layers.custom.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
73685       ).on("click", function(d3_event) {
73686         if (select_default2(this).classed("disabled"))
73687           return;
73688         d3_event.preventDefault();
73689         d3_event.stopPropagation();
73690         dataLayer.fitZoom();
73691       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
73692       ul = ul.merge(ulEnter);
73693       ul.selectAll(".list-item-data").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
73694       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
73695     }
73696     function editCustom() {
73697       context.container().call(settingsCustomData);
73698     }
73699     function customChanged(d2) {
73700       var dataLayer = layers.layer("data");
73701       if (d2 && d2.url) {
73702         dataLayer.url(d2.url);
73703       } else if (d2 && d2.fileList) {
73704         dataLayer.fileList(d2.fileList);
73705       }
73706     }
73707     function drawPanelItems(selection2) {
73708       var panelsListEnter = selection2.selectAll(".md-extras-list").data([0]).enter().append("ul").attr("class", "layer-list md-extras-list");
73709       var historyPanelLabelEnter = panelsListEnter.append("li").attr("class", "history-panel-toggle-item").append("label").call(
73710         uiTooltip().title(() => _t.append("map_data.history_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.history.key"))]).placement("top")
73711       );
73712       historyPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
73713         d3_event.preventDefault();
73714         context.ui().info.toggle("history");
73715       });
73716       historyPanelLabelEnter.append("span").call(_t.append("map_data.history_panel.title"));
73717       var measurementPanelLabelEnter = panelsListEnter.append("li").attr("class", "measurement-panel-toggle-item").append("label").call(
73718         uiTooltip().title(() => _t.append("map_data.measurement_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.measurement.key"))]).placement("top")
73719       );
73720       measurementPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
73721         d3_event.preventDefault();
73722         context.ui().info.toggle("measurement");
73723       });
73724       measurementPanelLabelEnter.append("span").call(_t.append("map_data.measurement_panel.title"));
73725     }
73726     context.layers().on("change.uiSectionDataLayers", section.reRender);
73727     context.map().on(
73728       "move.uiSectionDataLayers",
73729       debounce_default(function() {
73730         window.requestIdleCallback(section.reRender);
73731       }, 1e3)
73732     );
73733     return section;
73734   }
73735
73736   // modules/ui/sections/map_features.js
73737   function uiSectionMapFeatures(context) {
73738     var _features = context.features().keys();
73739     var section = uiSection("map-features", context).label(() => _t.append("map_data.map_features")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
73740     function renderDisclosureContent(selection2) {
73741       var container = selection2.selectAll(".layer-feature-list-container").data([0]);
73742       var containerEnter = container.enter().append("div").attr("class", "layer-feature-list-container");
73743       containerEnter.append("ul").attr("class", "layer-list layer-feature-list");
73744       var footer = containerEnter.append("div").attr("class", "feature-list-links section-footer");
73745       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
73746         d3_event.preventDefault();
73747         context.features().disableAll();
73748       });
73749       footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
73750         d3_event.preventDefault();
73751         context.features().enableAll();
73752       });
73753       container = container.merge(containerEnter);
73754       container.selectAll(".layer-feature-list").call(drawListItems, _features, "checkbox", "feature", clickFeature, showsFeature);
73755     }
73756     function drawListItems(selection2, data, type2, name, change, active) {
73757       var items = selection2.selectAll("li").data(data);
73758       items.exit().remove();
73759       var enter = items.enter().append("li").call(
73760         uiTooltip().title(function(d2) {
73761           var tip = _t.append(name + "." + d2 + ".tooltip");
73762           if (autoHiddenFeature(d2)) {
73763             var msg = showsLayer("osm") ? _t.append("map_data.autohidden") : _t.append("map_data.osmhidden");
73764             return (selection3) => {
73765               selection3.call(tip);
73766               selection3.append("div").call(msg);
73767             };
73768           }
73769           return tip;
73770         }).placement("top")
73771       );
73772       var label = enter.append("label");
73773       label.append("input").attr("type", type2).attr("name", name).on("change", change);
73774       label.append("span").html(function(d2) {
73775         return _t.html(name + "." + d2 + ".description");
73776       });
73777       items = items.merge(enter);
73778       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", autoHiddenFeature);
73779     }
73780     function autoHiddenFeature(d2) {
73781       return context.features().autoHidden(d2);
73782     }
73783     function showsFeature(d2) {
73784       return context.features().enabled(d2);
73785     }
73786     function clickFeature(d3_event, d2) {
73787       context.features().toggle(d2);
73788     }
73789     function showsLayer(id2) {
73790       var layer = context.layers().layer(id2);
73791       return layer && layer.enabled();
73792     }
73793     context.features().on("change.map_features", section.reRender);
73794     return section;
73795   }
73796
73797   // modules/ui/sections/map_style_options.js
73798   function uiSectionMapStyleOptions(context) {
73799     var section = uiSection("fill-area", context).label(() => _t.append("map_data.style_options")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
73800     function renderDisclosureContent(selection2) {
73801       var container = selection2.selectAll(".layer-fill-list").data([0]);
73802       container.enter().append("ul").attr("class", "layer-list layer-fill-list").merge(container).call(drawListItems, context.map().areaFillOptions, "radio", "area_fill", setFill, isActiveFill);
73803       var container2 = selection2.selectAll(".layer-visual-diff-list").data([0]);
73804       container2.enter().append("ul").attr("class", "layer-list layer-visual-diff-list").merge(container2).call(drawListItems, ["highlight_edits"], "checkbox", "visual_diff", toggleHighlightEdited, function() {
73805         return context.surface().classed("highlight-edited");
73806       });
73807     }
73808     function drawListItems(selection2, data, type2, name, change, active) {
73809       var items = selection2.selectAll("li").data(data);
73810       items.exit().remove();
73811       var enter = items.enter().append("li").call(
73812         uiTooltip().title(function(d2) {
73813           return _t.append(name + "." + d2 + ".tooltip");
73814         }).keys(function(d2) {
73815           var key = d2 === "wireframe" ? _t("area_fill.wireframe.key") : null;
73816           if (d2 === "highlight_edits")
73817             key = _t("map_data.highlight_edits.key");
73818           return key ? [key] : null;
73819         }).placement("top")
73820       );
73821       var label = enter.append("label");
73822       label.append("input").attr("type", type2).attr("name", name).on("change", change);
73823       label.append("span").html(function(d2) {
73824         return _t.html(name + "." + d2 + ".description");
73825       });
73826       items = items.merge(enter);
73827       items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
73828     }
73829     function isActiveFill(d2) {
73830       return context.map().activeAreaFill() === d2;
73831     }
73832     function toggleHighlightEdited(d3_event) {
73833       d3_event.preventDefault();
73834       context.map().toggleHighlightEdited();
73835     }
73836     function setFill(d3_event, d2) {
73837       context.map().activeAreaFill(d2);
73838     }
73839     context.map().on("changeHighlighting.ui_style, changeAreaFill.ui_style", section.reRender);
73840     return section;
73841   }
73842
73843   // modules/ui/settings/local_photos.js
73844   function uiSettingsLocalPhotos(context) {
73845     var dispatch14 = dispatch_default("change");
73846     var photoLayer = context.layers().layer("local-photos");
73847     var modal;
73848     function render(selection2) {
73849       modal = uiConfirm(selection2).okButton();
73850       modal.classed("settings-modal settings-local-photos", true);
73851       modal.select(".modal-section.header").append("h3").call(_t.append("local_photos.header"));
73852       modal.select(".modal-section.message-text").append("div").classed("local-photos", true);
73853       var instructionsSection = modal.select(".modal-section.message-text .local-photos").append("div").classed("instructions", true);
73854       instructionsSection.append("p").classed("instructions-local-photos", true).call(_t.append("local_photos.file.instructions"));
73855       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) {
73856         var files = d3_event.target.files;
73857         if (files && files.length) {
73858           photoList.select("ul").append("li").classed("placeholder", true).append("div");
73859           dispatch14.call("change", this, files);
73860         }
73861         d3_event.target.value = null;
73862       });
73863       instructionsSection.append("label").attr("for", "local-photo-files").classed("button", true).call(_t.append("local_photos.file.label"));
73864       const photoList = modal.select(".modal-section.message-text .local-photos").append("div").append("div").classed("list-local-photos", true);
73865       photoList.append("ul");
73866       updatePhotoList(photoList.select("ul"));
73867       context.layers().on("change", () => updatePhotoList(photoList.select("ul")));
73868     }
73869     function updatePhotoList(container) {
73870       var _a;
73871       function locationUnavailable(d2) {
73872         return !(isArray_default(d2.loc) && isNumber_default(d2.loc[0]) && isNumber_default(d2.loc[1]));
73873       }
73874       container.selectAll("li.placeholder").remove();
73875       let selection2 = container.selectAll("li").data((_a = photoLayer.getPhotos()) != null ? _a : [], (d2) => d2.id);
73876       selection2.exit().remove();
73877       const selectionEnter = selection2.enter().append("li");
73878       selectionEnter.append("span").classed("filename", true);
73879       selectionEnter.append("button").classed("form-field-button zoom-to-data", true).attr("title", _t("local_photos.zoom_single")).call(svgIcon("#iD-icon-framed-dot"));
73880       selectionEnter.append("button").classed("form-field-button no-geolocation", true).call(svgIcon("#iD-icon-alert")).call(
73881         uiTooltip().title(() => _t.append("local_photos.no_geolocation.tooltip")).placement("left")
73882       );
73883       selectionEnter.append("button").classed("form-field-button remove", true).attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
73884       selection2 = selection2.merge(selectionEnter);
73885       selection2.classed("invalid", locationUnavailable);
73886       selection2.select("span.filename").text((d2) => d2.name).attr("title", (d2) => d2.name);
73887       selection2.select("span.filename").on("click", (d3_event, d2) => {
73888         photoLayer.openPhoto(d3_event, d2, false);
73889       });
73890       selection2.select("button.zoom-to-data").on("click", (d3_event, d2) => {
73891         photoLayer.openPhoto(d3_event, d2, true);
73892       });
73893       selection2.select("button.remove").on("click", (d3_event, d2) => {
73894         photoLayer.removePhoto(d2.id);
73895         updatePhotoList(container);
73896       });
73897     }
73898     return utilRebind(render, dispatch14, "on");
73899   }
73900
73901   // modules/ui/sections/photo_overlays.js
73902   function uiSectionPhotoOverlays(context) {
73903     var settingsLocalPhotos = uiSettingsLocalPhotos(context).on("change", localPhotosChanged);
73904     var layers = context.layers();
73905     var section = uiSection("photo-overlays", context).label(() => _t.append("photo_overlays.title")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
73906     function renderDisclosureContent(selection2) {
73907       var container = selection2.selectAll(".photo-overlay-container").data([0]);
73908       container.enter().append("div").attr("class", "photo-overlay-container").merge(container).call(drawPhotoItems).call(drawPhotoTypeItems).call(drawDateFilter).call(drawUsernameFilter).call(drawLocalPhotos);
73909     }
73910     function drawPhotoItems(selection2) {
73911       var photoKeys = context.photos().overlayLayerIDs();
73912       var photoLayers = layers.all().filter(function(obj) {
73913         return photoKeys.indexOf(obj.id) !== -1;
73914       });
73915       var data = photoLayers.filter(function(obj) {
73916         if (!obj.layer.supported())
73917           return false;
73918         if (layerEnabled(obj))
73919           return true;
73920         if (typeof obj.layer.validHere === "function") {
73921           return obj.layer.validHere(context.map().extent(), context.map().zoom());
73922         }
73923         return true;
73924       });
73925       function layerSupported(d2) {
73926         return d2.layer && d2.layer.supported();
73927       }
73928       function layerEnabled(d2) {
73929         return layerSupported(d2) && d2.layer.enabled();
73930       }
73931       function layerRendered(d2) {
73932         var _a, _b, _c;
73933         return (_c = (_b = (_a = d2.layer).rendered) == null ? void 0 : _b.call(_a, context.map().zoom())) != null ? _c : true;
73934       }
73935       var ul = selection2.selectAll(".layer-list-photos").data([0]);
73936       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photos").merge(ul);
73937       var li = ul.selectAll(".list-item-photos").data(data);
73938       li.exit().remove();
73939       var liEnter = li.enter().append("li").attr("class", function(d2) {
73940         var classes = "list-item-photos list-item-" + d2.id;
73941         if (d2.id === "mapillary-signs" || d2.id === "mapillary-map-features") {
73942           classes += " indented";
73943         }
73944         return classes;
73945       });
73946       var labelEnter = liEnter.append("label").each(function(d2) {
73947         var titleID;
73948         if (d2.id === "mapillary-signs")
73949           titleID = "mapillary.signs.tooltip";
73950         else if (d2.id === "mapillary")
73951           titleID = "mapillary_images.tooltip";
73952         else if (d2.id === "kartaview")
73953           titleID = "kartaview_images.tooltip";
73954         else
73955           titleID = d2.id.replace(/-/g, "_") + ".tooltip";
73956         select_default2(this).call(
73957           uiTooltip().title(() => {
73958             if (!layerRendered(d2)) {
73959               return _t.append("street_side.minzoom_tooltip");
73960             } else {
73961               return _t.append(titleID);
73962             }
73963           }).placement("top")
73964         );
73965       });
73966       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
73967         toggleLayer(d2.id);
73968       });
73969       labelEnter.append("span").html(function(d2) {
73970         var id2 = d2.id;
73971         if (id2 === "mapillary-signs")
73972           id2 = "photo_overlays.traffic_signs";
73973         return _t.html(id2.replace(/-/g, "_") + ".title");
73974       });
73975       li.merge(liEnter).classed("active", layerEnabled).selectAll("input").property("disabled", (d2) => !layerRendered(d2)).property("checked", layerEnabled);
73976     }
73977     function drawPhotoTypeItems(selection2) {
73978       var data = context.photos().allPhotoTypes();
73979       function typeEnabled(d2) {
73980         return context.photos().showsPhotoType(d2);
73981       }
73982       var ul = selection2.selectAll(".layer-list-photo-types").data([0]);
73983       ul.exit().remove();
73984       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photo-types").merge(ul);
73985       var li = ul.selectAll(".list-item-photo-types").data(context.photos().shouldFilterByPhotoType() ? data : []);
73986       li.exit().remove();
73987       var liEnter = li.enter().append("li").attr("class", function(d2) {
73988         return "list-item-photo-types list-item-" + d2;
73989       });
73990       var labelEnter = liEnter.append("label").each(function(d2) {
73991         select_default2(this).call(
73992           uiTooltip().title(() => _t.append("photo_overlays.photo_type." + d2 + ".tooltip")).placement("top")
73993         );
73994       });
73995       labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
73996         context.photos().togglePhotoType(d2);
73997       });
73998       labelEnter.append("span").html(function(d2) {
73999         return _t.html("photo_overlays.photo_type." + d2 + ".title");
74000       });
74001       li.merge(liEnter).classed("active", typeEnabled).selectAll("input").property("checked", typeEnabled);
74002     }
74003     function drawDateFilter(selection2) {
74004       var data = context.photos().dateFilters();
74005       function filterEnabled(d2) {
74006         return context.photos().dateFilterValue(d2);
74007       }
74008       var ul = selection2.selectAll(".layer-list-date-filter").data([0]);
74009       ul.exit().remove();
74010       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-date-filter").merge(ul);
74011       var li = ul.selectAll(".list-item-date-filter").data(context.photos().shouldFilterByDate() ? data : []);
74012       li.exit().remove();
74013       var liEnter = li.enter().append("li").attr("class", "list-item-date-filter");
74014       var labelEnter = liEnter.append("label").each(function(d2) {
74015         select_default2(this).call(
74016           uiTooltip().title(() => _t.append("photo_overlays.date_filter." + d2 + ".tooltip")).placement("top")
74017         );
74018       });
74019       labelEnter.append("span").each(function(d2) {
74020         _t.append("photo_overlays.date_filter." + d2 + ".title")(select_default2(this));
74021       });
74022       labelEnter.append("input").attr("type", "date").attr("class", "list-item-input").attr("placeholder", _t("units.year_month_day")).call(utilNoAuto).each(function(d2) {
74023         utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d2) || "");
74024       }).on("change", function(d3_event, d2) {
74025         var value = utilGetSetValue(select_default2(this)).trim();
74026         context.photos().setDateFilter(d2, value, true);
74027         li.selectAll("input").each(function(d4) {
74028           utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d4) || "");
74029         });
74030       });
74031       li = li.merge(liEnter).classed("active", filterEnabled);
74032     }
74033     function drawUsernameFilter(selection2) {
74034       function filterEnabled() {
74035         return context.photos().usernames();
74036       }
74037       var ul = selection2.selectAll(".layer-list-username-filter").data([0]);
74038       ul.exit().remove();
74039       ul = ul.enter().append("ul").attr("class", "layer-list layer-list-username-filter").merge(ul);
74040       var li = ul.selectAll(".list-item-username-filter").data(context.photos().shouldFilterByUsername() ? ["username-filter"] : []);
74041       li.exit().remove();
74042       var liEnter = li.enter().append("li").attr("class", "list-item-username-filter");
74043       var labelEnter = liEnter.append("label").each(function() {
74044         select_default2(this).call(
74045           uiTooltip().title(() => _t.append("photo_overlays.username_filter.tooltip")).placement("top")
74046         );
74047       });
74048       labelEnter.append("span").call(_t.append("photo_overlays.username_filter.title"));
74049       labelEnter.append("input").attr("type", "text").attr("class", "list-item-input").call(utilNoAuto).property("value", usernameValue).on("change", function() {
74050         var value = select_default2(this).property("value");
74051         context.photos().setUsernameFilter(value, true);
74052         select_default2(this).property("value", usernameValue);
74053       });
74054       li.merge(liEnter).classed("active", filterEnabled);
74055       function usernameValue() {
74056         var usernames = context.photos().usernames();
74057         if (usernames)
74058           return usernames.join("; ");
74059         return usernames;
74060       }
74061     }
74062     function toggleLayer(which) {
74063       setLayer(which, !showsLayer(which));
74064     }
74065     function showsLayer(which) {
74066       var layer = layers.layer(which);
74067       if (layer) {
74068         return layer.enabled();
74069       }
74070       return false;
74071     }
74072     function setLayer(which, enabled) {
74073       var layer = layers.layer(which);
74074       if (layer) {
74075         layer.enabled(enabled);
74076       }
74077     }
74078     function drawLocalPhotos(selection2) {
74079       var photoLayer = layers.layer("local-photos");
74080       var hasData = photoLayer && photoLayer.hasData();
74081       var showsData = hasData && photoLayer.enabled();
74082       var ul = selection2.selectAll(".layer-list-local-photos").data(photoLayer ? [0] : []);
74083       ul.exit().remove();
74084       var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-local-photos");
74085       var localPhotosEnter = ulEnter.append("li").attr("class", "list-item-local-photos");
74086       var localPhotosLabelEnter = localPhotosEnter.append("label").call(uiTooltip().title(() => _t.append("local_photos.tooltip")));
74087       localPhotosLabelEnter.append("input").attr("type", "checkbox").on("change", function() {
74088         toggleLayer("local-photos");
74089       });
74090       localPhotosLabelEnter.call(_t.append("local_photos.header"));
74091       localPhotosEnter.append("button").attr("class", "open-data-options").call(
74092         uiTooltip().title(() => _t.append("local_photos.tooltip_edit")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
74093       ).on("click", function(d3_event) {
74094         d3_event.preventDefault();
74095         editLocalPhotos();
74096       }).call(svgIcon("#iD-icon-more"));
74097       localPhotosEnter.append("button").attr("class", "zoom-to-data").call(
74098         uiTooltip().title(() => _t.append("local_photos.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
74099       ).on("click", function(d3_event) {
74100         if (select_default2(this).classed("disabled"))
74101           return;
74102         d3_event.preventDefault();
74103         d3_event.stopPropagation();
74104         photoLayer.fitZoom();
74105       }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
74106       ul = ul.merge(ulEnter);
74107       ul.selectAll(".list-item-local-photos").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
74108       ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
74109     }
74110     function editLocalPhotos() {
74111       context.container().call(settingsLocalPhotos);
74112     }
74113     function localPhotosChanged(d2) {
74114       var localPhotosLayer = layers.layer("local-photos");
74115       localPhotosLayer.fileList(d2);
74116     }
74117     context.layers().on("change.uiSectionPhotoOverlays", section.reRender);
74118     context.photos().on("change.uiSectionPhotoOverlays", section.reRender);
74119     context.map().on(
74120       "move.photo_overlays",
74121       debounce_default(function() {
74122         window.requestIdleCallback(section.reRender);
74123       }, 1e3)
74124     );
74125     return section;
74126   }
74127
74128   // modules/ui/panes/map_data.js
74129   function uiPaneMapData(context) {
74130     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([
74131       uiSectionDataLayers(context),
74132       uiSectionPhotoOverlays(context),
74133       uiSectionMapStyleOptions(context),
74134       uiSectionMapFeatures(context)
74135     ]);
74136     return mapDataPane;
74137   }
74138
74139   // modules/ui/panes/preferences.js
74140   function uiPanePreferences(context) {
74141     let preferencesPane = uiPane("preferences", context).key(_t("preferences.key")).label(_t.append("preferences.title")).description(_t.append("preferences.description")).iconName("fas-user-cog").sections([
74142       uiSectionPrivacy(context)
74143     ]);
74144     return preferencesPane;
74145   }
74146
74147   // modules/ui/init.js
74148   function uiInit(context) {
74149     var _initCounter = 0;
74150     var _needWidth = {};
74151     var _lastPointerType;
74152     function render(container) {
74153       container.on("click.ui", function(d3_event) {
74154         if (d3_event.button !== 0)
74155           return;
74156         if (!d3_event.composedPath)
74157           return;
74158         var isOkayTarget = d3_event.composedPath().some(function(node) {
74159           return node.nodeType === 1 && // clicking <input> focuses it and/or changes a value
74160           (node.nodeName === "INPUT" || // clicking <label> affects its <input> by default
74161           node.nodeName === "LABEL" || // clicking <a> opens a hyperlink by default
74162           node.nodeName === "A");
74163         });
74164         if (isOkayTarget)
74165           return;
74166         d3_event.preventDefault();
74167       });
74168       var detected = utilDetect();
74169       if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
74170       // but we only need to do this on desktop Safari anyway. – #7694
74171       !detected.isMobileWebKit) {
74172         container.on("gesturestart.ui gesturechange.ui gestureend.ui", function(d3_event) {
74173           d3_event.preventDefault();
74174         });
74175       }
74176       if ("PointerEvent" in window) {
74177         select_default2(window).on("pointerdown.ui pointerup.ui", function(d3_event) {
74178           var pointerType = d3_event.pointerType || "mouse";
74179           if (_lastPointerType !== pointerType) {
74180             _lastPointerType = pointerType;
74181             container.attr("pointer", pointerType);
74182           }
74183         }, true);
74184       } else {
74185         _lastPointerType = "mouse";
74186         container.attr("pointer", "mouse");
74187       }
74188       container.attr("lang", _mainLocalizer.localeCode()).attr("dir", _mainLocalizer.textDirection());
74189       container.call(uiFullScreen(context));
74190       var map2 = context.map();
74191       map2.redrawEnable(false);
74192       map2.on("hitMinZoom.ui", function() {
74193         ui.flash.iconName("#iD-icon-no").label(_t.append("cannot_zoom"))();
74194       });
74195       container.append("svg").attr("id", "ideditor-defs").call(ui.svgDefs);
74196       container.append("div").attr("class", "sidebar").call(ui.sidebar);
74197       var content = container.append("div").attr("class", "main-content active");
74198       content.append("div").attr("class", "top-toolbar-wrap").append("div").attr("class", "top-toolbar fillD").call(uiTopToolbar(context));
74199       content.append("div").attr("class", "main-map").attr("dir", "ltr").call(map2);
74200       var overMap = content.append("div").attr("class", "over-map");
74201       overMap.append("div").attr("class", "select-trap").text("t");
74202       overMap.call(uiMapInMap(context)).call(uiNotice(context));
74203       overMap.append("div").attr("class", "spinner").call(uiSpinner(context));
74204       var controlsWrap = overMap.append("div").attr("class", "map-controls-wrap");
74205       var controls = controlsWrap.append("div").attr("class", "map-controls");
74206       controls.append("div").attr("class", "map-control zoombuttons").call(uiZoom(context));
74207       controls.append("div").attr("class", "map-control zoom-to-selection-control").call(uiZoomToSelection(context));
74208       controls.append("div").attr("class", "map-control geolocate-control").call(uiGeolocate(context));
74209       controlsWrap.on("wheel.mapControls", function(d3_event) {
74210         if (!d3_event.deltaX) {
74211           controlsWrap.node().scrollTop += d3_event.deltaY;
74212         }
74213       });
74214       var panes = overMap.append("div").attr("class", "map-panes");
74215       var uiPanes = [
74216         uiPaneBackground(context),
74217         uiPaneMapData(context),
74218         uiPaneIssues(context),
74219         uiPanePreferences(context),
74220         uiPaneHelp(context)
74221       ];
74222       uiPanes.forEach(function(pane) {
74223         controls.append("div").attr("class", "map-control map-pane-control " + pane.id + "-control").call(pane.renderToggleButton);
74224         panes.call(pane.renderPane);
74225       });
74226       ui.info = uiInfo(context);
74227       overMap.call(ui.info);
74228       overMap.append("div").attr("class", "photoviewer").classed("al", true).classed("hide", true).call(ui.photoviewer);
74229       overMap.append("div").attr("class", "attribution-wrap").attr("dir", "ltr").call(uiAttribution(context));
74230       var about = content.append("div").attr("class", "map-footer");
74231       about.append("div").attr("class", "api-status").call(uiStatus(context));
74232       var footer = about.append("div").attr("class", "map-footer-bar fillD");
74233       footer.append("div").attr("class", "flash-wrap footer-hide");
74234       var footerWrap = footer.append("div").attr("class", "main-footer-wrap footer-show");
74235       footerWrap.append("div").attr("class", "scale-block").call(uiScale(context));
74236       var aboutList = footerWrap.append("div").attr("class", "info-block").append("ul").attr("class", "map-footer-list");
74237       aboutList.append("li").attr("class", "user-list").call(uiContributors(context));
74238       var apiConnections = context.connection().apiConnections();
74239       if (apiConnections && apiConnections.length > 1) {
74240         aboutList.append("li").attr("class", "source-switch").call(
74241           uiSourceSwitch(context).keys(apiConnections)
74242         );
74243       }
74244       aboutList.append("li").attr("class", "issues-info").call(uiIssuesInfo(context));
74245       aboutList.append("li").attr("class", "feature-warning").call(uiFeatureInfo(context));
74246       var issueLinks = aboutList.append("li");
74247       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"));
74248       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"));
74249       aboutList.append("li").attr("class", "version").call(uiVersion(context));
74250       if (!context.embed()) {
74251         aboutList.call(uiAccount(context));
74252       }
74253       ui.onResize();
74254       map2.redrawEnable(true);
74255       ui.hash = behaviorHash(context);
74256       ui.hash();
74257       if (!ui.hash.hadLocation) {
74258         map2.centerZoom([0, 0], 2);
74259       }
74260       window.onbeforeunload = function() {
74261         return context.save();
74262       };
74263       window.onunload = function() {
74264         context.history().unlock();
74265       };
74266       select_default2(window).on("resize.editor", function() {
74267         ui.onResize();
74268       });
74269       var panPixels = 80;
74270       context.keybinding().on("\u232B", function(d3_event) {
74271         d3_event.preventDefault();
74272       }).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) {
74273         if (d3_event) {
74274           d3_event.stopImmediatePropagation();
74275           d3_event.preventDefault();
74276         }
74277         var previousBackground = context.background().findSource(corePreferences("background-last-used-toggle"));
74278         if (previousBackground) {
74279           var currentBackground = context.background().baseLayerSource();
74280           corePreferences("background-last-used-toggle", currentBackground.id);
74281           corePreferences("background-last-used", previousBackground.id);
74282           context.background().baseLayerSource(previousBackground);
74283         }
74284       }).on(_t("area_fill.wireframe.key"), function toggleWireframe(d3_event) {
74285         d3_event.preventDefault();
74286         d3_event.stopPropagation();
74287         context.map().toggleWireframe();
74288       }).on(uiCmd("\u2325" + _t("area_fill.wireframe.key")), function toggleOsmData(d3_event) {
74289         d3_event.preventDefault();
74290         d3_event.stopPropagation();
74291         var mode = context.mode();
74292         if (mode && /^draw/.test(mode.id))
74293           return;
74294         var layer = context.layers().layer("osm");
74295         if (layer) {
74296           layer.enabled(!layer.enabled());
74297           if (!layer.enabled()) {
74298             context.enter(modeBrowse(context));
74299           }
74300         }
74301       }).on(_t("map_data.highlight_edits.key"), function toggleHighlightEdited(d3_event) {
74302         d3_event.preventDefault();
74303         context.map().toggleHighlightEdited();
74304       });
74305       context.on("enter.editor", function(entered) {
74306         container.classed("mode-" + entered.id, true);
74307       }).on("exit.editor", function(exited) {
74308         container.classed("mode-" + exited.id, false);
74309       });
74310       context.enter(modeBrowse(context));
74311       if (!_initCounter++) {
74312         if (!ui.hash.startWalkthrough) {
74313           context.container().call(uiSplash(context)).call(uiRestore(context));
74314         }
74315         context.container().call(ui.shortcuts);
74316       }
74317       var osm = context.connection();
74318       var auth = uiLoading(context).message(_t.html("loading_auth")).blocking(true);
74319       if (osm && auth) {
74320         osm.on("authLoading.ui", function() {
74321           context.container().call(auth);
74322         }).on("authDone.ui", function() {
74323           auth.close();
74324         });
74325       }
74326       _initCounter++;
74327       if (ui.hash.startWalkthrough) {
74328         ui.hash.startWalkthrough = false;
74329         context.container().call(uiIntro(context));
74330       }
74331       function pan(d2) {
74332         return function(d3_event) {
74333           if (d3_event.shiftKey)
74334             return;
74335           if (context.container().select(".combobox").size())
74336             return;
74337           d3_event.preventDefault();
74338           context.map().pan(d2, 100);
74339         };
74340       }
74341     }
74342     let ui = {};
74343     let _loadPromise;
74344     ui.ensureLoaded = () => {
74345       if (_loadPromise)
74346         return _loadPromise;
74347       return _loadPromise = Promise.all([
74348         // must have strings and presets before loading the UI
74349         _mainLocalizer.ensureLoaded(),
74350         _mainPresetIndex.ensureLoaded()
74351       ]).then(() => {
74352         if (!context.container().empty())
74353           render(context.container());
74354       }).catch((err) => console.error(err));
74355     };
74356     ui.restart = function() {
74357       context.keybinding().clear();
74358       _loadPromise = null;
74359       context.container().selectAll("*").remove();
74360       ui.ensureLoaded();
74361     };
74362     ui.lastPointerType = function() {
74363       return _lastPointerType;
74364     };
74365     ui.svgDefs = svgDefs(context);
74366     ui.flash = uiFlash(context);
74367     ui.sidebar = uiSidebar(context);
74368     ui.photoviewer = uiPhotoviewer(context);
74369     ui.shortcuts = uiShortcuts(context);
74370     ui.onResize = function(withPan) {
74371       var map2 = context.map();
74372       var mapDimensions = utilGetDimensions(context.container().select(".main-content"), true);
74373       utilGetDimensions(context.container().select(".sidebar"), true);
74374       if (withPan !== void 0) {
74375         map2.redrawEnable(false);
74376         map2.pan(withPan);
74377         map2.redrawEnable(true);
74378       }
74379       map2.dimensions(mapDimensions);
74380       ui.photoviewer.onMapResize();
74381       ui.checkOverflow(".top-toolbar");
74382       ui.checkOverflow(".map-footer-bar");
74383       var resizeWindowEvent = document.createEvent("Event");
74384       resizeWindowEvent.initEvent("resizeWindow", true, true);
74385       document.dispatchEvent(resizeWindowEvent);
74386     };
74387     ui.checkOverflow = function(selector, reset) {
74388       if (reset) {
74389         delete _needWidth[selector];
74390       }
74391       var selection2 = context.container().select(selector);
74392       if (selection2.empty())
74393         return;
74394       var scrollWidth = selection2.property("scrollWidth");
74395       var clientWidth = selection2.property("clientWidth");
74396       var needed = _needWidth[selector] || scrollWidth;
74397       if (scrollWidth > clientWidth) {
74398         selection2.classed("narrow", true);
74399         if (!_needWidth[selector]) {
74400           _needWidth[selector] = scrollWidth;
74401         }
74402       } else if (scrollWidth >= needed) {
74403         selection2.classed("narrow", false);
74404       }
74405     };
74406     ui.togglePanes = function(showPane) {
74407       var hidePanes = context.container().selectAll(".map-pane.shown");
74408       var side = _mainLocalizer.textDirection() === "ltr" ? "right" : "left";
74409       hidePanes.classed("shown", false).classed("hide", true);
74410       context.container().selectAll(".map-pane-control button").classed("active", false);
74411       if (showPane) {
74412         hidePanes.classed("shown", false).classed("hide", true).style(side, "-500px");
74413         context.container().selectAll("." + showPane.attr("pane") + "-control button").classed("active", true);
74414         showPane.classed("shown", true).classed("hide", false);
74415         if (hidePanes.empty()) {
74416           showPane.style(side, "-500px").transition().duration(200).style(side, "0px");
74417         } else {
74418           showPane.style(side, "0px");
74419         }
74420       } else {
74421         hidePanes.classed("shown", true).classed("hide", false).style(side, "0px").transition().duration(200).style(side, "-500px").on("end", function() {
74422           select_default2(this).classed("shown", false).classed("hide", true);
74423         });
74424       }
74425     };
74426     var _editMenu = uiEditMenu(context);
74427     ui.editMenu = function() {
74428       return _editMenu;
74429     };
74430     ui.showEditMenu = function(anchorPoint, triggerType, operations) {
74431       ui.closeEditMenu();
74432       if (!operations && context.mode().operations)
74433         operations = context.mode().operations();
74434       if (!operations || !operations.length)
74435         return;
74436       if (!context.map().editableDataEnabled())
74437         return;
74438       var surfaceNode = context.surface().node();
74439       if (surfaceNode.focus) {
74440         surfaceNode.focus();
74441       }
74442       operations.forEach(function(operation) {
74443         if (operation.point)
74444           operation.point(anchorPoint);
74445       });
74446       _editMenu.anchorLoc(anchorPoint).triggerType(triggerType).operations(operations);
74447       context.map().supersurface.call(_editMenu);
74448     };
74449     ui.closeEditMenu = function() {
74450       context.map().supersurface.select(".edit-menu").remove();
74451     };
74452     var _saveLoading = select_default2(null);
74453     context.uploader().on("saveStarted.ui", function() {
74454       _saveLoading = uiLoading(context).message(_t.html("save.uploading")).blocking(true);
74455       context.container().call(_saveLoading);
74456     }).on("saveEnded.ui", function() {
74457       _saveLoading.close();
74458       _saveLoading = select_default2(null);
74459     });
74460     marked.use({
74461       mangle: false,
74462       headerIds: false
74463     });
74464     return ui;
74465   }
74466
74467   // modules/core/context.js
74468   function coreContext() {
74469     const dispatch14 = dispatch_default("enter", "exit", "change");
74470     let context = utilRebind({}, dispatch14, "on");
74471     let _deferred2 = /* @__PURE__ */ new Set();
74472     context.version = package_default.version;
74473     context.privacyVersion = "20201202";
74474     context.initialHashParams = window.location.hash ? utilStringQs(window.location.hash) : {};
74475     context.changeset = null;
74476     let _defaultChangesetComment = context.initialHashParams.comment;
74477     let _defaultChangesetSource = context.initialHashParams.source;
74478     let _defaultChangesetHashtags = context.initialHashParams.hashtags;
74479     context.defaultChangesetComment = function(val) {
74480       if (!arguments.length)
74481         return _defaultChangesetComment;
74482       _defaultChangesetComment = val;
74483       return context;
74484     };
74485     context.defaultChangesetSource = function(val) {
74486       if (!arguments.length)
74487         return _defaultChangesetSource;
74488       _defaultChangesetSource = val;
74489       return context;
74490     };
74491     context.defaultChangesetHashtags = function(val) {
74492       if (!arguments.length)
74493         return _defaultChangesetHashtags;
74494       _defaultChangesetHashtags = val;
74495       return context;
74496     };
74497     let _setsDocumentTitle = true;
74498     context.setsDocumentTitle = function(val) {
74499       if (!arguments.length)
74500         return _setsDocumentTitle;
74501       _setsDocumentTitle = val;
74502       return context;
74503     };
74504     let _documentTitleBase = document.title;
74505     context.documentTitleBase = function(val) {
74506       if (!arguments.length)
74507         return _documentTitleBase;
74508       _documentTitleBase = val;
74509       return context;
74510     };
74511     let _ui;
74512     context.ui = () => _ui;
74513     context.lastPointerType = () => _ui.lastPointerType();
74514     let _keybinding = utilKeybinding("context");
74515     context.keybinding = () => _keybinding;
74516     select_default2(document).call(_keybinding);
74517     let _connection = services.osm;
74518     let _history;
74519     let _validator;
74520     let _uploader;
74521     context.connection = () => _connection;
74522     context.history = () => _history;
74523     context.validator = () => _validator;
74524     context.uploader = () => _uploader;
74525     context.preauth = (options2) => {
74526       if (_connection) {
74527         _connection.switch(options2);
74528       }
74529       return context;
74530     };
74531     context.locale = function(locale2) {
74532       if (!arguments.length)
74533         return _mainLocalizer.localeCode();
74534       _mainLocalizer.preferredLocaleCodes(locale2);
74535       return context;
74536     };
74537     function afterLoad(cid, callback) {
74538       return (err, result) => {
74539         if (err) {
74540           if (err.status === 400 || err.status === 401 || err.status === 403) {
74541             if (_connection) {
74542               _connection.logout();
74543             }
74544           }
74545           if (typeof callback === "function") {
74546             callback(err);
74547           }
74548           return;
74549         } else if (_connection && _connection.getConnectionId() !== cid) {
74550           if (typeof callback === "function") {
74551             callback({ message: "Connection Switched", status: -1 });
74552           }
74553           return;
74554         } else {
74555           _history.merge(result.data, result.extent);
74556           if (typeof callback === "function") {
74557             callback(err, result);
74558           }
74559           return;
74560         }
74561       };
74562     }
74563     context.loadTiles = (projection2, callback) => {
74564       const handle = window.requestIdleCallback(() => {
74565         _deferred2.delete(handle);
74566         if (_connection && context.editableDataEnabled()) {
74567           const cid = _connection.getConnectionId();
74568           _connection.loadTiles(projection2, afterLoad(cid, callback));
74569         }
74570       });
74571       _deferred2.add(handle);
74572     };
74573     context.loadTileAtLoc = (loc, callback) => {
74574       const handle = window.requestIdleCallback(() => {
74575         _deferred2.delete(handle);
74576         if (_connection && context.editableDataEnabled()) {
74577           const cid = _connection.getConnectionId();
74578           _connection.loadTileAtLoc(loc, afterLoad(cid, callback));
74579         }
74580       });
74581       _deferred2.add(handle);
74582     };
74583     context.loadEntity = (entityID, callback) => {
74584       if (_connection) {
74585         const cid = _connection.getConnectionId();
74586         _connection.loadEntity(entityID, afterLoad(cid, callback));
74587         _connection.loadEntityRelations(entityID, afterLoad(cid, callback));
74588       }
74589     };
74590     context.zoomToEntity = (entityID, zoomTo) => {
74591       context.loadEntity(entityID, (err, result) => {
74592         if (err)
74593           return;
74594         if (zoomTo !== false) {
74595           const entity = result.data.find((e3) => e3.id === entityID);
74596           if (entity) {
74597             _map.zoomTo(entity);
74598           }
74599         }
74600       });
74601       _map.on("drawn.zoomToEntity", () => {
74602         if (!context.hasEntity(entityID))
74603           return;
74604         _map.on("drawn.zoomToEntity", null);
74605         context.on("enter.zoomToEntity", null);
74606         context.enter(modeSelect(context, [entityID]));
74607       });
74608       context.on("enter.zoomToEntity", () => {
74609         if (_mode.id !== "browse") {
74610           _map.on("drawn.zoomToEntity", null);
74611           context.on("enter.zoomToEntity", null);
74612         }
74613       });
74614     };
74615     let _minEditableZoom = 16;
74616     context.minEditableZoom = function(val) {
74617       if (!arguments.length)
74618         return _minEditableZoom;
74619       _minEditableZoom = val;
74620       if (_connection) {
74621         _connection.tileZoom(val);
74622       }
74623       return context;
74624     };
74625     context.maxCharsForTagKey = () => 255;
74626     context.maxCharsForTagValue = () => 255;
74627     context.maxCharsForRelationRole = () => 255;
74628     context.cleanTagKey = (val) => utilCleanOsmString(val, context.maxCharsForTagKey());
74629     context.cleanTagValue = (val) => utilCleanOsmString(val, context.maxCharsForTagValue());
74630     context.cleanRelationRole = (val) => utilCleanOsmString(val, context.maxCharsForRelationRole());
74631     let _inIntro = false;
74632     context.inIntro = function(val) {
74633       if (!arguments.length)
74634         return _inIntro;
74635       _inIntro = val;
74636       return context;
74637     };
74638     context.save = () => {
74639       if (_inIntro || context.container().select(".modal").size())
74640         return;
74641       let canSave;
74642       if (_mode && _mode.id === "save") {
74643         canSave = false;
74644         if (services.osm && services.osm.isChangesetInflight()) {
74645           _history.clearSaved();
74646           return;
74647         }
74648       } else {
74649         canSave = context.selectedIDs().every((id2) => {
74650           const entity = context.hasEntity(id2);
74651           return entity && !entity.isDegenerate();
74652         });
74653       }
74654       if (canSave) {
74655         _history.save();
74656       }
74657       if (_history.hasChanges()) {
74658         return _t("save.unsaved_changes");
74659       }
74660     };
74661     context.debouncedSave = debounce_default(context.save, 350);
74662     function withDebouncedSave(fn) {
74663       return function() {
74664         const result = fn.apply(_history, arguments);
74665         context.debouncedSave();
74666         return result;
74667       };
74668     }
74669     context.hasEntity = (id2) => _history.graph().hasEntity(id2);
74670     context.entity = (id2) => _history.graph().entity(id2);
74671     let _mode;
74672     context.mode = () => _mode;
74673     context.enter = (newMode) => {
74674       if (_mode) {
74675         _mode.exit();
74676         dispatch14.call("exit", this, _mode);
74677       }
74678       _mode = newMode;
74679       _mode.enter();
74680       dispatch14.call("enter", this, _mode);
74681     };
74682     context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || [];
74683     context.activeID = () => _mode && _mode.activeID && _mode.activeID();
74684     let _selectedNoteID;
74685     context.selectedNoteID = function(noteID) {
74686       if (!arguments.length)
74687         return _selectedNoteID;
74688       _selectedNoteID = noteID;
74689       return context;
74690     };
74691     let _selectedErrorID;
74692     context.selectedErrorID = function(errorID) {
74693       if (!arguments.length)
74694         return _selectedErrorID;
74695       _selectedErrorID = errorID;
74696       return context;
74697     };
74698     context.install = (behavior) => context.surface().call(behavior);
74699     context.uninstall = (behavior) => context.surface().call(behavior.off);
74700     let _copyGraph;
74701     context.copyGraph = () => _copyGraph;
74702     let _copyIDs = [];
74703     context.copyIDs = function(val) {
74704       if (!arguments.length)
74705         return _copyIDs;
74706       _copyIDs = val;
74707       _copyGraph = _history.graph();
74708       return context;
74709     };
74710     let _copyLonLat;
74711     context.copyLonLat = function(val) {
74712       if (!arguments.length)
74713         return _copyLonLat;
74714       _copyLonLat = val;
74715       return context;
74716     };
74717     let _background;
74718     context.background = () => _background;
74719     let _features;
74720     context.features = () => _features;
74721     context.hasHiddenConnections = (id2) => {
74722       const graph = _history.graph();
74723       const entity = graph.entity(id2);
74724       return _features.hasHiddenConnections(entity, graph);
74725     };
74726     let _photos;
74727     context.photos = () => _photos;
74728     let _map;
74729     context.map = () => _map;
74730     context.layers = () => _map.layers();
74731     context.surface = () => _map.surface;
74732     context.editableDataEnabled = () => _map.editableDataEnabled();
74733     context.surfaceRect = () => _map.surface.node().getBoundingClientRect();
74734     context.editable = () => {
74735       const mode = context.mode();
74736       if (!mode || mode.id === "save")
74737         return false;
74738       return _map.editableDataEnabled();
74739     };
74740     let _debugFlags = {
74741       tile: false,
74742       // tile boundaries
74743       collision: false,
74744       // label collision bounding boxes
74745       imagery: false,
74746       // imagery bounding polygons
74747       target: false,
74748       // touch targets
74749       downloaded: false
74750       // downloaded data from osm
74751     };
74752     context.debugFlags = () => _debugFlags;
74753     context.getDebug = (flag) => flag && _debugFlags[flag];
74754     context.setDebug = function(flag, val) {
74755       if (arguments.length === 1)
74756         val = true;
74757       _debugFlags[flag] = val;
74758       dispatch14.call("change");
74759       return context;
74760     };
74761     let _container = select_default2(null);
74762     context.container = function(val) {
74763       if (!arguments.length)
74764         return _container;
74765       _container = val;
74766       _container.classed("ideditor", true);
74767       return context;
74768     };
74769     context.containerNode = function(val) {
74770       if (!arguments.length)
74771         return context.container().node();
74772       context.container(select_default2(val));
74773       return context;
74774     };
74775     let _embed;
74776     context.embed = function(val) {
74777       if (!arguments.length)
74778         return _embed;
74779       _embed = val;
74780       return context;
74781     };
74782     let _assetPath = "";
74783     context.assetPath = function(val) {
74784       if (!arguments.length)
74785         return _assetPath;
74786       _assetPath = val;
74787       _mainFileFetcher.assetPath(val);
74788       return context;
74789     };
74790     let _assetMap = {};
74791     context.assetMap = function(val) {
74792       if (!arguments.length)
74793         return _assetMap;
74794       _assetMap = val;
74795       _mainFileFetcher.assetMap(val);
74796       return context;
74797     };
74798     context.asset = (val) => {
74799       if (/^http(s)?:\/\//i.test(val))
74800         return val;
74801       const filename = _assetPath + val;
74802       return _assetMap[filename] || filename;
74803     };
74804     context.imagePath = (val) => context.asset("img/".concat(val));
74805     context.reset = context.flush = () => {
74806       context.debouncedSave.cancel();
74807       Array.from(_deferred2).forEach((handle) => {
74808         window.cancelIdleCallback(handle);
74809         _deferred2.delete(handle);
74810       });
74811       Object.values(services).forEach((service) => {
74812         if (service && typeof service.reset === "function") {
74813           service.reset(context);
74814         }
74815       });
74816       context.changeset = null;
74817       _validator.reset();
74818       _features.reset();
74819       _history.reset();
74820       _uploader.reset();
74821       context.container().select(".inspector-wrap *").remove();
74822       return context;
74823     };
74824     context.projection = geoRawMercator();
74825     context.curtainProjection = geoRawMercator();
74826     context.init = () => {
74827       instantiateInternal();
74828       initializeDependents();
74829       return context;
74830       function instantiateInternal() {
74831         _history = coreHistory(context);
74832         context.graph = _history.graph;
74833         context.pauseChangeDispatch = _history.pauseChangeDispatch;
74834         context.resumeChangeDispatch = _history.resumeChangeDispatch;
74835         context.perform = withDebouncedSave(_history.perform);
74836         context.replace = withDebouncedSave(_history.replace);
74837         context.pop = withDebouncedSave(_history.pop);
74838         context.overwrite = withDebouncedSave(_history.overwrite);
74839         context.undo = withDebouncedSave(_history.undo);
74840         context.redo = withDebouncedSave(_history.redo);
74841         _validator = coreValidator(context);
74842         _uploader = coreUploader(context);
74843         _background = rendererBackground(context);
74844         _features = rendererFeatures(context);
74845         _map = rendererMap(context);
74846         _photos = rendererPhotos(context);
74847         _ui = uiInit(context);
74848       }
74849       function initializeDependents() {
74850         if (context.initialHashParams.presets) {
74851           _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(",")));
74852         }
74853         if (context.initialHashParams.locale) {
74854           _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
74855         }
74856         _mainLocalizer.ensureLoaded();
74857         _mainPresetIndex.ensureLoaded();
74858         _background.ensureLoaded();
74859         Object.values(services).forEach((service) => {
74860           if (service && typeof service.init === "function") {
74861             service.init();
74862           }
74863         });
74864         _map.init();
74865         _validator.init();
74866         _features.init();
74867         if (services.maprules && context.initialHashParams.maprules) {
74868           json_default(context.initialHashParams.maprules).then((mapcss) => {
74869             services.maprules.init();
74870             mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector));
74871           }).catch(() => {
74872           });
74873         }
74874         if (!context.container().empty()) {
74875           _ui.ensureLoaded().then(() => {
74876             _background.init();
74877             _photos.init();
74878           });
74879         }
74880       }
74881     };
74882     return context;
74883   }
74884
74885   // modules/services/nominatim.js
74886   var apibase = nominatimApiUrl;
74887   var _inflight = {};
74888   var _nominatimCache;
74889   var nominatim_default = {
74890     init: function() {
74891       _inflight = {};
74892       _nominatimCache = new import_rbush7.default();
74893     },
74894     reset: function() {
74895       Object.values(_inflight).forEach(function(controller) {
74896         controller.abort();
74897       });
74898       _inflight = {};
74899       _nominatimCache = new import_rbush7.default();
74900     },
74901     countryCode: function(location, callback) {
74902       this.reverse(location, function(err, result) {
74903         if (err) {
74904           return callback(err);
74905         } else if (result.address) {
74906           return callback(null, result.address.country_code);
74907         } else {
74908           return callback("Unable to geocode", null);
74909         }
74910       });
74911     },
74912     reverse: function(loc, callback) {
74913       var cached = _nominatimCache.search(
74914         { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] }
74915       );
74916       if (cached.length > 0) {
74917         if (callback)
74918           callback(null, cached[0].data);
74919         return;
74920       }
74921       var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] };
74922       var url = apibase + "reverse?" + utilQsString(params);
74923       if (_inflight[url])
74924         return;
74925       var controller = new AbortController();
74926       _inflight[url] = controller;
74927       json_default(url, {
74928         signal: controller.signal,
74929         headers: {
74930           "Accept-Language": _mainLocalizer.localeCodes().join(",")
74931         }
74932       }).then(function(result) {
74933         delete _inflight[url];
74934         if (result && result.error) {
74935           throw new Error(result.error);
74936         }
74937         var extent = geoExtent(loc).padByMeters(200);
74938         _nominatimCache.insert(Object.assign(extent.bbox(), { data: result }));
74939         if (callback)
74940           callback(null, result);
74941       }).catch(function(err) {
74942         delete _inflight[url];
74943         if (err.name === "AbortError")
74944           return;
74945         if (callback)
74946           callback(err.message);
74947       });
74948     },
74949     search: function(val, callback) {
74950       const params = {
74951         q: val,
74952         limit: 10,
74953         format: "json"
74954       };
74955       var url = apibase + "search?" + utilQsString(params);
74956       if (_inflight[url])
74957         return;
74958       var controller = new AbortController();
74959       _inflight[url] = controller;
74960       json_default(url, {
74961         signal: controller.signal,
74962         headers: {
74963           "Accept-Language": _mainLocalizer.localeCodes().join(",")
74964         }
74965       }).then(function(result) {
74966         delete _inflight[url];
74967         if (result && result.error) {
74968           throw new Error(result.error);
74969         }
74970         if (callback)
74971           callback(null, result);
74972       }).catch(function(err) {
74973         delete _inflight[url];
74974         if (err.name === "AbortError")
74975           return;
74976         if (callback)
74977           callback(err.message);
74978       });
74979     }
74980   };
74981
74982   // node_modules/name-suggestion-index/lib/matcher.js
74983   var import_which_polygon4 = __toESM(require_which_polygon(), 1);
74984
74985   // node_modules/name-suggestion-index/lib/simplify.js
74986   var import_diacritics3 = __toESM(require_diacritics(), 1);
74987   function simplify2(str2) {
74988     if (typeof str2 !== "string")
74989       return "";
74990     return import_diacritics3.default.remove(
74991       str2.replace(/&/g, "and").replace(/İ/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u2000-\u206f\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e7f\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase()
74992     );
74993   }
74994
74995   // node_modules/name-suggestion-index/config/matchGroups.json
74996   var matchGroups_default = {
74997     matchGroups: {
74998       adult_gaming_centre: [
74999         "amenity/casino",
75000         "amenity/gambling",
75001         "leisure/adult_gaming_centre"
75002       ],
75003       beauty: [
75004         "shop/beauty",
75005         "shop/hairdresser_supply"
75006       ],
75007       bed: [
75008         "shop/bed",
75009         "shop/furniture"
75010       ],
75011       beverages: [
75012         "shop/alcohol",
75013         "shop/beer",
75014         "shop/beverages",
75015         "shop/kiosk",
75016         "shop/wine"
75017       ],
75018       camping: [
75019         "tourism/camp_site",
75020         "tourism/caravan_site"
75021       ],
75022       car_parts: [
75023         "shop/car_parts",
75024         "shop/car_repair",
75025         "shop/tires",
75026         "shop/tyres"
75027       ],
75028       clinic: [
75029         "amenity/clinic",
75030         "amenity/doctors",
75031         "healthcare/clinic",
75032         "healthcare/laboratory",
75033         "healthcare/physiotherapist",
75034         "healthcare/sample_collection",
75035         "healthcare/dialysis"
75036       ],
75037       convenience: [
75038         "shop/beauty",
75039         "shop/chemist",
75040         "shop/convenience",
75041         "shop/cosmetics",
75042         "shop/grocery",
75043         "shop/kiosk",
75044         "shop/newsagent",
75045         "shop/perfumery"
75046       ],
75047       coworking: [
75048         "amenity/coworking_space",
75049         "office/coworking",
75050         "office/coworking_space"
75051       ],
75052       dentist: [
75053         "amenity/dentist",
75054         "amenity/doctors",
75055         "healthcare/dentist"
75056       ],
75057       electronics: [
75058         "office/telecommunication",
75059         "shop/computer",
75060         "shop/electronics",
75061         "shop/hifi",
75062         "shop/kiosk",
75063         "shop/mobile",
75064         "shop/mobile_phone",
75065         "shop/telecommunication"
75066       ],
75067       fabric: [
75068         "shop/fabric",
75069         "shop/haberdashery",
75070         "shop/sewing"
75071       ],
75072       fashion: [
75073         "shop/accessories",
75074         "shop/bag",
75075         "shop/boutique",
75076         "shop/clothes",
75077         "shop/department_store",
75078         "shop/fashion",
75079         "shop/fashion_accessories",
75080         "shop/sports",
75081         "shop/shoes"
75082       ],
75083       financial: [
75084         "amenity/bank",
75085         "office/accountant",
75086         "office/financial",
75087         "office/financial_advisor",
75088         "office/tax_advisor",
75089         "shop/tax"
75090       ],
75091       fitness: [
75092         "leisure/fitness_centre",
75093         "leisure/fitness_center",
75094         "leisure/sports_centre",
75095         "leisure/sports_center"
75096       ],
75097       food: [
75098         "amenity/bar",
75099         "amenity/cafe",
75100         "amenity/fast_food",
75101         "amenity/ice_cream",
75102         "amenity/pub",
75103         "amenity/restaurant",
75104         "shop/bakery",
75105         "shop/candy",
75106         "shop/chocolate",
75107         "shop/coffee",
75108         "shop/confectionary",
75109         "shop/confectionery",
75110         "shop/food",
75111         "shop/kiosk",
75112         "shop/ice_cream",
75113         "shop/pastry",
75114         "shop/tea"
75115       ],
75116       fuel: [
75117         "amenity/fuel",
75118         "shop/gas",
75119         "shop/convenience;gas",
75120         "shop/gas;convenience"
75121       ],
75122       gift: [
75123         "shop/gift",
75124         "shop/card",
75125         "shop/cards",
75126         "shop/kiosk",
75127         "shop/stationery"
75128       ],
75129       hardware: [
75130         "shop/bathroom_furnishing",
75131         "shop/carpet",
75132         "shop/diy",
75133         "shop/doityourself",
75134         "shop/doors",
75135         "shop/electrical",
75136         "shop/flooring",
75137         "shop/hardware",
75138         "shop/hardware_store",
75139         "shop/power_tools",
75140         "shop/tool_hire",
75141         "shop/tools",
75142         "shop/trade"
75143       ],
75144       health_food: [
75145         "shop/health",
75146         "shop/health_food",
75147         "shop/herbalist",
75148         "shop/nutrition_supplements"
75149       ],
75150       hobby: [
75151         "shop/electronics",
75152         "shop/hobby",
75153         "shop/books",
75154         "shop/games",
75155         "shop/collector",
75156         "shop/toys",
75157         "shop/model",
75158         "shop/video_games",
75159         "shop/anime"
75160       ],
75161       hospital: [
75162         "amenity/doctors",
75163         "amenity/hospital",
75164         "healthcare/hospital"
75165       ],
75166       houseware: [
75167         "shop/houseware",
75168         "shop/interior_decoration"
75169       ],
75170       lifeboat_station: [
75171         "amenity/lifeboat_station",
75172         "emergency/lifeboat_station",
75173         "emergency/marine_rescue"
75174       ],
75175       lodging: [
75176         "tourism/hotel",
75177         "tourism/motel"
75178       ],
75179       money_transfer: [
75180         "amenity/money_transfer",
75181         "shop/money_transfer"
75182       ],
75183       office_supplies: [
75184         "shop/office_supplies",
75185         "shop/stationary",
75186         "shop/stationery"
75187       ],
75188       outdoor: [
75189         "shop/clothes",
75190         "shop/outdoor",
75191         "shop/sports"
75192       ],
75193       parcel_locker: [
75194         "amenity/parcel_locker",
75195         "amenity/vending_machine"
75196       ],
75197       pharmacy: [
75198         "amenity/doctors",
75199         "amenity/pharmacy",
75200         "healthcare/pharmacy"
75201       ],
75202       playground: [
75203         "amenity/theme_park",
75204         "leisure/amusement_arcade",
75205         "leisure/playground"
75206       ],
75207       rental: [
75208         "amenity/bicycle_rental",
75209         "amenity/boat_rental",
75210         "amenity/car_rental",
75211         "amenity/truck_rental",
75212         "amenity/vehicle_rental",
75213         "shop/kiosk",
75214         "shop/rental"
75215       ],
75216       school: [
75217         "amenity/childcare",
75218         "amenity/college",
75219         "amenity/kindergarten",
75220         "amenity/language_school",
75221         "amenity/prep_school",
75222         "amenity/school",
75223         "amenity/university"
75224       ],
75225       storage: [
75226         "shop/storage_units",
75227         "shop/storage_rental"
75228       ],
75229       substation: [
75230         "power/station",
75231         "power/substation",
75232         "power/sub_station"
75233       ],
75234       supermarket: [
75235         "shop/food",
75236         "shop/frozen_food",
75237         "shop/greengrocer",
75238         "shop/grocery",
75239         "shop/supermarket",
75240         "shop/wholesale"
75241       ],
75242       variety_store: [
75243         "shop/variety_store",
75244         "shop/discount",
75245         "shop/convenience"
75246       ],
75247       vending: [
75248         "amenity/vending_machine",
75249         "shop/kiosk",
75250         "shop/vending_machine"
75251       ],
75252       weight_loss: [
75253         "amenity/clinic",
75254         "amenity/doctors",
75255         "amenity/weight_clinic",
75256         "healthcare/counselling",
75257         "leisure/fitness_centre",
75258         "office/therapist",
75259         "shop/beauty",
75260         "shop/diet",
75261         "shop/food",
75262         "shop/health_food",
75263         "shop/herbalist",
75264         "shop/nutrition",
75265         "shop/nutrition_supplements",
75266         "shop/weight_loss"
75267       ],
75268       wholesale: [
75269         "shop/wholesale",
75270         "shop/supermarket",
75271         "shop/department_store"
75272       ]
75273     }
75274   };
75275
75276   // node_modules/name-suggestion-index/config/genericWords.json
75277   var genericWords_default = {
75278     genericWords: [
75279       "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$",
75280       "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$",
75281       "^(club|green|out|ware)\\s?house$",
75282       "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$",
75283       "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$",
75284       "^(hofladen|librairie|magazine?|maison)$",
75285       "^(mobile home|skate)?\\s?park$",
75286       "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$",
75287       "^\\?+$",
75288       "^private$",
75289       "^tattoo( studio)?$",
75290       "^windmill$",
75291       "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$"
75292     ]
75293   };
75294
75295   // node_modules/name-suggestion-index/config/trees.json
75296   var trees_default = {
75297     trees: {
75298       brands: {
75299         emoji: "\u{1F354}",
75300         mainTag: "brand:wikidata",
75301         sourceTags: ["brand", "name"],
75302         nameTags: {
75303           primary: "^(name|name:\\w+)$",
75304           alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$"
75305         }
75306       },
75307       flags: {
75308         emoji: "\u{1F6A9}",
75309         mainTag: "flag:wikidata",
75310         nameTags: {
75311           primary: "^(flag:name|flag:name:\\w+)$",
75312           alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$"
75313         }
75314       },
75315       operators: {
75316         emoji: "\u{1F4BC}",
75317         mainTag: "operator:wikidata",
75318         sourceTags: ["operator"],
75319         nameTags: {
75320           primary: "^(name|name:\\w+|operator|operator:\\w+)$",
75321           alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$"
75322         }
75323       },
75324       transit: {
75325         emoji: "\u{1F687}",
75326         mainTag: "network:wikidata",
75327         sourceTags: ["network"],
75328         nameTags: {
75329           primary: "^network$",
75330           alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$"
75331         }
75332       }
75333     }
75334   };
75335
75336   // node_modules/name-suggestion-index/lib/matcher.js
75337   var matchGroups = matchGroups_default.matchGroups;
75338   var trees = trees_default.trees;
75339   var Matcher = class {
75340     //
75341     // `constructor`
75342     // initialize the genericWords regexes
75343     constructor() {
75344       this.matchIndex = void 0;
75345       this.genericWords = /* @__PURE__ */ new Map();
75346       (genericWords_default.genericWords || []).forEach((s2) => this.genericWords.set(s2, new RegExp(s2, "i")));
75347       this.itemLocation = void 0;
75348       this.locationSets = void 0;
75349       this.locationIndex = void 0;
75350       this.warnings = [];
75351     }
75352     //
75353     // `buildMatchIndex()`
75354     // Call this to prepare the matcher for use
75355     //
75356     // `data` needs to be an Object indexed on a 'tree/key/value' path.
75357     // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
75358     // {
75359     //    'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
75360     //    'brands/amenity/bar':  { properties: {}, items: [ {}, {}, … ] },
75361     //    …
75362     // }
75363     //
75364     buildMatchIndex(data) {
75365       const that = this;
75366       if (that.matchIndex)
75367         return;
75368       that.matchIndex = /* @__PURE__ */ new Map();
75369       const seenTree = /* @__PURE__ */ new Map();
75370       Object.keys(data).forEach((tkv) => {
75371         const category = data[tkv];
75372         const parts = tkv.split("/", 3);
75373         const t2 = parts[0];
75374         const k2 = parts[1];
75375         const v2 = parts[2];
75376         const thiskv = "".concat(k2, "/").concat(v2);
75377         const tree = trees[t2];
75378         let branch = that.matchIndex.get(thiskv);
75379         if (!branch) {
75380           branch = {
75381             primary: /* @__PURE__ */ new Map(),
75382             alternate: /* @__PURE__ */ new Map(),
75383             excludeGeneric: /* @__PURE__ */ new Map(),
75384             excludeNamed: /* @__PURE__ */ new Map()
75385           };
75386           that.matchIndex.set(thiskv, branch);
75387         }
75388         const properties = category.properties || {};
75389         const exclude = properties.exclude || {};
75390         (exclude.generic || []).forEach((s2) => branch.excludeGeneric.set(s2, new RegExp(s2, "i")));
75391         (exclude.named || []).forEach((s2) => branch.excludeNamed.set(s2, new RegExp(s2, "i")));
75392         const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()];
75393         let items = category.items;
75394         if (!Array.isArray(items) || !items.length)
75395           return;
75396         const primaryName = new RegExp(tree.nameTags.primary, "i");
75397         const alternateName = new RegExp(tree.nameTags.alternate, "i");
75398         const notName = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
75399         const skipGenericKV = skipGenericKVMatches(t2, k2, v2);
75400         const genericKV = /* @__PURE__ */ new Set(["".concat(k2, "/yes"), "building/yes"]);
75401         const matchGroupKV = /* @__PURE__ */ new Set();
75402         Object.values(matchGroups).forEach((matchGroup) => {
75403           const inGroup = matchGroup.some((otherkv) => otherkv === thiskv);
75404           if (!inGroup)
75405             return;
75406           matchGroup.forEach((otherkv) => {
75407             if (otherkv === thiskv)
75408               return;
75409             matchGroupKV.add(otherkv);
75410             const otherk = otherkv.split("/", 2)[0];
75411             genericKV.add("".concat(otherk, "/yes"));
75412           });
75413         });
75414         items.forEach((item) => {
75415           if (!item.id)
75416             return;
75417           if (Array.isArray(item.matchTags) && item.matchTags.length) {
75418             item.matchTags = item.matchTags.filter((matchTag) => !matchGroupKV.has(matchTag) && !genericKV.has(matchTag));
75419             if (!item.matchTags.length)
75420               delete item.matchTags;
75421           }
75422           let kvTags = ["".concat(thiskv)].concat(item.matchTags || []);
75423           if (!skipGenericKV) {
75424             kvTags = kvTags.concat(Array.from(genericKV));
75425           }
75426           Object.keys(item.tags).forEach((osmkey) => {
75427             if (notName.test(osmkey))
75428               return;
75429             const osmvalue = item.tags[osmkey];
75430             if (!osmvalue || excludeRegexes.some((regex) => regex.test(osmvalue)))
75431               return;
75432             if (primaryName.test(osmkey)) {
75433               kvTags.forEach((kv) => insertName("primary", t2, kv, simplify2(osmvalue), item.id));
75434             } else if (alternateName.test(osmkey)) {
75435               kvTags.forEach((kv) => insertName("alternate", t2, kv, simplify2(osmvalue), item.id));
75436             }
75437           });
75438           let keepMatchNames = /* @__PURE__ */ new Set();
75439           (item.matchNames || []).forEach((matchName) => {
75440             const nsimple = simplify2(matchName);
75441             kvTags.forEach((kv) => {
75442               const branch2 = that.matchIndex.get(kv);
75443               const primaryLeaf = branch2 && branch2.primary.get(nsimple);
75444               const alternateLeaf = branch2 && branch2.alternate.get(nsimple);
75445               const inPrimary = primaryLeaf && primaryLeaf.has(item.id);
75446               const inAlternate = alternateLeaf && alternateLeaf.has(item.id);
75447               if (!inPrimary && !inAlternate) {
75448                 insertName("alternate", t2, kv, nsimple, item.id);
75449                 keepMatchNames.add(matchName);
75450               }
75451             });
75452           });
75453           if (keepMatchNames.size) {
75454             item.matchNames = Array.from(keepMatchNames);
75455           } else {
75456             delete item.matchNames;
75457           }
75458         });
75459       });
75460       function insertName(which, t2, kv, nsimple, itemID) {
75461         if (!nsimple) {
75462           that.warnings.push("Warning: skipping empty ".concat(which, " name for item ").concat(t2, "/").concat(kv, ": ").concat(itemID));
75463           return;
75464         }
75465         let branch = that.matchIndex.get(kv);
75466         if (!branch) {
75467           branch = {
75468             primary: /* @__PURE__ */ new Map(),
75469             alternate: /* @__PURE__ */ new Map(),
75470             excludeGeneric: /* @__PURE__ */ new Map(),
75471             excludeNamed: /* @__PURE__ */ new Map()
75472           };
75473           that.matchIndex.set(kv, branch);
75474         }
75475         let leaf = branch[which].get(nsimple);
75476         if (!leaf) {
75477           leaf = /* @__PURE__ */ new Set();
75478           branch[which].set(nsimple, leaf);
75479         }
75480         leaf.add(itemID);
75481         if (!/yes$/.test(kv)) {
75482           const kvnsimple = "".concat(kv, "/").concat(nsimple);
75483           const existing = seenTree.get(kvnsimple);
75484           if (existing && existing !== t2) {
75485             const items = Array.from(leaf);
75486             that.warnings.push('Duplicate cache key "'.concat(kvnsimple, '" in trees "').concat(t2, '" and "').concat(existing, '", check items: ').concat(items));
75487             return;
75488           }
75489           seenTree.set(kvnsimple, t2);
75490         }
75491       }
75492       function skipGenericKVMatches(t2, k2, v2) {
75493         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";
75494       }
75495     }
75496     //
75497     // `buildLocationIndex()`
75498     // Call this to prepare a which-polygon location index.
75499     // This *resolves* all the locationSets into GeoJSON, which takes some time.
75500     // You can skip this step if you don't care about matching within a location.
75501     //
75502     // `data` needs to be an Object indexed on a 'tree/key/value' path.
75503     // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
75504     // {
75505     //    'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
75506     //    'brands/amenity/bar':  { properties: {}, items: [ {}, {}, … ] },
75507     //    …
75508     // }
75509     //
75510     buildLocationIndex(data, loco) {
75511       const that = this;
75512       if (that.locationIndex)
75513         return;
75514       that.itemLocation = /* @__PURE__ */ new Map();
75515       that.locationSets = /* @__PURE__ */ new Map();
75516       Object.keys(data).forEach((tkv) => {
75517         const items = data[tkv].items;
75518         if (!Array.isArray(items) || !items.length)
75519           return;
75520         items.forEach((item) => {
75521           if (that.itemLocation.has(item.id))
75522             return;
75523           let resolved;
75524           try {
75525             resolved = loco.resolveLocationSet(item.locationSet);
75526           } catch (err) {
75527             console.warn("buildLocationIndex: ".concat(err.message));
75528           }
75529           if (!resolved || !resolved.id)
75530             return;
75531           that.itemLocation.set(item.id, resolved.id);
75532           if (that.locationSets.has(resolved.id))
75533             return;
75534           let feature3 = _cloneDeep2(resolved.feature);
75535           feature3.id = resolved.id;
75536           feature3.properties.id = resolved.id;
75537           if (!feature3.geometry.coordinates.length || !feature3.properties.area) {
75538             console.warn("buildLocationIndex: locationSet ".concat(resolved.id, " for ").concat(item.id, " resolves to an empty feature:"));
75539             console.warn(JSON.stringify(feature3));
75540             return;
75541           }
75542           that.locationSets.set(resolved.id, feature3);
75543         });
75544       });
75545       that.locationIndex = (0, import_which_polygon4.default)({ type: "FeatureCollection", features: [...that.locationSets.values()] });
75546       function _cloneDeep2(obj) {
75547         return JSON.parse(JSON.stringify(obj));
75548       }
75549     }
75550     //
75551     // `match()`
75552     // Pass parts and return an Array of matches.
75553     // `k` - key
75554     // `v` - value
75555     // `n` - namelike
75556     // `loc` - optional - [lon,lat] location to search
75557     //
75558     // 1. If the [k,v,n] tuple matches a canonical item…
75559     // Return an Array of match results.
75560     // Each result will include the area in km² that the item is valid.
75561     //
75562     // Order of results:
75563     // Primary ordering will be on the "match" column:
75564     //   "primary" - where the query matches the `name` tag, followed by
75565     //   "alternate" - where the query matches an alternate name tag (e.g. short_name, brand, operator, etc)
75566     // Secondary ordering will be on the "area" column:
75567     //   "area descending" if no location was provided, (worldwide before local)
75568     //   "area ascending" if location was provided (local before worldwide)
75569     //
75570     // [
75571     //   { match: 'primary',   itemID: String,  area: Number,  kv: String,  nsimple: String },
75572     //   { match: 'primary',   itemID: String,  area: Number,  kv: String,  nsimple: String },
75573     //   { match: 'alternate', itemID: String,  area: Number,  kv: String,  nsimple: String },
75574     //   { match: 'alternate', itemID: String,  area: Number,  kv: String,  nsimple: String },
75575     //   …
75576     // ]
75577     //
75578     // -or-
75579     //
75580     // 2. If the [k,v,n] tuple matches an exclude pattern…
75581     // Return an Array with a single exclude result, either
75582     //
75583     // [ { match: 'excludeGeneric', pattern: String,  kv: String } ]  // "generic" e.g. "Food Court"
75584     //   or
75585     // [ { match: 'excludeNamed', pattern: String,  kv: String } ]    // "named", e.g. "Kebabai"
75586     //
75587     // About results
75588     //   "generic" - a generic word that is probably not really a name.
75589     //     For these, iD should warn the user "Hey don't put 'food court' in the name tag".
75590     //   "named" - a real name like "Kebabai" that is just common, but not a brand.
75591     //     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.
75592     //
75593     // -or-
75594     //
75595     // 3. If the [k,v,n] tuple matches nothing of any kind, return `null`
75596     //
75597     //
75598     match(k2, v2, n3, loc) {
75599       const that = this;
75600       if (!that.matchIndex) {
75601         throw new Error("match:  matchIndex not built.");
75602       }
75603       let matchLocations;
75604       if (Array.isArray(loc) && that.locationIndex) {
75605         matchLocations = that.locationIndex([loc[0], loc[1], loc[0], loc[1]], true);
75606       }
75607       const nsimple = simplify2(n3);
75608       let seen = /* @__PURE__ */ new Set();
75609       let results = [];
75610       gatherResults("primary");
75611       gatherResults("alternate");
75612       if (results.length)
75613         return results;
75614       gatherResults("exclude");
75615       return results.length ? results : null;
75616       function gatherResults(which) {
75617         const kv = "".concat(k2, "/").concat(v2);
75618         let didMatch = tryMatch(which, kv);
75619         if (didMatch)
75620           return;
75621         for (let mg in matchGroups) {
75622           const matchGroup = matchGroups[mg];
75623           const inGroup = matchGroup.some((otherkv) => otherkv === kv);
75624           if (!inGroup)
75625             continue;
75626           for (let i3 = 0; i3 < matchGroup.length; i3++) {
75627             const otherkv = matchGroup[i3];
75628             if (otherkv === kv)
75629               continue;
75630             didMatch = tryMatch(which, otherkv);
75631             if (didMatch)
75632               return;
75633           }
75634         }
75635         if (which === "exclude") {
75636           const regex = [...that.genericWords.values()].find((regex2) => regex2.test(n3));
75637           if (regex) {
75638             results.push({ match: "excludeGeneric", pattern: String(regex) });
75639             return;
75640           }
75641         }
75642       }
75643       function tryMatch(which, kv) {
75644         const branch = that.matchIndex.get(kv);
75645         if (!branch)
75646           return;
75647         if (which === "exclude") {
75648           let regex = [...branch.excludeNamed.values()].find((regex2) => regex2.test(n3));
75649           if (regex) {
75650             results.push({ match: "excludeNamed", pattern: String(regex), kv });
75651             return;
75652           }
75653           regex = [...branch.excludeGeneric.values()].find((regex2) => regex2.test(n3));
75654           if (regex) {
75655             results.push({ match: "excludeGeneric", pattern: String(regex), kv });
75656             return;
75657           }
75658           return;
75659         }
75660         const leaf = branch[which].get(nsimple);
75661         if (!leaf || !leaf.size)
75662           return;
75663         let hits = Array.from(leaf).map((itemID) => {
75664           let area = Infinity;
75665           if (that.itemLocation && that.locationSets) {
75666             const location = that.locationSets.get(that.itemLocation.get(itemID));
75667             area = location && location.properties.area || Infinity;
75668           }
75669           return { match: which, itemID, area, kv, nsimple };
75670         });
75671         let sortFn = byAreaDescending;
75672         if (matchLocations) {
75673           hits = hits.filter(isValidLocation);
75674           sortFn = byAreaAscending;
75675         }
75676         if (!hits.length)
75677           return;
75678         hits.sort(sortFn).forEach((hit) => {
75679           if (seen.has(hit.itemID))
75680             return;
75681           seen.add(hit.itemID);
75682           results.push(hit);
75683         });
75684         return true;
75685         function isValidLocation(hit) {
75686           if (!that.itemLocation)
75687             return true;
75688           return matchLocations.find((props) => props.id === that.itemLocation.get(hit.itemID));
75689         }
75690         function byAreaAscending(hitA, hitB) {
75691           return hitA.area - hitB.area;
75692         }
75693         function byAreaDescending(hitA, hitB) {
75694           return hitB.area - hitA.area;
75695         }
75696       }
75697     }
75698     //
75699     // `getWarnings()`
75700     // Return any warnings discovered when buiding the index.
75701     // (currently this does nothing)
75702     //
75703     getWarnings() {
75704       return this.warnings;
75705     }
75706   };
75707
75708   // modules/services/nsi.js
75709   var import_vparse2 = __toESM(require_vparse());
75710   var _nsiStatus = "loading";
75711   var _nsi = {};
75712   var buildingPreset = {
75713     "building/commercial": true,
75714     "building/government": true,
75715     "building/hotel": true,
75716     "building/retail": true,
75717     "building/office": true,
75718     "building/supermarket": true,
75719     "building/yes": true
75720   };
75721   var notNames = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
75722   var notBranches = /(coop|express|wireless|factory|outlet)/i;
75723   function setNsiSources() {
75724     const nsiVersion = package_default.dependencies["name-suggestion-index"] || package_default.devDependencies["name-suggestion-index"];
75725     const v2 = (0, import_vparse2.default)(nsiVersion);
75726     const vMinor = "".concat(v2.major, ".").concat(v2.minor);
75727     const cdn = nsiCdnUrl.replace("{version}", vMinor);
75728     const sources = {
75729       "nsi_data": cdn + "dist/nsi.min.json",
75730       "nsi_dissolved": cdn + "dist/dissolved.min.json",
75731       "nsi_features": cdn + "dist/featureCollection.min.json",
75732       "nsi_generics": cdn + "dist/genericWords.min.json",
75733       "nsi_presets": cdn + "dist/presets/nsi-id-presets.min.json",
75734       "nsi_replacements": cdn + "dist/replacements.min.json",
75735       "nsi_trees": cdn + "dist/trees.min.json"
75736     };
75737     let fileMap = _mainFileFetcher.fileMap();
75738     for (const k2 in sources) {
75739       if (!fileMap[k2])
75740         fileMap[k2] = sources[k2];
75741     }
75742   }
75743   function loadNsiPresets() {
75744     return Promise.all([
75745       _mainFileFetcher.get("nsi_presets"),
75746       _mainFileFetcher.get("nsi_features")
75747     ]).then((vals) => {
75748       Object.values(vals[0].presets).forEach((preset) => preset.suggestion = true);
75749       _mainPresetIndex.merge({
75750         presets: vals[0].presets,
75751         featureCollection: vals[1]
75752       });
75753     });
75754   }
75755   function loadNsiData() {
75756     return Promise.all([
75757       _mainFileFetcher.get("nsi_data"),
75758       _mainFileFetcher.get("nsi_dissolved"),
75759       _mainFileFetcher.get("nsi_replacements"),
75760       _mainFileFetcher.get("nsi_trees")
75761     ]).then((vals) => {
75762       _nsi = {
75763         data: vals[0].nsi,
75764         // the raw name-suggestion-index data
75765         dissolved: vals[1].dissolved,
75766         // list of dissolved items
75767         replacements: vals[2].replacements,
75768         // trivial old->new qid replacements
75769         trees: vals[3].trees,
75770         // metadata about trees, main tags
75771         kvt: /* @__PURE__ */ new Map(),
75772         // Map (k -> Map (v -> t) )
75773         qids: /* @__PURE__ */ new Map(),
75774         // Map (wd/wp tag values -> qids)
75775         ids: /* @__PURE__ */ new Map()
75776         // Map (id -> NSI item)
75777       };
75778       const matcher = _nsi.matcher = new Matcher();
75779       matcher.buildMatchIndex(_nsi.data);
75780       matcher.itemLocation = /* @__PURE__ */ new Map();
75781       matcher.locationSets = /* @__PURE__ */ new Map();
75782       Object.keys(_nsi.data).forEach((tkv) => {
75783         const items = _nsi.data[tkv].items;
75784         if (!Array.isArray(items) || !items.length)
75785           return;
75786         items.forEach((item) => {
75787           if (matcher.itemLocation.has(item.id))
75788             return;
75789           const locationSetID = _sharedLocationManager.locationSetID(item.locationSet);
75790           matcher.itemLocation.set(item.id, locationSetID);
75791           if (matcher.locationSets.has(locationSetID))
75792             return;
75793           const fakeFeature = { id: locationSetID, properties: { id: locationSetID, area: 1 } };
75794           matcher.locationSets.set(locationSetID, fakeFeature);
75795         });
75796       });
75797       matcher.locationIndex = (bbox2) => {
75798         const validHere = _sharedLocationManager.locationSetsAt([bbox2[0], bbox2[1]]);
75799         const results = [];
75800         for (const [locationSetID, area] of Object.entries(validHere)) {
75801           const fakeFeature = matcher.locationSets.get(locationSetID);
75802           if (fakeFeature) {
75803             fakeFeature.properties.area = area;
75804             results.push(fakeFeature);
75805           }
75806         }
75807         return results;
75808       };
75809       Object.keys(_nsi.data).forEach((tkv) => {
75810         const category = _nsi.data[tkv];
75811         const parts = tkv.split("/", 3);
75812         const t2 = parts[0];
75813         const k2 = parts[1];
75814         const v2 = parts[2];
75815         let vmap = _nsi.kvt.get(k2);
75816         if (!vmap) {
75817           vmap = /* @__PURE__ */ new Map();
75818           _nsi.kvt.set(k2, vmap);
75819         }
75820         vmap.set(v2, t2);
75821         const tree = _nsi.trees[t2];
75822         const mainTag = tree.mainTag;
75823         const items = category.items || [];
75824         items.forEach((item) => {
75825           item.tkv = tkv;
75826           item.mainTag = mainTag;
75827           _nsi.ids.set(item.id, item);
75828           const wd = item.tags[mainTag];
75829           const wp = item.tags[mainTag.replace("wikidata", "wikipedia")];
75830           if (wd)
75831             _nsi.qids.set(wd, wd);
75832           if (wp && wd)
75833             _nsi.qids.set(wp, wd);
75834         });
75835       });
75836     });
75837   }
75838   function gatherKVs(tags) {
75839     let primary = /* @__PURE__ */ new Set();
75840     let alternate = /* @__PURE__ */ new Set();
75841     Object.keys(tags).forEach((osmkey) => {
75842       const osmvalue = tags[osmkey];
75843       if (!osmvalue)
75844         return;
75845       if (osmkey === "route_master")
75846         osmkey = "route";
75847       const vmap = _nsi.kvt.get(osmkey);
75848       if (!vmap)
75849         return;
75850       if (vmap.get(osmvalue)) {
75851         primary.add("".concat(osmkey, "/").concat(osmvalue));
75852       } else if (osmvalue === "yes") {
75853         alternate.add("".concat(osmkey, "/").concat(osmvalue));
75854       }
75855     });
75856     const preset = _mainPresetIndex.matchTags(tags, "area");
75857     if (buildingPreset[preset.id]) {
75858       alternate.add("building/yes");
75859     }
75860     return { primary, alternate };
75861   }
75862   function identifyTree(tags) {
75863     let unknown;
75864     let t2;
75865     Object.keys(tags).forEach((osmkey) => {
75866       if (t2)
75867         return;
75868       const osmvalue = tags[osmkey];
75869       if (!osmvalue)
75870         return;
75871       if (osmkey === "route_master")
75872         osmkey = "route";
75873       const vmap = _nsi.kvt.get(osmkey);
75874       if (!vmap)
75875         return;
75876       if (osmvalue === "yes") {
75877         unknown = "unknown";
75878       } else {
75879         t2 = vmap.get(osmvalue);
75880       }
75881     });
75882     return t2 || unknown || null;
75883   }
75884   function gatherNames(tags) {
75885     const empty2 = { primary: /* @__PURE__ */ new Set(), alternate: /* @__PURE__ */ new Set() };
75886     let primary = /* @__PURE__ */ new Set();
75887     let alternate = /* @__PURE__ */ new Set();
75888     let foundSemi = false;
75889     let testNameFragments = false;
75890     let patterns2;
75891     let t2 = identifyTree(tags);
75892     if (!t2)
75893       return empty2;
75894     if (t2 === "transit") {
75895       patterns2 = {
75896         primary: /^network$/i,
75897         alternate: /^(operator|operator:\w+|network:\w+|\w+_name|\w+_name:\w+)$/i
75898       };
75899     } else if (t2 === "flags") {
75900       patterns2 = {
75901         primary: /^(flag:name|flag:name:\w+)$/i,
75902         alternate: /^(flag|flag:\w+|subject|subject:\w+)$/i
75903         // note: no `country`, we special-case it below
75904       };
75905     } else if (t2 === "brands") {
75906       testNameFragments = true;
75907       patterns2 = {
75908         primary: /^(name|name:\w+)$/i,
75909         alternate: /^(brand|brand:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
75910       };
75911     } else if (t2 === "operators") {
75912       testNameFragments = true;
75913       patterns2 = {
75914         primary: /^(name|name:\w+|operator|operator:\w+)$/i,
75915         alternate: /^(brand|brand:\w+|\w+_name|\w+_name:\w+)/i
75916       };
75917     } else {
75918       testNameFragments = true;
75919       patterns2 = {
75920         primary: /^(name|name:\w+)$/i,
75921         alternate: /^(brand|brand:\w+|network|network:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
75922       };
75923     }
75924     if (tags.name && testNameFragments) {
75925       const nameParts = tags.name.split(/[\s\-\/,.]/);
75926       for (let split = nameParts.length; split > 0; split--) {
75927         const name = nameParts.slice(0, split).join(" ");
75928         primary.add(name);
75929       }
75930     }
75931     Object.keys(tags).forEach((osmkey) => {
75932       const osmvalue = tags[osmkey];
75933       if (!osmvalue)
75934         return;
75935       if (isNamelike(osmkey, "primary")) {
75936         if (/;/.test(osmvalue)) {
75937           foundSemi = true;
75938         } else {
75939           primary.add(osmvalue);
75940           alternate.delete(osmvalue);
75941         }
75942       } else if (!primary.has(osmvalue) && isNamelike(osmkey, "alternate")) {
75943         if (/;/.test(osmvalue)) {
75944           foundSemi = true;
75945         } else {
75946           alternate.add(osmvalue);
75947         }
75948       }
75949     });
75950     if (tags.man_made === "flagpole" && !primary.size && !alternate.size && !!tags.country) {
75951       const osmvalue = tags.country;
75952       if (/;/.test(osmvalue)) {
75953         foundSemi = true;
75954       } else {
75955         alternate.add(osmvalue);
75956       }
75957     }
75958     if (foundSemi) {
75959       return empty2;
75960     } else {
75961       return { primary, alternate };
75962     }
75963     function isNamelike(osmkey, which) {
75964       if (osmkey === "old_name")
75965         return false;
75966       return patterns2[which].test(osmkey) && !notNames.test(osmkey);
75967     }
75968   }
75969   function gatherTuples(tryKVs, tryNames) {
75970     let tuples = [];
75971     ["primary", "alternate"].forEach((whichName) => {
75972       const arr = Array.from(tryNames[whichName]).sort((a2, b2) => b2.length - a2.length);
75973       arr.forEach((n3) => {
75974         ["primary", "alternate"].forEach((whichKV) => {
75975           tryKVs[whichKV].forEach((kv) => {
75976             const parts = kv.split("/", 2);
75977             const k2 = parts[0];
75978             const v2 = parts[1];
75979             tuples.push({ k: k2, v: v2, n: n3 });
75980           });
75981         });
75982       });
75983     });
75984     return tuples;
75985   }
75986   function _upgradeTags(tags, loc) {
75987     let newTags = Object.assign({}, tags);
75988     let changed = false;
75989     Object.keys(newTags).forEach((osmkey) => {
75990       const matchTag = osmkey.match(/^(\w+:)?wikidata$/);
75991       if (matchTag) {
75992         const prefix = matchTag[1] || "";
75993         const wd = newTags[osmkey];
75994         const replace = _nsi.replacements[wd];
75995         if (replace && replace.wikidata !== void 0) {
75996           changed = true;
75997           if (replace.wikidata) {
75998             newTags[osmkey] = replace.wikidata;
75999           } else {
76000             delete newTags[osmkey];
76001           }
76002         }
76003         if (replace && replace.wikipedia !== void 0) {
76004           changed = true;
76005           const wpkey = "".concat(prefix, "wikipedia");
76006           if (replace.wikipedia) {
76007             newTags[wpkey] = replace.wikipedia;
76008           } else {
76009             delete newTags[wpkey];
76010           }
76011         }
76012       }
76013     });
76014     const isRouteMaster = tags.type === "route_master";
76015     const tryKVs = gatherKVs(tags);
76016     if (!tryKVs.primary.size && !tryKVs.alternate.size) {
76017       return changed ? { newTags, matched: null } : null;
76018     }
76019     const tryNames = gatherNames(tags);
76020     const foundQID = _nsi.qids.get(tags.wikidata) || _nsi.qids.get(tags.wikipedia);
76021     if (foundQID)
76022       tryNames.primary.add(foundQID);
76023     if (!tryNames.primary.size && !tryNames.alternate.size) {
76024       return changed ? { newTags, matched: null } : null;
76025     }
76026     const tuples = gatherTuples(tryKVs, tryNames);
76027     for (let i3 = 0; i3 < tuples.length; i3++) {
76028       const tuple = tuples[i3];
76029       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n, loc);
76030       if (!hits || !hits.length)
76031         continue;
76032       if (hits[0].match !== "primary" && hits[0].match !== "alternate")
76033         break;
76034       let itemID, item;
76035       for (let j3 = 0; j3 < hits.length; j3++) {
76036         const hit = hits[j3];
76037         itemID = hit.itemID;
76038         if (_nsi.dissolved[itemID])
76039           continue;
76040         item = _nsi.ids.get(itemID);
76041         if (!item)
76042           continue;
76043         const mainTag = item.mainTag;
76044         const itemQID = item.tags[mainTag];
76045         const notQID = newTags["not:".concat(mainTag)];
76046         if (
76047           // Exceptions, skip this hit
76048           !itemQID || itemQID === notQID || // No `*:wikidata` or matched a `not:*:wikidata`
76049           newTags.office && !item.tags.office
76050         ) {
76051           item = null;
76052           continue;
76053         } else {
76054           break;
76055         }
76056       }
76057       if (!item)
76058         continue;
76059       item = JSON.parse(JSON.stringify(item));
76060       const tkv = item.tkv;
76061       const parts = tkv.split("/", 3);
76062       const k2 = parts[1];
76063       const v2 = parts[2];
76064       const category = _nsi.data[tkv];
76065       const properties = category.properties || {};
76066       let preserveTags = item.preserveTags || properties.preserveTags || [];
76067       ["building", "emergency", "internet_access", "takeaway"].forEach((osmkey) => {
76068         if (k2 !== osmkey)
76069           preserveTags.push("^".concat(osmkey, "$"));
76070       });
76071       const regexes = preserveTags.map((s2) => new RegExp(s2, "i"));
76072       let keepTags = {};
76073       Object.keys(newTags).forEach((osmkey) => {
76074         if (regexes.some((regex) => regex.test(osmkey))) {
76075           keepTags[osmkey] = newTags[osmkey];
76076         }
76077       });
76078       _nsi.kvt.forEach((vmap, k3) => {
76079         if (newTags[k3] === "yes")
76080           delete newTags[k3];
76081       });
76082       if (foundQID) {
76083         delete newTags.wikipedia;
76084         delete newTags.wikidata;
76085       }
76086       Object.assign(newTags, item.tags, keepTags);
76087       if (isRouteMaster) {
76088         newTags.route_master = newTags.route;
76089         delete newTags.route;
76090       }
76091       const origName = tags.name;
76092       const newName = newTags.name;
76093       if (newName && origName && newName !== origName && !newTags.branch) {
76094         const newNames = gatherNames(newTags);
76095         const newSet = /* @__PURE__ */ new Set([...newNames.primary, ...newNames.alternate]);
76096         const isMoved = newSet.has(origName);
76097         if (!isMoved) {
76098           const nameParts = origName.split(/[\s\-\/,.]/);
76099           for (let split = nameParts.length; split > 0; split--) {
76100             const name = nameParts.slice(0, split).join(" ");
76101             const branch = nameParts.slice(split).join(" ");
76102             const nameHits = _nsi.matcher.match(k2, v2, name, loc);
76103             if (!nameHits || !nameHits.length)
76104               continue;
76105             if (nameHits.some((hit) => hit.itemID === itemID)) {
76106               if (branch) {
76107                 if (notBranches.test(branch)) {
76108                   newTags.name = origName;
76109                 } else {
76110                   const branchHits = _nsi.matcher.match(k2, v2, branch, loc);
76111                   if (branchHits && branchHits.length) {
76112                     if (branchHits[0].match === "primary" || branchHits[0].match === "alternate") {
76113                       return null;
76114                     }
76115                   } else {
76116                     newTags.branch = branch;
76117                   }
76118                 }
76119               }
76120               break;
76121             }
76122           }
76123         }
76124       }
76125       return { newTags, matched: item };
76126     }
76127     return changed ? { newTags, matched: null } : null;
76128   }
76129   function _isGenericName(tags) {
76130     const n3 = tags.name;
76131     if (!n3)
76132       return false;
76133     const tryNames = { primary: /* @__PURE__ */ new Set([n3]), alternate: /* @__PURE__ */ new Set() };
76134     const tryKVs = gatherKVs(tags);
76135     if (!tryKVs.primary.size && !tryKVs.alternate.size)
76136       return false;
76137     const tuples = gatherTuples(tryKVs, tryNames);
76138     for (let i3 = 0; i3 < tuples.length; i3++) {
76139       const tuple = tuples[i3];
76140       const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n);
76141       if (hits && hits.length && hits[0].match === "excludeGeneric")
76142         return true;
76143     }
76144     return false;
76145   }
76146   var nsi_default = {
76147     // `init()`
76148     // On init, start preparing the name-suggestion-index
76149     //
76150     init: () => {
76151       setNsiSources();
76152       _mainPresetIndex.ensureLoaded().then(() => loadNsiPresets()).then(() => loadNsiData()).then(() => _nsiStatus = "ok").catch(() => _nsiStatus = "failed");
76153     },
76154     // `reset()`
76155     // Reset is called when user saves data to OSM (does nothing here)
76156     //
76157     reset: () => {
76158     },
76159     // `status()`
76160     // To let other code know how it's going...
76161     //
76162     // Returns
76163     //   `String`: 'loading', 'ok', 'failed'
76164     //
76165     status: () => _nsiStatus,
76166     // `isGenericName()`
76167     // Is the `name` tag generic?
76168     //
76169     // Arguments
76170     //   `tags`: `Object` containing the feature's OSM tags
76171     // Returns
76172     //   `true` if it is generic, `false` if not
76173     //
76174     isGenericName: (tags) => _isGenericName(tags),
76175     // `upgradeTags()`
76176     // Suggest tag upgrades.
76177     // This function will not modify the input tags, it makes a copy.
76178     //
76179     // Arguments
76180     //   `tags`: `Object` containing the feature's OSM tags
76181     //   `loc`: Location where this feature exists, as a [lon, lat]
76182     // Returns
76183     //   `Object` containing the result, or `null` if no changes needed:
76184     //   {
76185     //     'newTags': `Object` - The tags the the feature should have
76186     //     'matched': `Object` - The matched item
76187     //   }
76188     //
76189     upgradeTags: (tags, loc) => _upgradeTags(tags, loc),
76190     // `cache()`
76191     // Direct access to the NSI cache, useful for testing or breaking things
76192     //
76193     // Returns
76194     //   `Object`: the internal NSI cache
76195     //
76196     cache: () => _nsi
76197   };
76198
76199   // modules/services/kartaview.js
76200   var import_rbush8 = __toESM(require_rbush_min());
76201   var apibase2 = "https://kartaview.org";
76202   var maxResults = 1e3;
76203   var tileZoom = 14;
76204   var tiler4 = utilTiler().zoomExtent([tileZoom, tileZoom]).skipNullIsland(true);
76205   var dispatch7 = dispatch_default("loadedImages");
76206   var imgZoom2 = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
76207   var _oscCache;
76208   var _oscSelectedImage;
76209   var _loadViewerPromise2;
76210   function abortRequest4(controller) {
76211     controller.abort();
76212   }
76213   function maxPageAtZoom(z2) {
76214     if (z2 < 15)
76215       return 2;
76216     if (z2 === 15)
76217       return 5;
76218     if (z2 === 16)
76219       return 10;
76220     if (z2 === 17)
76221       return 20;
76222     if (z2 === 18)
76223       return 40;
76224     if (z2 > 18)
76225       return 80;
76226   }
76227   function loadTiles2(which, url, projection2) {
76228     var currZoom = Math.floor(geoScaleToZoom(projection2.scale()));
76229     var tiles = tiler4.getTiles(projection2);
76230     var cache = _oscCache[which];
76231     Object.keys(cache.inflight).forEach(function(k2) {
76232       var wanted = tiles.find(function(tile) {
76233         return k2.indexOf(tile.id + ",") === 0;
76234       });
76235       if (!wanted) {
76236         abortRequest4(cache.inflight[k2]);
76237         delete cache.inflight[k2];
76238       }
76239     });
76240     tiles.forEach(function(tile) {
76241       loadNextTilePage(which, currZoom, url, tile);
76242     });
76243   }
76244   function loadNextTilePage(which, currZoom, url, tile) {
76245     var cache = _oscCache[which];
76246     var bbox2 = tile.extent.bbox();
76247     var maxPages = maxPageAtZoom(currZoom);
76248     var nextPage = cache.nextPage[tile.id] || 1;
76249     var params = utilQsString({
76250       ipp: maxResults,
76251       page: nextPage,
76252       // client_id: clientId,
76253       bbTopLeft: [bbox2.maxY, bbox2.minX].join(","),
76254       bbBottomRight: [bbox2.minY, bbox2.maxX].join(",")
76255     }, true);
76256     if (nextPage > maxPages)
76257       return;
76258     var id2 = tile.id + "," + String(nextPage);
76259     if (cache.loaded[id2] || cache.inflight[id2])
76260       return;
76261     var controller = new AbortController();
76262     cache.inflight[id2] = controller;
76263     var options2 = {
76264       method: "POST",
76265       signal: controller.signal,
76266       body: params,
76267       headers: { "Content-Type": "application/x-www-form-urlencoded" }
76268     };
76269     json_default(url, options2).then(function(data) {
76270       cache.loaded[id2] = true;
76271       delete cache.inflight[id2];
76272       if (!data || !data.currentPageItems || !data.currentPageItems.length) {
76273         throw new Error("No Data");
76274       }
76275       var features = data.currentPageItems.map(function(item) {
76276         var loc = [+item.lng, +item.lat];
76277         var d2;
76278         if (which === "images") {
76279           d2 = {
76280             loc,
76281             key: item.id,
76282             ca: +item.heading,
76283             captured_at: item.shot_date || item.date_added,
76284             captured_by: item.username,
76285             imagePath: item.lth_name,
76286             sequence_id: item.sequence_id,
76287             sequence_index: +item.sequence_index
76288           };
76289           var seq = _oscCache.sequences[d2.sequence_id];
76290           if (!seq) {
76291             seq = { rotation: 0, images: [] };
76292             _oscCache.sequences[d2.sequence_id] = seq;
76293           }
76294           seq.images[d2.sequence_index] = d2;
76295           _oscCache.images.forImageKey[d2.key] = d2;
76296         }
76297         return {
76298           minX: loc[0],
76299           minY: loc[1],
76300           maxX: loc[0],
76301           maxY: loc[1],
76302           data: d2
76303         };
76304       });
76305       cache.rtree.load(features);
76306       if (data.currentPageItems.length === maxResults) {
76307         cache.nextPage[tile.id] = nextPage + 1;
76308         loadNextTilePage(which, currZoom, url, tile);
76309       } else {
76310         cache.nextPage[tile.id] = Infinity;
76311       }
76312       if (which === "images") {
76313         dispatch7.call("loadedImages");
76314       }
76315     }).catch(function() {
76316       cache.loaded[id2] = true;
76317       delete cache.inflight[id2];
76318     });
76319   }
76320   function partitionViewport2(projection2) {
76321     var z2 = geoScaleToZoom(projection2.scale());
76322     var z22 = Math.ceil(z2 * 2) / 2 + 2.5;
76323     var tiler9 = utilTiler().zoomExtent([z22, z22]);
76324     return tiler9.getTiles(projection2).map(function(tile) {
76325       return tile.extent;
76326     });
76327   }
76328   function searchLimited2(limit, projection2, rtree) {
76329     limit = limit || 5;
76330     return partitionViewport2(projection2).reduce(function(result, extent) {
76331       var found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
76332         return d2.data;
76333       });
76334       return found.length ? result.concat(found) : result;
76335     }, []);
76336   }
76337   var kartaview_default = {
76338     init: function() {
76339       if (!_oscCache) {
76340         this.reset();
76341       }
76342       this.event = utilRebind(this, dispatch7, "on");
76343     },
76344     reset: function() {
76345       if (_oscCache) {
76346         Object.values(_oscCache.images.inflight).forEach(abortRequest4);
76347       }
76348       _oscCache = {
76349         images: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush8.default(), forImageKey: {} },
76350         sequences: {}
76351       };
76352       _oscSelectedImage = null;
76353     },
76354     images: function(projection2) {
76355       var limit = 5;
76356       return searchLimited2(limit, projection2, _oscCache.images.rtree);
76357     },
76358     sequences: function(projection2) {
76359       var viewport = projection2.clipExtent();
76360       var min3 = [viewport[0][0], viewport[1][1]];
76361       var max3 = [viewport[1][0], viewport[0][1]];
76362       var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
76363       var sequenceKeys = {};
76364       _oscCache.images.rtree.search(bbox2).forEach(function(d2) {
76365         sequenceKeys[d2.data.sequence_id] = true;
76366       });
76367       var lineStrings = [];
76368       Object.keys(sequenceKeys).forEach(function(sequenceKey) {
76369         var seq = _oscCache.sequences[sequenceKey];
76370         var images = seq && seq.images;
76371         if (images) {
76372           lineStrings.push({
76373             type: "LineString",
76374             coordinates: images.map(function(d2) {
76375               return d2.loc;
76376             }).filter(Boolean),
76377             properties: {
76378               captured_at: images[0] ? images[0].captured_at : null,
76379               captured_by: images[0] ? images[0].captured_by : null,
76380               key: sequenceKey
76381             }
76382           });
76383         }
76384       });
76385       return lineStrings;
76386     },
76387     cachedImage: function(imageKey) {
76388       return _oscCache.images.forImageKey[imageKey];
76389     },
76390     loadImages: function(projection2) {
76391       var url = apibase2 + "/1.0/list/nearby-photos/";
76392       loadTiles2("images", url, projection2);
76393     },
76394     ensureViewerLoaded: function(context) {
76395       if (_loadViewerPromise2)
76396         return _loadViewerPromise2;
76397       var wrap2 = context.container().select(".photoviewer").selectAll(".kartaview-wrapper").data([0]);
76398       var that = this;
76399       var wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper kartaview-wrapper").classed("hide", true).call(imgZoom2.on("zoom", zoomPan2)).on("dblclick.zoom", null);
76400       wrapEnter.append("div").attr("class", "photo-attribution fillD");
76401       var controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
76402       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
76403       controlsEnter.append("button").on("click.rotate-ccw", rotate(-90)).text("\u293F");
76404       controlsEnter.append("button").on("click.rotate-cw", rotate(90)).text("\u293E");
76405       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
76406       wrapEnter.append("div").attr("class", "kartaview-image-wrap");
76407       context.ui().photoviewer.on("resize.kartaview", function(dimensions) {
76408         imgZoom2.extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]);
76409       });
76410       function zoomPan2(d3_event) {
76411         var t2 = d3_event.transform;
76412         context.container().select(".photoviewer .kartaview-image-wrap").call(utilSetTransform, t2.x, t2.y, t2.k);
76413       }
76414       function rotate(deg) {
76415         return function() {
76416           if (!_oscSelectedImage)
76417             return;
76418           var sequenceKey = _oscSelectedImage.sequence_id;
76419           var sequence = _oscCache.sequences[sequenceKey];
76420           if (!sequence)
76421             return;
76422           var r2 = sequence.rotation || 0;
76423           r2 += deg;
76424           if (r2 > 180)
76425             r2 -= 360;
76426           if (r2 < -180)
76427             r2 += 360;
76428           sequence.rotation = r2;
76429           var wrap3 = context.container().select(".photoviewer .kartaview-wrapper");
76430           wrap3.transition().duration(100).call(imgZoom2.transform, identity2);
76431           wrap3.selectAll(".kartaview-image").transition().duration(100).style("transform", "rotate(" + r2 + "deg)");
76432         };
76433       }
76434       function step(stepBy) {
76435         return function() {
76436           if (!_oscSelectedImage)
76437             return;
76438           var sequenceKey = _oscSelectedImage.sequence_id;
76439           var sequence = _oscCache.sequences[sequenceKey];
76440           if (!sequence)
76441             return;
76442           var nextIndex = _oscSelectedImage.sequence_index + stepBy;
76443           var nextImage = sequence.images[nextIndex];
76444           if (!nextImage)
76445             return;
76446           context.map().centerEase(nextImage.loc);
76447           that.selectImage(context, nextImage.key);
76448         };
76449       }
76450       _loadViewerPromise2 = Promise.resolve();
76451       return _loadViewerPromise2;
76452     },
76453     showViewer: function(context) {
76454       var viewer = context.container().select(".photoviewer").classed("hide", false);
76455       var isHidden = viewer.selectAll(".photo-wrapper.kartaview-wrapper.hide").size();
76456       if (isHidden) {
76457         viewer.selectAll(".photo-wrapper:not(.kartaview-wrapper)").classed("hide", true);
76458         viewer.selectAll(".photo-wrapper.kartaview-wrapper").classed("hide", false);
76459       }
76460       return this;
76461     },
76462     hideViewer: function(context) {
76463       _oscSelectedImage = null;
76464       this.updateUrlImage(null);
76465       var viewer = context.container().select(".photoviewer");
76466       if (!viewer.empty())
76467         viewer.datum(null);
76468       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
76469       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
76470       return this.setStyles(context, null, true);
76471     },
76472     selectImage: function(context, imageKey) {
76473       var d2 = this.cachedImage(imageKey);
76474       _oscSelectedImage = d2;
76475       this.updateUrlImage(imageKey);
76476       var viewer = context.container().select(".photoviewer");
76477       if (!viewer.empty())
76478         viewer.datum(d2);
76479       this.setStyles(context, null, true);
76480       context.container().selectAll(".icon-sign").classed("currentView", false);
76481       if (!d2)
76482         return this;
76483       var wrap2 = context.container().select(".photoviewer .kartaview-wrapper");
76484       var imageWrap = wrap2.selectAll(".kartaview-image-wrap");
76485       var attribution = wrap2.selectAll(".photo-attribution").text("");
76486       wrap2.transition().duration(100).call(imgZoom2.transform, identity2);
76487       imageWrap.selectAll(".kartaview-image").remove();
76488       if (d2) {
76489         var sequence = _oscCache.sequences[d2.sequence_id];
76490         var r2 = sequence && sequence.rotation || 0;
76491         imageWrap.append("img").attr("class", "kartaview-image").attr("src", apibase2 + "/" + d2.imagePath).style("transform", "rotate(" + r2 + "deg)");
76492         if (d2.captured_by) {
76493           attribution.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://kartaview.org/user/" + encodeURIComponent(d2.captured_by)).text("@" + d2.captured_by);
76494           attribution.append("span").text("|");
76495         }
76496         if (d2.captured_at) {
76497           attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.captured_at));
76498           attribution.append("span").text("|");
76499         }
76500         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");
76501       }
76502       return this;
76503       function localeDateString2(s2) {
76504         if (!s2)
76505           return null;
76506         var options2 = { day: "numeric", month: "short", year: "numeric" };
76507         var d4 = new Date(s2);
76508         if (isNaN(d4.getTime()))
76509           return null;
76510         return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
76511       }
76512     },
76513     getSelectedImage: function() {
76514       return _oscSelectedImage;
76515     },
76516     getSequenceKeyForImage: function(d2) {
76517       return d2 && d2.sequence_id;
76518     },
76519     // Updates the currently highlighted sequence and selected bubble.
76520     // Reset is only necessary when interacting with the viewport because
76521     // this implicitly changes the currently selected bubble/sequence
76522     setStyles: function(context, hovered, reset) {
76523       if (reset) {
76524         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
76525         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
76526       }
76527       var hoveredImageKey = hovered && hovered.key;
76528       var hoveredSequenceKey = this.getSequenceKeyForImage(hovered);
76529       var hoveredSequence = hoveredSequenceKey && _oscCache.sequences[hoveredSequenceKey];
76530       var hoveredImageKeys = hoveredSequence && hoveredSequence.images.map(function(d2) {
76531         return d2.key;
76532       }) || [];
76533       var viewer = context.container().select(".photoviewer");
76534       var selected = viewer.empty() ? void 0 : viewer.datum();
76535       var selectedImageKey = selected && selected.key;
76536       var selectedSequenceKey = this.getSequenceKeyForImage(selected);
76537       var selectedSequence = selectedSequenceKey && _oscCache.sequences[selectedSequenceKey];
76538       var selectedImageKeys = selectedSequence && selectedSequence.images.map(function(d2) {
76539         return d2.key;
76540       }) || [];
76541       var highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
76542       context.container().selectAll(".layer-kartaview .viewfield-group").classed("highlighted", function(d2) {
76543         return highlightedImageKeys.indexOf(d2.key) !== -1;
76544       }).classed("hovered", function(d2) {
76545         return d2.key === hoveredImageKey;
76546       }).classed("currentView", function(d2) {
76547         return d2.key === selectedImageKey;
76548       });
76549       context.container().selectAll(".layer-kartaview .sequence").classed("highlighted", function(d2) {
76550         return d2.properties.key === hoveredSequenceKey;
76551       }).classed("currentView", function(d2) {
76552         return d2.properties.key === selectedSequenceKey;
76553       });
76554       context.container().selectAll(".layer-kartaview .viewfield-group .viewfield").attr("d", viewfieldPath);
76555       function viewfieldPath() {
76556         var d2 = this.parentNode.__data__;
76557         if (d2.pano && d2.key !== selectedImageKey) {
76558           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
76559         } else {
76560           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
76561         }
76562       }
76563       return this;
76564     },
76565     updateUrlImage: function(imageKey) {
76566       if (!window.mocha) {
76567         var hash = utilStringQs(window.location.hash);
76568         if (imageKey) {
76569           hash.photo = "kartaview/" + imageKey;
76570         } else {
76571           delete hash.photo;
76572         }
76573         window.location.replace("#" + utilQsString(hash, true));
76574       }
76575     },
76576     cache: function() {
76577       return _oscCache;
76578     }
76579   };
76580
76581   // modules/services/vegbilder.js
76582   var import_rbush9 = __toESM(require_rbush_min());
76583
76584   // modules/services/pannellum_photo.js
76585   var pannellumViewerCSS = "pannellum/pannellum.css";
76586   var pannellumViewerJS = "pannellum/pannellum.js";
76587   var dispatch8 = dispatch_default("viewerChanged");
76588   var _currScenes = [];
76589   var _pannellumViewer;
76590   var pannellum_photo_default = {
76591     init: async function(context, selection2) {
76592       selection2.append("div").attr("class", "photo-frame pannellum-frame").attr("id", "ideditor-pannellum-viewer").classed("hide", true);
76593       if (!window.pannellum) {
76594         await this.loadPannellum(context);
76595       }
76596       const options2 = {
76597         "default": { firstScene: "" },
76598         scenes: {}
76599       };
76600       _pannellumViewer = window.pannellum.viewer("ideditor-pannellum-viewer", options2);
76601       _pannellumViewer.on("mousedown", () => {
76602         select_default2(window).on("pointermove.pannellum mousemove.pannellum", () => {
76603           dispatch8.call("viewerChanged");
76604         });
76605       }).on("mouseup", () => {
76606         select_default2(window).on("pointermove.pannellum mousemove.pannellum", null);
76607       }).on("animatefinished", () => {
76608         dispatch8.call("viewerChanged");
76609       });
76610       context.ui().photoviewer.on("resize.pannellum", () => {
76611         _pannellumViewer.resize();
76612       });
76613       this.event = utilRebind(this, dispatch8, "on");
76614       return this;
76615     },
76616     loadPannellum: function(context) {
76617       const head = select_default2("head");
76618       return Promise.all([
76619         new Promise((resolve, reject) => {
76620           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);
76621         }),
76622         new Promise((resolve, reject) => {
76623           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);
76624         })
76625       ]);
76626     },
76627     showPhotoFrame: function(context) {
76628       const isHidden = context.selectAll(".photo-frame.pannellum-frame.hide").size();
76629       if (isHidden) {
76630         context.selectAll(".photo-frame:not(.pannellum-frame)").classed("hide", true);
76631         context.selectAll(".photo-frame.pannellum-frame").classed("hide", false);
76632       }
76633       return this;
76634     },
76635     hidePhotoFrame: function(viewerContext) {
76636       viewerContext.select("photo-frame.pannellum-frame").classed("hide", false);
76637       return this;
76638     },
76639     selectPhoto: function(data, keepOrientation) {
76640       const { key } = data;
76641       if (!(key in _currScenes)) {
76642         let newSceneOptions = {
76643           showFullscreenCtrl: false,
76644           autoLoad: false,
76645           compass: true,
76646           yaw: 0,
76647           type: "equirectangular",
76648           preview: data.preview_path,
76649           panorama: data.image_path,
76650           northOffset: data.ca
76651         };
76652         _currScenes.push(key);
76653         _pannellumViewer.addScene(key, newSceneOptions);
76654       }
76655       let yaw = 0;
76656       let pitch = 0;
76657       if (keepOrientation) {
76658         yaw = this.getYaw();
76659         pitch = _pannellumViewer.getPitch();
76660       }
76661       _pannellumViewer.loadScene(key, pitch, yaw);
76662       dispatch8.call("viewerChanged");
76663       if (_currScenes.length > 3) {
76664         const old_key = _currScenes.shift();
76665         _pannellumViewer.removeScene(old_key);
76666       }
76667       return this;
76668     },
76669     getYaw: function() {
76670       return _pannellumViewer.getYaw();
76671     }
76672   };
76673
76674   // modules/services/vegbilder.js
76675   var owsEndpoint = "https://www.vegvesen.no/kart/ogc/vegbilder_1_0/ows?";
76676   var tileZoom2 = 14;
76677   var tiler5 = utilTiler().zoomExtent([tileZoom2, tileZoom2]).skipNullIsland(true);
76678   var dispatch9 = dispatch_default("loadedImages", "viewerChanged");
76679   var directionEnum = Object.freeze({
76680     forward: Symbol(0),
76681     backward: Symbol(1)
76682   });
76683   var _planeFrame;
76684   var _pannellumFrame;
76685   var _currentFrame;
76686   var _loadViewerPromise3;
76687   var _vegbilderCache;
76688   async function fetchAvailableLayers() {
76689     var _a, _b, _c;
76690     const params = {
76691       service: "WFS",
76692       request: "GetCapabilities",
76693       version: "2.0.0"
76694     };
76695     const urlForRequest = owsEndpoint + utilQsString(params);
76696     const response = await xml_default(urlForRequest);
76697     const xPathSelector = "/wfs:WFS_Capabilities/wfs:FeatureTypeList/wfs:FeatureType/wfs:Name";
76698     const regexMatcher = new RegExp("^vegbilder_1_0:Vegbilder(?<image_type>_360)?_(?<year>\\d{4})$");
76699     const NSResolver = response.createNSResolver(response);
76700     const l2 = response.evaluate(
76701       xPathSelector,
76702       response,
76703       NSResolver,
76704       XPathResult.ANY_TYPE
76705     );
76706     let node;
76707     const availableLayers = [];
76708     while ((node = l2.iterateNext()) !== null) {
76709       const match = (_a = node.textContent) == null ? void 0 : _a.match(regexMatcher);
76710       if (match) {
76711         availableLayers.push({
76712           name: match[0],
76713           is_sphere: !!((_b = match.groups) == null ? void 0 : _b.image_type),
76714           year: parseInt((_c = match.groups) == null ? void 0 : _c.year, 10)
76715         });
76716       }
76717     }
76718     return availableLayers;
76719   }
76720   function filterAvailableLayers(photoContex) {
76721     const fromDateString = photoContex.fromDate();
76722     const toDateString = photoContex.toDate();
76723     const fromYear = fromDateString ? new Date(fromDateString).getFullYear() : 2016;
76724     const toYear = toDateString ? new Date(toDateString).getFullYear() : null;
76725     const showsFlat = photoContex.showsFlat();
76726     const showsPano = photoContex.showsPanoramic();
76727     return Array.from(_vegbilderCache.wfslayers.values()).filter(({ layerInfo }) => layerInfo.year >= fromYear && (!toYear || layerInfo.year <= toYear) && (!layerInfo.is_sphere && showsFlat || layerInfo.is_sphere && showsPano));
76728   }
76729   function loadWFSLayers(projection2, margin, wfslayers) {
76730     const tiles = tiler5.margin(margin).getTiles(projection2);
76731     for (const cache of wfslayers) {
76732       loadWFSLayer(projection2, cache, tiles);
76733     }
76734   }
76735   function loadWFSLayer(projection2, cache, tiles) {
76736     for (const [key, controller] of cache.inflight.entries()) {
76737       const wanted = tiles.some((tile) => key === tile.id);
76738       if (!wanted) {
76739         controller.abort();
76740         cache.inflight.delete(key);
76741       }
76742     }
76743     Promise.all(tiles.map(
76744       (tile) => loadTile2(cache, cache.layerInfo.name, tile)
76745     )).then(() => orderSequences(projection2, cache));
76746   }
76747   async function loadTile2(cache, typename, tile) {
76748     const bbox2 = tile.extent.bbox();
76749     const tileid = tile.id;
76750     if (cache.loaded.get(tileid) === true || cache.inflight.has(tileid))
76751       return;
76752     const params = {
76753       service: "WFS",
76754       request: "GetFeature",
76755       version: "2.0.0",
76756       typenames: typename,
76757       bbox: [bbox2.minY, bbox2.minX, bbox2.maxY, bbox2.maxX].join(","),
76758       outputFormat: "json"
76759     };
76760     const controller = new AbortController();
76761     cache.inflight.set(tileid, controller);
76762     const options2 = {
76763       method: "GET",
76764       signal: controller.signal
76765     };
76766     const urlForRequest = owsEndpoint + utilQsString(params);
76767     let featureCollection;
76768     try {
76769       featureCollection = await json_default(urlForRequest, options2);
76770     } catch (e3) {
76771       cache.loaded.set(tileid, false);
76772       return;
76773     } finally {
76774       cache.inflight.delete(tileid);
76775     }
76776     cache.loaded.set(tileid, true);
76777     if (featureCollection.features.length === 0) {
76778       return;
76779     }
76780     const features = featureCollection.features.map((feature3) => {
76781       const loc = feature3.geometry.coordinates;
76782       const key = feature3.id;
76783       const properties = feature3.properties;
76784       const {
76785         RETNING: ca,
76786         TIDSPUNKT: captured_at,
76787         URL: image_path,
76788         URLPREVIEW: preview_path,
76789         BILDETYPE: image_type,
76790         METER: metering,
76791         FELTKODE: lane_code
76792       } = properties;
76793       const lane_number = parseInt(lane_code.match(/^[0-9]+/)[0], 10);
76794       const direction = lane_number % 2 === 0 ? directionEnum.backward : directionEnum.forward;
76795       const data = {
76796         loc,
76797         key,
76798         ca,
76799         image_path,
76800         preview_path,
76801         road_reference: roadReference(properties),
76802         metering,
76803         lane_code,
76804         direction,
76805         captured_at: new Date(captured_at),
76806         is_sphere: image_type === "360"
76807       };
76808       cache.points.set(key, data);
76809       return {
76810         minX: loc[0],
76811         minY: loc[1],
76812         maxX: loc[0],
76813         maxY: loc[1],
76814         data
76815       };
76816     });
76817     _vegbilderCache.rtree.load(features);
76818     dispatch9.call("loadedImages");
76819   }
76820   function orderSequences(projection2, cache) {
76821     const { points } = cache;
76822     const grouped = Array.from(points.values()).reduce((grouped2, image) => {
76823       const key = image.road_reference;
76824       if (grouped2.has(key)) {
76825         grouped2.get(key).push(image);
76826       } else {
76827         grouped2.set(key, [image]);
76828       }
76829       return grouped2;
76830     }, /* @__PURE__ */ new Map());
76831     const imageSequences = Array.from(grouped.values()).reduce((imageSequences2, imageGroup) => {
76832       imageGroup.sort((a2, b2) => {
76833         if (a2.captured_at.valueOf() > b2.captured_at.valueOf()) {
76834           return 1;
76835         } else if (a2.captured_at.valueOf() < b2.captured_at.valueOf()) {
76836           return -1;
76837         } else {
76838           const { direction } = a2;
76839           if (direction === directionEnum.forward) {
76840             return a2.metering - b2.metering;
76841           } else {
76842             return b2.metering - a2.metering;
76843           }
76844         }
76845       });
76846       let imageSequence = [imageGroup[0]];
76847       let angle2 = null;
76848       for (const [lastImage, image] of pairs(imageGroup)) {
76849         if (lastImage.ca === null) {
76850           const b2 = projection2(lastImage.loc);
76851           const a2 = projection2(image.loc);
76852           if (!geoVecEqual(a2, b2)) {
76853             angle2 = geoVecAngle(a2, b2);
76854             angle2 *= 180 / Math.PI;
76855             angle2 -= 90;
76856             angle2 = angle2 >= 0 ? angle2 : angle2 + 360;
76857           }
76858           lastImage.ca = angle2;
76859         }
76860         if (image.direction === lastImage.direction && image.captured_at.valueOf() - lastImage.captured_at.valueOf() <= 2e4) {
76861           imageSequence.push(image);
76862         } else {
76863           imageSequences2.push(imageSequence);
76864           imageSequence = [image];
76865         }
76866       }
76867       imageSequences2.push(imageSequence);
76868       return imageSequences2;
76869     }, []);
76870     cache.sequences = imageSequences.map((images) => {
76871       const sequence = {
76872         images,
76873         key: images[0].key,
76874         geometry: {
76875           type: "LineString",
76876           coordinates: images.map((image) => image.loc)
76877         }
76878       };
76879       for (const image of images) {
76880         _vegbilderCache.image2sequence_map.set(image.key, sequence);
76881       }
76882       return sequence;
76883     });
76884   }
76885   function roadReference(properties) {
76886     const {
76887       FYLKENUMMER: county_number,
76888       VEGKATEGORI: road_class,
76889       VEGSTATUS: road_status,
76890       VEGNUMMER: road_number,
76891       STREKNING: section,
76892       DELSTREKNING: subsection,
76893       HP: parcel,
76894       KRYSSDEL: junction_part,
76895       SIDEANLEGGSDEL: services_part,
76896       ANKERPUNKT: anker_point,
76897       AAR: year
76898     } = properties;
76899     let reference;
76900     if (year >= 2020) {
76901       reference = "".concat(road_class).concat(road_status).concat(road_number, " S").concat(section, "D").concat(subsection);
76902       if (junction_part) {
76903         reference = "".concat(reference, " M").concat(anker_point, " KD").concat(junction_part);
76904       } else if (services_part) {
76905         reference = "".concat(reference, " M").concat(anker_point, " SD").concat(services_part);
76906       }
76907     } else {
76908       reference = "".concat(county_number).concat(road_class).concat(road_status).concat(road_number, " HP").concat(parcel);
76909     }
76910     return reference;
76911   }
76912   function localeTimestamp(date) {
76913     const options2 = {
76914       day: "2-digit",
76915       month: "2-digit",
76916       year: "numeric",
76917       hour: "numeric",
76918       minute: "numeric",
76919       second: "numeric"
76920     };
76921     return date.toLocaleString(_mainLocalizer.localeCode(), options2);
76922   }
76923   function partitionViewport3(projection2) {
76924     const zoom = geoScaleToZoom(projection2.scale());
76925     const roundZoom = Math.ceil(zoom * 2) / 2 + 2.5;
76926     const tiler9 = utilTiler().zoomExtent([roundZoom, roundZoom]);
76927     return tiler9.getTiles(projection2).map((tile) => tile.extent);
76928   }
76929   function searchLimited3(limit, projection2, rtree) {
76930     limit != null ? limit : limit = 5;
76931     return partitionViewport3(projection2).reduce((result, extent) => {
76932       const found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
76933       return result.concat(found);
76934     }, []);
76935   }
76936   var vegbilder_default = {
76937     init: function() {
76938       this.event = utilRebind(this, dispatch9, "on");
76939     },
76940     reset: async function() {
76941       if (_vegbilderCache) {
76942         for (const layer of _vegbilderCache.wfslayers.values()) {
76943           for (const controller of layer.inflight.values()) {
76944             controller.abort();
76945           }
76946         }
76947       }
76948       _vegbilderCache = {
76949         wfslayers: /* @__PURE__ */ new Map(),
76950         rtree: new import_rbush9.default(),
76951         image2sequence_map: /* @__PURE__ */ new Map()
76952       };
76953       const availableLayers = await fetchAvailableLayers();
76954       const { wfslayers } = _vegbilderCache;
76955       for (const layerInfo of availableLayers) {
76956         const cache = {
76957           layerInfo,
76958           loaded: /* @__PURE__ */ new Map(),
76959           inflight: /* @__PURE__ */ new Map(),
76960           points: /* @__PURE__ */ new Map(),
76961           sequences: []
76962         };
76963         wfslayers.set(layerInfo.name, cache);
76964       }
76965     },
76966     images: function(projection2) {
76967       const limit = 5;
76968       return searchLimited3(limit, projection2, _vegbilderCache.rtree);
76969     },
76970     sequences: function(projection2) {
76971       const viewport = projection2.clipExtent();
76972       const min3 = [viewport[0][0], viewport[1][1]];
76973       const max3 = [viewport[1][0], viewport[0][1]];
76974       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
76975       const seen = /* @__PURE__ */ new Set();
76976       const line_strings = [];
76977       for (const { data } of _vegbilderCache.rtree.search(bbox2)) {
76978         const sequence = _vegbilderCache.image2sequence_map.get(data.key);
76979         if (!sequence)
76980           continue;
76981         const { key, geometry, images } = sequence;
76982         if (seen.has(key))
76983           continue;
76984         seen.add(key);
76985         const line = {
76986           type: "LineString",
76987           coordinates: geometry.coordinates,
76988           key,
76989           images
76990         };
76991         line_strings.push(line);
76992       }
76993       return line_strings;
76994     },
76995     cachedImage: function(key) {
76996       for (const { points } of _vegbilderCache.wfslayers.values()) {
76997         if (points.has(key))
76998           return points.get(key);
76999       }
77000     },
77001     getSequenceForImage: function(image) {
77002       return _vegbilderCache == null ? void 0 : _vegbilderCache.image2sequence_map.get(image == null ? void 0 : image.key);
77003     },
77004     loadImages: async function(context, margin) {
77005       if (!_vegbilderCache) {
77006         await this.reset();
77007       }
77008       margin != null ? margin : margin = 1;
77009       const wfslayers = filterAvailableLayers(context.photos());
77010       loadWFSLayers(context.projection, margin, wfslayers);
77011     },
77012     photoFrame: function() {
77013       return _currentFrame;
77014     },
77015     ensureViewerLoaded: function(context) {
77016       if (_loadViewerPromise3)
77017         return _loadViewerPromise3;
77018       const step = (stepBy) => () => {
77019         const viewer = context.container().select(".photoviewer");
77020         const selected = viewer.empty() ? void 0 : viewer.datum();
77021         if (!selected)
77022           return;
77023         const sequence = this.getSequenceForImage(selected);
77024         const nextIndex = sequence.images.indexOf(selected) + stepBy;
77025         const nextImage = sequence.images[nextIndex];
77026         if (!nextImage)
77027           return;
77028         context.map().centerEase(nextImage.loc);
77029         this.selectImage(context, nextImage.key, true);
77030       };
77031       const wrap2 = context.container().select(".photoviewer").selectAll(".vegbilder-wrapper").data([0]);
77032       const wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper vegbilder-wrapper").classed("hide", true);
77033       wrapEnter.append("div").attr("class", "photo-attribution fillD");
77034       const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
77035       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
77036       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
77037       _loadViewerPromise3 = Promise.all([
77038         pannellum_photo_default.init(context, wrapEnter),
77039         plane_photo_default.init(context, wrapEnter)
77040       ]).then(([pannellumPhotoFrame, planePhotoFrame]) => {
77041         _pannellumFrame = pannellumPhotoFrame;
77042         _pannellumFrame.event.on("viewerChanged", () => dispatch9.call("viewerChanged"));
77043         _planeFrame = planePhotoFrame;
77044         _planeFrame.event.on("viewerChanged", () => dispatch9.call("viewerChanged"));
77045       });
77046       return _loadViewerPromise3;
77047     },
77048     selectImage: function(context, key, keepOrientation) {
77049       const d2 = this.cachedImage(key);
77050       this.updateUrlImage(key);
77051       const viewer = context.container().select(".photoviewer");
77052       if (!viewer.empty()) {
77053         viewer.datum(d2);
77054       }
77055       this.setStyles(context, null, true);
77056       if (!d2)
77057         return this;
77058       const wrap2 = context.container().select(".photoviewer .vegbilder-wrapper");
77059       const attribution = wrap2.selectAll(".photo-attribution").text("");
77060       if (d2.captured_at) {
77061         attribution.append("span").attr("class", "captured_at").text(localeTimestamp(d2.captured_at));
77062       }
77063       attribution.append("a").attr("target", "_blank").attr("href", "https://vegvesen.no").call(_t.append("vegbilder.publisher"));
77064       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"));
77065       _currentFrame = d2.is_sphere ? _pannellumFrame : _planeFrame;
77066       _currentFrame.selectPhoto(d2, keepOrientation).showPhotoFrame(wrap2);
77067       return this;
77068     },
77069     showViewer: function(context) {
77070       const viewer = context.container().select(".photoviewer").classed("hide", false);
77071       const isHidden = viewer.selectAll(".photo-wrapper.vegbilder-wrapper.hide").size();
77072       if (isHidden) {
77073         viewer.selectAll(".photo-wrapper:not(.vegbilder-wrapper)").classed("hide", true);
77074         viewer.selectAll(".photo-wrapper.vegbilder-wrapper").classed("hide", false);
77075       }
77076       return this;
77077     },
77078     hideViewer: function(context) {
77079       this.updateUrlImage(null);
77080       const viewer = context.container().select(".photoviewer");
77081       if (!viewer.empty())
77082         viewer.datum(null);
77083       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
77084       context.container().selectAll(".viewfield-group, .sequence").classed("currentView", false);
77085       return this.setStyles(context, null, true);
77086     },
77087     // Updates the currently highlighted sequence and selected bubble.
77088     // Reset is only necessary when interacting with the viewport because
77089     // this implicitly changes the currently selected bubble/sequence
77090     setStyles: function(context, hovered, reset) {
77091       var _a, _b;
77092       if (reset) {
77093         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
77094         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
77095       }
77096       const hoveredImageKey = hovered == null ? void 0 : hovered.key;
77097       const hoveredSequence = this.getSequenceForImage(hovered);
77098       const hoveredSequenceKey = hoveredSequence == null ? void 0 : hoveredSequence.key;
77099       const hoveredImageKeys = (_a = hoveredSequence == null ? void 0 : hoveredSequence.images.map((d2) => d2.key)) != null ? _a : [];
77100       const viewer = context.container().select(".photoviewer");
77101       const selected = viewer.empty() ? void 0 : viewer.datum();
77102       const selectedImageKey = selected == null ? void 0 : selected.key;
77103       const selectedSequence = this.getSequenceForImage(selected);
77104       const selectedSequenceKey = selectedSequence == null ? void 0 : selectedSequence.key;
77105       const selectedImageKeys = (_b = selectedSequence == null ? void 0 : selectedSequence.images.map((d2) => d2.key)) != null ? _b : [];
77106       const highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
77107       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);
77108       context.container().selectAll(".layer-vegbilder .sequence").classed("highlighted", (d2) => d2.key === hoveredSequenceKey).classed("currentView", (d2) => d2.key === selectedSequenceKey);
77109       context.container().selectAll(".layer-vegbilder .viewfield-group .viewfield").attr("d", viewfieldPath);
77110       function viewfieldPath() {
77111         const d2 = this.parentNode.__data__;
77112         if (d2.is_sphere && d2.key !== selectedImageKey) {
77113           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
77114         } else {
77115           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
77116         }
77117       }
77118       return this;
77119     },
77120     updateUrlImage: function(key) {
77121       if (!window.mocha) {
77122         const hash = utilStringQs(window.location.hash);
77123         if (key) {
77124           hash.photo = "vegbilder/" + key;
77125         } else {
77126           delete hash.photo;
77127         }
77128         window.location.replace("#" + utilQsString(hash, true));
77129       }
77130     },
77131     validHere: function(extent) {
77132       const bbox2 = Object.values(extent.bbox());
77133       return iso1A2Codes(bbox2).includes("NO");
77134     },
77135     cache: function() {
77136       return _vegbilderCache;
77137     }
77138   };
77139
77140   // node_modules/osm-auth/src/osm-auth.mjs
77141   var import_store = __toESM(require_store_legacy(), 1);
77142   function osmAuth(o2) {
77143     var oauth2 = {};
77144     oauth2.authenticated = function() {
77145       return !!token("oauth2_access_token");
77146     };
77147     oauth2.logout = function() {
77148       token("oauth2_access_token", "");
77149       token("oauth_token", "");
77150       token("oauth_token_secret", "");
77151       token("oauth_request_token_secret", "");
77152       return oauth2;
77153     };
77154     oauth2.authenticate = function(callback) {
77155       if (oauth2.authenticated()) {
77156         callback(null, oauth2);
77157         return;
77158       }
77159       oauth2.logout();
77160       _generatePkceChallenge(function(pkce) {
77161         _authenticate(pkce, callback);
77162       });
77163     };
77164     oauth2.authenticateAsync = function() {
77165       if (oauth2.authenticated()) {
77166         return Promise.resolve(oauth2);
77167       }
77168       oauth2.logout();
77169       return new Promise((resolve, reject) => {
77170         var errback = (err, result) => {
77171           if (err) {
77172             reject(new Error(err));
77173           } else {
77174             resolve(result);
77175           }
77176         };
77177         _generatePkceChallenge((pkce) => _authenticate(pkce, errback));
77178       });
77179     };
77180     function _authenticate(pkce, callback) {
77181       var state = generateState();
77182       var url = o2.url + "/oauth2/authorize?" + utilQsString2({
77183         client_id: o2.client_id,
77184         redirect_uri: o2.redirect_uri,
77185         response_type: "code",
77186         scope: o2.scope,
77187         state,
77188         code_challenge: pkce.code_challenge,
77189         code_challenge_method: pkce.code_challenge_method
77190       });
77191       if (o2.singlepage) {
77192         if (!import_store.default.enabled) {
77193           var error = new Error("local storage unavailable, but require in singlepage mode");
77194           error.status = "pkce-localstorage-unavailable";
77195           callback(error);
77196           return;
77197         }
77198         var params = utilStringQs2(window.location.search.slice(1));
77199         if (params.code) {
77200           oauth2.bootstrapToken(params.code, callback);
77201         } else {
77202           token("oauth2_state", state);
77203           token("oauth2_pkce_code_verifier", pkce.code_verifier);
77204           window.location = url;
77205         }
77206       } else {
77207         var w2 = 600;
77208         var h2 = 550;
77209         var settings = [
77210           ["width", w2],
77211           ["height", h2],
77212           ["left", window.screen.width / 2 - w2 / 2],
77213           ["top", window.screen.height / 2 - h2 / 2]
77214         ].map(function(x2) {
77215           return x2.join("=");
77216         }).join(",");
77217         var popup = window.open("about:blank", "oauth_window", settings);
77218         oauth2.popupWindow = popup;
77219         popup.location = url;
77220         if (!popup) {
77221           error = new Error("Popup was blocked");
77222           error.status = "popup-blocked";
77223           callback(error);
77224         }
77225       }
77226       window.authComplete = function(url2) {
77227         var params2 = utilStringQs2(url2.split("?")[1]);
77228         if (params2.state !== state) {
77229           error = new Error("Invalid state");
77230           error.status = "invalid-state";
77231           callback(error);
77232           return;
77233         }
77234         _getAccessToken(params2.code, pkce.code_verifier, accessTokenDone);
77235         delete window.authComplete;
77236       };
77237       function accessTokenDone(err, xhr) {
77238         o2.done();
77239         if (err) {
77240           callback(err);
77241           return;
77242         }
77243         var access_token = JSON.parse(xhr.response);
77244         token("oauth2_access_token", access_token.access_token);
77245         callback(null, oauth2);
77246       }
77247     }
77248     function _getAccessToken(auth_code, code_verifier, accessTokenDone) {
77249       var url = o2.url + "/oauth2/token?" + utilQsString2({
77250         client_id: o2.client_id,
77251         redirect_uri: o2.redirect_uri,
77252         grant_type: "authorization_code",
77253         code: auth_code,
77254         code_verifier
77255       });
77256       oauth2.rawxhr("POST", url, null, null, null, accessTokenDone);
77257       o2.loading();
77258     }
77259     oauth2.bringPopupWindowToFront = function() {
77260       var broughtPopupToFront = false;
77261       try {
77262         if (oauth2.popupWindow && !oauth2.popupWindow.closed) {
77263           oauth2.popupWindow.focus();
77264           broughtPopupToFront = true;
77265         }
77266       } catch (err) {
77267       }
77268       return broughtPopupToFront;
77269     };
77270     oauth2.bootstrapToken = function(auth_code, callback) {
77271       var state = token("oauth2_state");
77272       token("oauth2_state", "");
77273       var params = utilStringQs2(window.location.search.slice(1));
77274       if (params.state !== state) {
77275         var error = new Error("Invalid state");
77276         error.status = "invalid-state";
77277         callback(error);
77278         return;
77279       }
77280       var code_verifier = token("oauth2_pkce_code_verifier");
77281       token("oauth2_pkce_code_verifier", "");
77282       _getAccessToken(auth_code, code_verifier, accessTokenDone);
77283       function accessTokenDone(err, xhr) {
77284         o2.done();
77285         if (err) {
77286           callback(err);
77287           return;
77288         }
77289         var access_token = JSON.parse(xhr.response);
77290         token("oauth2_access_token", access_token.access_token);
77291         callback(null, oauth2);
77292       }
77293     };
77294     oauth2.fetch = function(resource, options2) {
77295       if (oauth2.authenticated()) {
77296         return _doFetch();
77297       } else {
77298         if (o2.auto) {
77299           return oauth2.authenticateAsync().then(_doFetch);
77300         } else {
77301           return Promise.reject(new Error("not authenticated"));
77302         }
77303       }
77304       function _doFetch() {
77305         options2 = options2 || {};
77306         if (!options2.headers) {
77307           options2.headers = { "Content-Type": "application/x-www-form-urlencoded" };
77308         }
77309         options2.headers.Authorization = "Bearer " + token("oauth2_access_token");
77310         return fetch(resource, options2);
77311       }
77312     };
77313     oauth2.xhr = function(options2, callback) {
77314       if (oauth2.authenticated()) {
77315         return _doXHR();
77316       } else {
77317         if (o2.auto) {
77318           oauth2.authenticate(_doXHR);
77319           return;
77320         } else {
77321           callback("not authenticated", null);
77322           return;
77323         }
77324       }
77325       function _doXHR() {
77326         var url = options2.prefix !== false ? o2.url + options2.path : options2.path;
77327         return oauth2.rawxhr(
77328           options2.method,
77329           url,
77330           token("oauth2_access_token"),
77331           options2.content,
77332           options2.headers,
77333           done
77334         );
77335       }
77336       function done(err, xhr) {
77337         if (err) {
77338           callback(err);
77339         } else if (xhr.responseXML) {
77340           callback(err, xhr.responseXML);
77341         } else {
77342           callback(err, xhr.response);
77343         }
77344       }
77345     };
77346     oauth2.rawxhr = function(method, url, access_token, data, headers, callback) {
77347       headers = headers || { "Content-Type": "application/x-www-form-urlencoded" };
77348       if (access_token) {
77349         headers.Authorization = "Bearer " + access_token;
77350       }
77351       var xhr = new XMLHttpRequest();
77352       xhr.onreadystatechange = function() {
77353         if (4 === xhr.readyState && 0 !== xhr.status) {
77354           if (/^20\d$/.test(xhr.status)) {
77355             callback(null, xhr);
77356           } else {
77357             callback(xhr, null);
77358           }
77359         }
77360       };
77361       xhr.onerror = function(e3) {
77362         callback(e3, null);
77363       };
77364       xhr.open(method, url, true);
77365       for (var h2 in headers)
77366         xhr.setRequestHeader(h2, headers[h2]);
77367       xhr.send(data);
77368       return xhr;
77369     };
77370     oauth2.preauth = function(val) {
77371       if (val && val.access_token) {
77372         token("oauth2_access_token", val.access_token);
77373       }
77374       return oauth2;
77375     };
77376     oauth2.options = function(val) {
77377       if (!arguments.length)
77378         return o2;
77379       o2 = val;
77380       o2.url = o2.url || "https://www.openstreetmap.org";
77381       o2.auto = o2.auto || false;
77382       o2.singlepage = o2.singlepage || false;
77383       o2.loading = o2.loading || function() {
77384       };
77385       o2.done = o2.done || function() {
77386       };
77387       return oauth2.preauth(o2);
77388     };
77389     var token;
77390     if (import_store.default.enabled) {
77391       token = function(x2, y2) {
77392         if (arguments.length === 1)
77393           return import_store.default.get(o2.url + x2);
77394         else if (arguments.length === 2)
77395           return import_store.default.set(o2.url + x2, y2);
77396       };
77397     } else {
77398       var storage = {};
77399       token = function(x2, y2) {
77400         if (arguments.length === 1)
77401           return storage[o2.url + x2];
77402         else if (arguments.length === 2)
77403           return storage[o2.url + x2] = y2;
77404       };
77405     }
77406     oauth2.options(o2);
77407     return oauth2;
77408   }
77409   function utilQsString2(obj) {
77410     return Object.keys(obj).filter(function(key) {
77411       return obj[key] !== void 0;
77412     }).sort().map(function(key) {
77413       return encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]);
77414     }).join("&");
77415   }
77416   function utilStringQs2(str2) {
77417     var i3 = 0;
77418     while (i3 < str2.length && (str2[i3] === "?" || str2[i3] === "#"))
77419       i3++;
77420     str2 = str2.slice(i3);
77421     return str2.split("&").reduce(function(obj, pair3) {
77422       var parts = pair3.split("=");
77423       if (parts.length === 2) {
77424         obj[parts[0]] = decodeURIComponent(parts[1]);
77425       }
77426       return obj;
77427     }, {});
77428   }
77429   function supportsWebCryptoAPI() {
77430     return window && window.crypto && window.crypto.getRandomValues && window.crypto.subtle && window.crypto.subtle.digest;
77431   }
77432   function _generatePkceChallenge(callback) {
77433     var code_verifier;
77434     if (supportsWebCryptoAPI()) {
77435       var random = window.crypto.getRandomValues(new Uint8Array(32));
77436       code_verifier = base64(random.buffer);
77437       var verifier = Uint8Array.from(Array.from(code_verifier).map(function(char) {
77438         return char.charCodeAt(0);
77439       }));
77440       window.crypto.subtle.digest("SHA-256", verifier).then(function(hash) {
77441         var code_challenge = base64(hash);
77442         callback({
77443           code_challenge,
77444           code_verifier,
77445           code_challenge_method: "S256"
77446         });
77447       });
77448     } else {
77449       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
77450       code_verifier = "";
77451       for (var i3 = 0; i3 < 64; i3++) {
77452         code_verifier += chars[Math.floor(Math.random() * chars.length)];
77453       }
77454       callback({
77455         code_verifier,
77456         code_challenge: code_verifier,
77457         code_challenge_method: "plain"
77458       });
77459     }
77460   }
77461   function generateState() {
77462     var state;
77463     if (supportsWebCryptoAPI()) {
77464       var random = window.crypto.getRandomValues(new Uint8Array(32));
77465       state = base64(random.buffer);
77466     } else {
77467       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
77468       state = "";
77469       for (var i3 = 0; i3 < 64; i3++) {
77470         state += chars[Math.floor(Math.random() * chars.length)];
77471       }
77472     }
77473     return state;
77474   }
77475   function base64(buffer) {
77476     return btoa(String.fromCharCode.apply(null, new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/[=]/g, "");
77477   }
77478
77479   // modules/services/osm.js
77480   var import_rbush10 = __toESM(require_rbush_min());
77481   var tiler6 = utilTiler();
77482   var dispatch10 = dispatch_default("apiStatusChange", "authLoading", "authDone", "change", "loading", "loaded", "loadedNotes");
77483   var urlroot = osmApiConnections[0].url;
77484   var apiUrlroot = osmApiConnections[0].apiUrl || urlroot;
77485   var redirectPath = window.location.origin + window.location.pathname;
77486   var oauth = osmAuth({
77487     url: urlroot,
77488     client_id: osmApiConnections[0].client_id,
77489     client_secret: osmApiConnections[0].client_secret,
77490     scope: "read_prefs write_prefs write_api read_gpx write_notes",
77491     redirect_uri: redirectPath + "land.html",
77492     loading: authLoading,
77493     done: authDone
77494   });
77495   var _apiConnections = osmApiConnections;
77496   var _imageryBlocklists = [/.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/];
77497   var _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush10.default() };
77498   var _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush10.default() };
77499   var _userCache = { toLoad: {}, user: {} };
77500   var _cachedApiStatus;
77501   var _changeset = {};
77502   var _deferred = /* @__PURE__ */ new Set();
77503   var _connectionID = 1;
77504   var _tileZoom4 = 16;
77505   var _noteZoom = 12;
77506   var _rateLimitError;
77507   var _userChangesets;
77508   var _userDetails;
77509   var _off;
77510   var _maxWayNodes = 2e3;
77511   function authLoading() {
77512     dispatch10.call("authLoading");
77513   }
77514   function authDone() {
77515     dispatch10.call("authDone");
77516   }
77517   function abortRequest5(controllerOrXHR) {
77518     if (controllerOrXHR) {
77519       controllerOrXHR.abort();
77520     }
77521   }
77522   function hasInflightRequests(cache) {
77523     return Object.keys(cache.inflight).length;
77524   }
77525   function abortUnwantedRequests4(cache, visibleTiles) {
77526     Object.keys(cache.inflight).forEach(function(k2) {
77527       if (cache.toLoad[k2])
77528         return;
77529       if (visibleTiles.find(function(tile) {
77530         return k2 === tile.id;
77531       }))
77532         return;
77533       abortRequest5(cache.inflight[k2]);
77534       delete cache.inflight[k2];
77535     });
77536   }
77537   function getLoc(attrs) {
77538     var lon = attrs.lon && attrs.lon.value;
77539     var lat = attrs.lat && attrs.lat.value;
77540     return [Number(lon), Number(lat)];
77541   }
77542   function getNodes(obj) {
77543     var elems = obj.getElementsByTagName("nd");
77544     var nodes = new Array(elems.length);
77545     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77546       nodes[i3] = "n" + elems[i3].attributes.ref.value;
77547     }
77548     return nodes;
77549   }
77550   function getNodesJSON(obj) {
77551     var elems = obj.nodes;
77552     var nodes = new Array(elems.length);
77553     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77554       nodes[i3] = "n" + elems[i3];
77555     }
77556     return nodes;
77557   }
77558   function getTags(obj) {
77559     var elems = obj.getElementsByTagName("tag");
77560     var tags = {};
77561     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77562       var attrs = elems[i3].attributes;
77563       tags[attrs.k.value] = attrs.v.value;
77564     }
77565     return tags;
77566   }
77567   function getMembers(obj) {
77568     var elems = obj.getElementsByTagName("member");
77569     var members = new Array(elems.length);
77570     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77571       var attrs = elems[i3].attributes;
77572       members[i3] = {
77573         id: attrs.type.value[0] + attrs.ref.value,
77574         type: attrs.type.value,
77575         role: attrs.role.value
77576       };
77577     }
77578     return members;
77579   }
77580   function getMembersJSON(obj) {
77581     var elems = obj.members;
77582     var members = new Array(elems.length);
77583     for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77584       var attrs = elems[i3];
77585       members[i3] = {
77586         id: attrs.type[0] + attrs.ref,
77587         type: attrs.type,
77588         role: attrs.role
77589       };
77590     }
77591     return members;
77592   }
77593   function getVisible(attrs) {
77594     return !attrs.visible || attrs.visible.value !== "false";
77595   }
77596   function parseComments(comments) {
77597     var parsedComments = [];
77598     for (var i3 = 0; i3 < comments.length; i3++) {
77599       var comment = comments[i3];
77600       if (comment.nodeName === "comment") {
77601         var childNodes = comment.childNodes;
77602         var parsedComment = {};
77603         for (var j3 = 0; j3 < childNodes.length; j3++) {
77604           var node = childNodes[j3];
77605           var nodeName = node.nodeName;
77606           if (nodeName === "#text")
77607             continue;
77608           parsedComment[nodeName] = node.textContent;
77609           if (nodeName === "uid") {
77610             var uid = node.textContent;
77611             if (uid && !_userCache.user[uid]) {
77612               _userCache.toLoad[uid] = true;
77613             }
77614           }
77615         }
77616         if (parsedComment) {
77617           parsedComments.push(parsedComment);
77618         }
77619       }
77620     }
77621     return parsedComments;
77622   }
77623   function encodeNoteRtree(note) {
77624     return {
77625       minX: note.loc[0],
77626       minY: note.loc[1],
77627       maxX: note.loc[0],
77628       maxY: note.loc[1],
77629       data: note
77630     };
77631   }
77632   var jsonparsers = {
77633     node: function nodeData(obj, uid) {
77634       return new osmNode({
77635         id: uid,
77636         visible: typeof obj.visible === "boolean" ? obj.visible : true,
77637         version: obj.version && obj.version.toString(),
77638         changeset: obj.changeset && obj.changeset.toString(),
77639         timestamp: obj.timestamp,
77640         user: obj.user,
77641         uid: obj.uid && obj.uid.toString(),
77642         loc: [Number(obj.lon), Number(obj.lat)],
77643         tags: obj.tags
77644       });
77645     },
77646     way: function wayData(obj, uid) {
77647       return new osmWay({
77648         id: uid,
77649         visible: typeof obj.visible === "boolean" ? obj.visible : true,
77650         version: obj.version && obj.version.toString(),
77651         changeset: obj.changeset && obj.changeset.toString(),
77652         timestamp: obj.timestamp,
77653         user: obj.user,
77654         uid: obj.uid && obj.uid.toString(),
77655         tags: obj.tags,
77656         nodes: getNodesJSON(obj)
77657       });
77658     },
77659     relation: function relationData(obj, uid) {
77660       return new osmRelation({
77661         id: uid,
77662         visible: typeof obj.visible === "boolean" ? obj.visible : true,
77663         version: obj.version && obj.version.toString(),
77664         changeset: obj.changeset && obj.changeset.toString(),
77665         timestamp: obj.timestamp,
77666         user: obj.user,
77667         uid: obj.uid && obj.uid.toString(),
77668         tags: obj.tags,
77669         members: getMembersJSON(obj)
77670       });
77671     },
77672     user: function parseUser(obj, uid) {
77673       return {
77674         id: uid,
77675         display_name: obj.display_name,
77676         account_created: obj.account_created,
77677         image_url: obj.img && obj.img.href,
77678         changesets_count: obj.changesets && obj.changesets.count && obj.changesets.count.toString() || "0",
77679         active_blocks: obj.blocks && obj.blocks.received && obj.blocks.received.active && obj.blocks.received.active.toString() || "0"
77680       };
77681     }
77682   };
77683   function parseJSON(payload, callback, options2) {
77684     options2 = Object.assign({ skipSeen: true }, options2);
77685     if (!payload) {
77686       return callback({ message: "No JSON", status: -1 });
77687     }
77688     var json = payload;
77689     if (typeof json !== "object")
77690       json = JSON.parse(payload);
77691     if (!json.elements)
77692       return callback({ message: "No JSON", status: -1 });
77693     var children2 = json.elements;
77694     var handle = window.requestIdleCallback(function() {
77695       _deferred.delete(handle);
77696       var results = [];
77697       var result;
77698       for (var i3 = 0; i3 < children2.length; i3++) {
77699         result = parseChild(children2[i3]);
77700         if (result)
77701           results.push(result);
77702       }
77703       callback(null, results);
77704     });
77705     _deferred.add(handle);
77706     function parseChild(child) {
77707       var parser3 = jsonparsers[child.type];
77708       if (!parser3)
77709         return null;
77710       var uid;
77711       uid = osmEntity.id.fromOSM(child.type, child.id);
77712       if (options2.skipSeen) {
77713         if (_tileCache.seen[uid])
77714           return null;
77715         _tileCache.seen[uid] = true;
77716       }
77717       return parser3(child, uid);
77718     }
77719   }
77720   function parseUserJSON(payload, callback, options2) {
77721     options2 = Object.assign({ skipSeen: true }, options2);
77722     if (!payload) {
77723       return callback({ message: "No JSON", status: -1 });
77724     }
77725     var json = payload;
77726     if (typeof json !== "object")
77727       json = JSON.parse(payload);
77728     if (!json.users && !json.user)
77729       return callback({ message: "No JSON", status: -1 });
77730     var objs = json.users || [json];
77731     var handle = window.requestIdleCallback(function() {
77732       _deferred.delete(handle);
77733       var results = [];
77734       var result;
77735       for (var i3 = 0; i3 < objs.length; i3++) {
77736         result = parseObj(objs[i3]);
77737         if (result)
77738           results.push(result);
77739       }
77740       callback(null, results);
77741     });
77742     _deferred.add(handle);
77743     function parseObj(obj) {
77744       var uid = obj.user.id && obj.user.id.toString();
77745       if (options2.skipSeen && _userCache.user[uid]) {
77746         delete _userCache.toLoad[uid];
77747         return null;
77748       }
77749       var user = jsonparsers.user(obj.user, uid);
77750       _userCache.user[uid] = user;
77751       delete _userCache.toLoad[uid];
77752       return user;
77753     }
77754   }
77755   var parsers = {
77756     node: function nodeData2(obj, uid) {
77757       var attrs = obj.attributes;
77758       return new osmNode({
77759         id: uid,
77760         visible: getVisible(attrs),
77761         version: attrs.version.value,
77762         changeset: attrs.changeset && attrs.changeset.value,
77763         timestamp: attrs.timestamp && attrs.timestamp.value,
77764         user: attrs.user && attrs.user.value,
77765         uid: attrs.uid && attrs.uid.value,
77766         loc: getLoc(attrs),
77767         tags: getTags(obj)
77768       });
77769     },
77770     way: function wayData2(obj, uid) {
77771       var attrs = obj.attributes;
77772       return new osmWay({
77773         id: uid,
77774         visible: getVisible(attrs),
77775         version: attrs.version.value,
77776         changeset: attrs.changeset && attrs.changeset.value,
77777         timestamp: attrs.timestamp && attrs.timestamp.value,
77778         user: attrs.user && attrs.user.value,
77779         uid: attrs.uid && attrs.uid.value,
77780         tags: getTags(obj),
77781         nodes: getNodes(obj)
77782       });
77783     },
77784     relation: function relationData2(obj, uid) {
77785       var attrs = obj.attributes;
77786       return new osmRelation({
77787         id: uid,
77788         visible: getVisible(attrs),
77789         version: attrs.version.value,
77790         changeset: attrs.changeset && attrs.changeset.value,
77791         timestamp: attrs.timestamp && attrs.timestamp.value,
77792         user: attrs.user && attrs.user.value,
77793         uid: attrs.uid && attrs.uid.value,
77794         tags: getTags(obj),
77795         members: getMembers(obj)
77796       });
77797     },
77798     note: function parseNote(obj, uid) {
77799       var attrs = obj.attributes;
77800       var childNodes = obj.childNodes;
77801       var props = {};
77802       props.id = uid;
77803       props.loc = getLoc(attrs);
77804       var coincident = false;
77805       var epsilon3 = 1e-5;
77806       do {
77807         if (coincident) {
77808           props.loc = geoVecAdd(props.loc, [epsilon3, epsilon3]);
77809         }
77810         var bbox2 = geoExtent(props.loc).bbox();
77811         coincident = _noteCache.rtree.search(bbox2).length;
77812       } while (coincident);
77813       for (var i3 = 0; i3 < childNodes.length; i3++) {
77814         var node = childNodes[i3];
77815         var nodeName = node.nodeName;
77816         if (nodeName === "#text")
77817           continue;
77818         if (nodeName === "comments") {
77819           props[nodeName] = parseComments(node.childNodes);
77820         } else {
77821           props[nodeName] = node.textContent;
77822         }
77823       }
77824       var note = new osmNote(props);
77825       var item = encodeNoteRtree(note);
77826       _noteCache.note[note.id] = note;
77827       _noteCache.rtree.insert(item);
77828       return note;
77829     },
77830     user: function parseUser2(obj, uid) {
77831       var attrs = obj.attributes;
77832       var user = {
77833         id: uid,
77834         display_name: attrs.display_name && attrs.display_name.value,
77835         account_created: attrs.account_created && attrs.account_created.value,
77836         changesets_count: "0",
77837         active_blocks: "0"
77838       };
77839       var img = obj.getElementsByTagName("img");
77840       if (img && img[0] && img[0].getAttribute("href")) {
77841         user.image_url = img[0].getAttribute("href");
77842       }
77843       var changesets = obj.getElementsByTagName("changesets");
77844       if (changesets && changesets[0] && changesets[0].getAttribute("count")) {
77845         user.changesets_count = changesets[0].getAttribute("count");
77846       }
77847       var blocks = obj.getElementsByTagName("blocks");
77848       if (blocks && blocks[0]) {
77849         var received = blocks[0].getElementsByTagName("received");
77850         if (received && received[0] && received[0].getAttribute("active")) {
77851           user.active_blocks = received[0].getAttribute("active");
77852         }
77853       }
77854       _userCache.user[uid] = user;
77855       delete _userCache.toLoad[uid];
77856       return user;
77857     }
77858   };
77859   function parseXML(xml, callback, options2) {
77860     options2 = Object.assign({ skipSeen: true }, options2);
77861     if (!xml || !xml.childNodes) {
77862       return callback({ message: "No XML", status: -1 });
77863     }
77864     var root3 = xml.childNodes[0];
77865     var children2 = root3.childNodes;
77866     var handle = window.requestIdleCallback(function() {
77867       _deferred.delete(handle);
77868       var results = [];
77869       var result;
77870       for (var i3 = 0; i3 < children2.length; i3++) {
77871         result = parseChild(children2[i3]);
77872         if (result)
77873           results.push(result);
77874       }
77875       callback(null, results);
77876     });
77877     _deferred.add(handle);
77878     function parseChild(child) {
77879       var parser3 = parsers[child.nodeName];
77880       if (!parser3)
77881         return null;
77882       var uid;
77883       if (child.nodeName === "user") {
77884         uid = child.attributes.id.value;
77885         if (options2.skipSeen && _userCache.user[uid]) {
77886           delete _userCache.toLoad[uid];
77887           return null;
77888         }
77889       } else if (child.nodeName === "note") {
77890         uid = child.getElementsByTagName("id")[0].textContent;
77891       } else {
77892         uid = osmEntity.id.fromOSM(child.nodeName, child.attributes.id.value);
77893         if (options2.skipSeen) {
77894           if (_tileCache.seen[uid])
77895             return null;
77896           _tileCache.seen[uid] = true;
77897         }
77898       }
77899       return parser3(child, uid);
77900     }
77901   }
77902   function updateRtree4(item, replace) {
77903     _noteCache.rtree.remove(item, function isEql(a2, b2) {
77904       return a2.data.id === b2.data.id;
77905     });
77906     if (replace) {
77907       _noteCache.rtree.insert(item);
77908     }
77909   }
77910   function wrapcb(thisArg, callback, cid) {
77911     return function(err, result) {
77912       if (err) {
77913         if (err.status === 400 || err.status === 401 || err.status === 403) {
77914           thisArg.logout();
77915         }
77916         return callback.call(thisArg, err);
77917       } else if (thisArg.getConnectionId() !== cid) {
77918         return callback.call(thisArg, { message: "Connection Switched", status: -1 });
77919       } else {
77920         return callback.call(thisArg, err, result);
77921       }
77922     };
77923   }
77924   var osm_default = {
77925     init: function() {
77926       utilRebind(this, dispatch10, "on");
77927     },
77928     reset: function() {
77929       Array.from(_deferred).forEach(function(handle) {
77930         window.cancelIdleCallback(handle);
77931         _deferred.delete(handle);
77932       });
77933       _connectionID++;
77934       _userChangesets = void 0;
77935       _userDetails = void 0;
77936       _rateLimitError = void 0;
77937       Object.values(_tileCache.inflight).forEach(abortRequest5);
77938       Object.values(_noteCache.inflight).forEach(abortRequest5);
77939       Object.values(_noteCache.inflightPost).forEach(abortRequest5);
77940       if (_changeset.inflight)
77941         abortRequest5(_changeset.inflight);
77942       _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush10.default() };
77943       _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush10.default() };
77944       _userCache = { toLoad: {}, user: {} };
77945       _cachedApiStatus = void 0;
77946       _changeset = {};
77947       return this;
77948     },
77949     getConnectionId: function() {
77950       return _connectionID;
77951     },
77952     getUrlRoot: function() {
77953       return urlroot;
77954     },
77955     changesetURL: function(changesetID) {
77956       return urlroot + "/changeset/" + changesetID;
77957     },
77958     changesetsURL: function(center, zoom) {
77959       var precision2 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
77960       return urlroot + "/history#map=" + Math.floor(zoom) + "/" + center[1].toFixed(precision2) + "/" + center[0].toFixed(precision2);
77961     },
77962     entityURL: function(entity) {
77963       return urlroot + "/" + entity.type + "/" + entity.osmId();
77964     },
77965     historyURL: function(entity) {
77966       return urlroot + "/" + entity.type + "/" + entity.osmId() + "/history";
77967     },
77968     userURL: function(username) {
77969       return urlroot + "/user/" + encodeURIComponent(username);
77970     },
77971     noteURL: function(note) {
77972       return urlroot + "/note/" + note.id;
77973     },
77974     noteReportURL: function(note) {
77975       return urlroot + "/reports/new?reportable_type=Note&reportable_id=" + note.id;
77976     },
77977     // Generic method to load data from the OSM API
77978     // Can handle either auth or unauth calls.
77979     loadFromAPI: function(path, callback, options2) {
77980       options2 = Object.assign({ skipSeen: true }, options2);
77981       var that = this;
77982       var cid = _connectionID;
77983       function done(err, payload) {
77984         if (that.getConnectionId() !== cid) {
77985           if (callback)
77986             callback({ message: "Connection Switched", status: -1 });
77987           return;
77988         }
77989         var isAuthenticated = that.authenticated();
77990         if (isAuthenticated && err && err.status && (err.status === 400 || err.status === 401 || err.status === 403)) {
77991           that.logout();
77992           that.loadFromAPI(path, callback, options2);
77993         } else {
77994           if (!isAuthenticated && !_rateLimitError && err && err.status && (err.status === 509 || err.status === 429)) {
77995             _rateLimitError = err;
77996             dispatch10.call("change");
77997             that.reloadApiStatus();
77998           } else if (err && _cachedApiStatus === "online" || !err && _cachedApiStatus !== "online") {
77999             that.reloadApiStatus();
78000           }
78001           if (callback) {
78002             if (err) {
78003               return callback(err);
78004             } else {
78005               if (path.indexOf(".json") !== -1) {
78006                 return parseJSON(payload, callback, options2);
78007               } else {
78008                 return parseXML(payload, callback, options2);
78009               }
78010             }
78011           }
78012         }
78013       }
78014       if (this.authenticated()) {
78015         return oauth.xhr({
78016           method: "GET",
78017           prefix: false,
78018           path: apiUrlroot + path
78019         }, done);
78020       } else {
78021         var url = apiUrlroot + path;
78022         var controller = new AbortController();
78023         var fn;
78024         if (path.indexOf(".json") !== -1) {
78025           fn = json_default;
78026         } else {
78027           fn = xml_default;
78028         }
78029         fn(url, { signal: controller.signal }).then(function(data) {
78030           done(null, data);
78031         }).catch(function(err) {
78032           if (err.name === "AbortError")
78033             return;
78034           var match = err.message.match(/^\d{3}/);
78035           if (match) {
78036             done({ status: +match[0], statusText: err.message });
78037           } else {
78038             done(err.message);
78039           }
78040         });
78041         return controller;
78042       }
78043     },
78044     // Load a single entity by id (ways and relations use the `/full` call to include
78045     // nodes and members). Parent relations are not included, see `loadEntityRelations`.
78046     // GET /api/0.6/node/#id
78047     // GET /api/0.6/[way|relation]/#id/full
78048     loadEntity: function(id2, callback) {
78049       var type2 = osmEntity.id.type(id2);
78050       var osmID = osmEntity.id.toOSM(id2);
78051       var options2 = { skipSeen: false };
78052       this.loadFromAPI(
78053         "/api/0.6/" + type2 + "/" + osmID + (type2 !== "node" ? "/full" : "") + ".json",
78054         function(err, entities) {
78055           if (callback)
78056             callback(err, { data: entities });
78057         },
78058         options2
78059       );
78060     },
78061     // Load a single entity with a specific version
78062     // GET /api/0.6/[node|way|relation]/#id/#version
78063     loadEntityVersion: function(id2, version, callback) {
78064       var type2 = osmEntity.id.type(id2);
78065       var osmID = osmEntity.id.toOSM(id2);
78066       var options2 = { skipSeen: false };
78067       this.loadFromAPI(
78068         "/api/0.6/" + type2 + "/" + osmID + "/" + version + ".json",
78069         function(err, entities) {
78070           if (callback)
78071             callback(err, { data: entities });
78072         },
78073         options2
78074       );
78075     },
78076     // Load the relations of a single entity with the given.
78077     // GET /api/0.6/[node|way|relation]/#id/relations
78078     loadEntityRelations: function(id2, callback) {
78079       var type2 = osmEntity.id.type(id2);
78080       var osmID = osmEntity.id.toOSM(id2);
78081       var options2 = { skipSeen: false };
78082       this.loadFromAPI(
78083         "/api/0.6/" + type2 + "/" + osmID + "/relations.json",
78084         function(err, entities) {
78085           if (callback)
78086             callback(err, { data: entities });
78087         },
78088         options2
78089       );
78090     },
78091     // Load multiple entities in chunks
78092     // (note: callback may be called multiple times)
78093     // Unlike `loadEntity`, child nodes and members are not fetched
78094     // GET /api/0.6/[nodes|ways|relations]?#parameters
78095     loadMultiple: function(ids, callback) {
78096       var that = this;
78097       var groups = utilArrayGroupBy(utilArrayUniq(ids), osmEntity.id.type);
78098       Object.keys(groups).forEach(function(k2) {
78099         var type2 = k2 + "s";
78100         var osmIDs = groups[k2].map(function(id2) {
78101           return osmEntity.id.toOSM(id2);
78102         });
78103         var options2 = { skipSeen: false };
78104         utilArrayChunk(osmIDs, 150).forEach(function(arr) {
78105           that.loadFromAPI(
78106             "/api/0.6/" + type2 + ".json?" + type2 + "=" + arr.join(),
78107             function(err, entities) {
78108               if (callback)
78109                 callback(err, { data: entities });
78110             },
78111             options2
78112           );
78113         });
78114       });
78115     },
78116     // Create, upload, and close a changeset
78117     // PUT /api/0.6/changeset/create
78118     // POST /api/0.6/changeset/#id/upload
78119     // PUT /api/0.6/changeset/#id/close
78120     putChangeset: function(changeset, changes, callback) {
78121       var cid = _connectionID;
78122       if (_changeset.inflight) {
78123         return callback({ message: "Changeset already inflight", status: -2 }, changeset);
78124       } else if (_changeset.open) {
78125         return createdChangeset.call(this, null, _changeset.open);
78126       } else {
78127         var options2 = {
78128           method: "PUT",
78129           prefix: false,
78130           path: apiUrlroot + "/api/0.6/changeset/create",
78131           headers: { "Content-Type": "text/xml" },
78132           content: JXON.stringify(changeset.asJXON())
78133         };
78134         _changeset.inflight = oauth.xhr(
78135           options2,
78136           wrapcb(this, createdChangeset, cid)
78137         );
78138       }
78139       function createdChangeset(err, changesetID) {
78140         _changeset.inflight = null;
78141         if (err) {
78142           return callback(err, changeset);
78143         }
78144         _changeset.open = changesetID;
78145         changeset = changeset.update({ id: changesetID });
78146         var options3 = {
78147           method: "POST",
78148           prefix: false,
78149           path: apiUrlroot + "/api/0.6/changeset/" + changesetID + "/upload",
78150           headers: { "Content-Type": "text/xml" },
78151           content: JXON.stringify(changeset.osmChangeJXON(changes))
78152         };
78153         _changeset.inflight = oauth.xhr(
78154           options3,
78155           wrapcb(this, uploadedChangeset, cid)
78156         );
78157       }
78158       function uploadedChangeset(err) {
78159         _changeset.inflight = null;
78160         if (err)
78161           return callback(err, changeset);
78162         window.setTimeout(function() {
78163           callback(null, changeset);
78164         }, 2500);
78165         _changeset.open = null;
78166         if (this.getConnectionId() === cid) {
78167           oauth.xhr({
78168             method: "PUT",
78169             prefix: false,
78170             path: apiUrlroot + "/api/0.6/changeset/" + changeset.id + "/close",
78171             headers: { "Content-Type": "text/xml" }
78172           }, function() {
78173             return true;
78174           });
78175         }
78176       }
78177     },
78178     // Load multiple users in chunks
78179     // (note: callback may be called multiple times)
78180     // GET /api/0.6/users?users=#id1,#id2,...,#idn
78181     loadUsers: function(uids, callback) {
78182       var toLoad = [];
78183       var cached = [];
78184       utilArrayUniq(uids).forEach(function(uid) {
78185         if (_userCache.user[uid]) {
78186           delete _userCache.toLoad[uid];
78187           cached.push(_userCache.user[uid]);
78188         } else {
78189           toLoad.push(uid);
78190         }
78191       });
78192       if (cached.length || !this.authenticated()) {
78193         callback(void 0, cached);
78194         if (!this.authenticated())
78195           return;
78196       }
78197       utilArrayChunk(toLoad, 150).forEach((function(arr) {
78198         oauth.xhr({
78199           method: "GET",
78200           prefix: false,
78201           path: apiUrlroot + "/api/0.6/users.json?users=" + arr.join()
78202         }, wrapcb(this, done, _connectionID));
78203       }).bind(this));
78204       function done(err, payload) {
78205         if (err)
78206           return callback(err);
78207         var options2 = { skipSeen: true };
78208         return parseUserJSON(payload, function(err2, results) {
78209           if (err2)
78210             return callback(err2);
78211           return callback(void 0, results);
78212         }, options2);
78213       }
78214     },
78215     // Load a given user by id
78216     // GET /api/0.6/user/#id
78217     loadUser: function(uid, callback) {
78218       if (_userCache.user[uid] || !this.authenticated()) {
78219         delete _userCache.toLoad[uid];
78220         return callback(void 0, _userCache.user[uid]);
78221       }
78222       oauth.xhr({
78223         method: "GET",
78224         prefix: false,
78225         path: apiUrlroot + "/api/0.6/user/" + uid + ".json"
78226       }, wrapcb(this, done, _connectionID));
78227       function done(err, payload) {
78228         if (err)
78229           return callback(err);
78230         var options2 = { skipSeen: true };
78231         return parseUserJSON(payload, function(err2, results) {
78232           if (err2)
78233             return callback(err2);
78234           return callback(void 0, results[0]);
78235         }, options2);
78236       }
78237     },
78238     // Load the details of the logged-in user
78239     // GET /api/0.6/user/details
78240     userDetails: function(callback) {
78241       if (_userDetails) {
78242         return callback(void 0, _userDetails);
78243       }
78244       oauth.xhr({
78245         method: "GET",
78246         prefix: false,
78247         path: apiUrlroot + "/api/0.6/user/details.json"
78248       }, wrapcb(this, done, _connectionID));
78249       function done(err, payload) {
78250         if (err)
78251           return callback(err);
78252         var options2 = { skipSeen: false };
78253         return parseUserJSON(payload, function(err2, results) {
78254           if (err2)
78255             return callback(err2);
78256           _userDetails = results[0];
78257           return callback(void 0, _userDetails);
78258         }, options2);
78259       }
78260     },
78261     // Load previous changesets for the logged in user
78262     // GET /api/0.6/changesets?user=#id
78263     userChangesets: function(callback) {
78264       if (_userChangesets) {
78265         return callback(void 0, _userChangesets);
78266       }
78267       this.userDetails(
78268         wrapcb(this, gotDetails, _connectionID)
78269       );
78270       function gotDetails(err, user) {
78271         if (err) {
78272           return callback(err);
78273         }
78274         oauth.xhr({
78275           method: "GET",
78276           prefix: false,
78277           path: apiUrlroot + "/api/0.6/changesets?user=" + user.id
78278         }, wrapcb(this, done, _connectionID));
78279       }
78280       function done(err, xml) {
78281         if (err) {
78282           return callback(err);
78283         }
78284         _userChangesets = Array.prototype.map.call(
78285           xml.getElementsByTagName("changeset"),
78286           function(changeset) {
78287             return { tags: getTags(changeset) };
78288           }
78289         ).filter(function(changeset) {
78290           var comment = changeset.tags.comment;
78291           return comment && comment !== "";
78292         });
78293         return callback(void 0, _userChangesets);
78294       }
78295     },
78296     // Fetch the status of the OSM API
78297     // GET /api/capabilities
78298     status: function(callback) {
78299       var url = apiUrlroot + "/api/capabilities";
78300       var errback = wrapcb(this, done, _connectionID);
78301       xml_default(url).then(function(data) {
78302         errback(null, data);
78303       }).catch(function(err) {
78304         errback(err.message);
78305       });
78306       function done(err, xml) {
78307         if (err) {
78308           return callback(err, null);
78309         }
78310         var elements = xml.getElementsByTagName("blacklist");
78311         var regexes = [];
78312         for (var i3 = 0; i3 < elements.length; i3++) {
78313           var regexString = elements[i3].getAttribute("regex");
78314           if (regexString) {
78315             try {
78316               var regex = new RegExp(regexString);
78317               regexes.push(regex);
78318             } catch (e3) {
78319             }
78320           }
78321         }
78322         if (regexes.length) {
78323           _imageryBlocklists = regexes;
78324         }
78325         if (_rateLimitError) {
78326           return callback(_rateLimitError, "rateLimited");
78327         } else {
78328           var waynodes = xml.getElementsByTagName("waynodes");
78329           var maxWayNodes = waynodes.length && parseInt(waynodes[0].getAttribute("maximum"), 10);
78330           if (maxWayNodes && isFinite(maxWayNodes))
78331             _maxWayNodes = maxWayNodes;
78332           var apiStatus = xml.getElementsByTagName("status");
78333           var val = apiStatus[0].getAttribute("api");
78334           return callback(void 0, val);
78335         }
78336       }
78337     },
78338     // Calls `status` and dispatches an `apiStatusChange` event if the returned
78339     // status differs from the cached status.
78340     reloadApiStatus: function() {
78341       if (!this.throttledReloadApiStatus) {
78342         var that = this;
78343         this.throttledReloadApiStatus = throttle_default(function() {
78344           that.status(function(err, status) {
78345             if (status !== _cachedApiStatus) {
78346               _cachedApiStatus = status;
78347               dispatch10.call("apiStatusChange", that, err, status);
78348             }
78349           });
78350         }, 500);
78351       }
78352       this.throttledReloadApiStatus();
78353     },
78354     // Returns the maximum number of nodes a single way can have
78355     maxWayNodes: function() {
78356       return _maxWayNodes;
78357     },
78358     // Load data (entities) from the API in tiles
78359     // GET /api/0.6/map?bbox=
78360     loadTiles: function(projection2, callback) {
78361       if (_off)
78362         return;
78363       var tiles = tiler6.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
78364       var hadRequests = hasInflightRequests(_tileCache);
78365       abortUnwantedRequests4(_tileCache, tiles);
78366       if (hadRequests && !hasInflightRequests(_tileCache)) {
78367         dispatch10.call("loaded");
78368       }
78369       tiles.forEach(function(tile) {
78370         this.loadTile(tile, callback);
78371       }, this);
78372     },
78373     // Load a single data tile
78374     // GET /api/0.6/map?bbox=
78375     loadTile: function(tile, callback) {
78376       if (_off)
78377         return;
78378       if (_tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
78379         return;
78380       if (!hasInflightRequests(_tileCache)) {
78381         dispatch10.call("loading");
78382       }
78383       var path = "/api/0.6/map.json?bbox=";
78384       var options2 = { skipSeen: true };
78385       _tileCache.inflight[tile.id] = this.loadFromAPI(
78386         path + tile.extent.toParam(),
78387         tileCallback,
78388         options2
78389       );
78390       function tileCallback(err, parsed) {
78391         delete _tileCache.inflight[tile.id];
78392         if (!err) {
78393           delete _tileCache.toLoad[tile.id];
78394           _tileCache.loaded[tile.id] = true;
78395           var bbox2 = tile.extent.bbox();
78396           bbox2.id = tile.id;
78397           _tileCache.rtree.insert(bbox2);
78398         }
78399         if (callback) {
78400           callback(err, Object.assign({ data: parsed }, tile));
78401         }
78402         if (!hasInflightRequests(_tileCache)) {
78403           dispatch10.call("loaded");
78404         }
78405       }
78406     },
78407     isDataLoaded: function(loc) {
78408       var bbox2 = { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] };
78409       return _tileCache.rtree.collides(bbox2);
78410     },
78411     // load the tile that covers the given `loc`
78412     loadTileAtLoc: function(loc, callback) {
78413       if (Object.keys(_tileCache.toLoad).length > 50)
78414         return;
78415       var k2 = geoZoomToScale(_tileZoom4 + 1);
78416       var offset = geoRawMercator().scale(k2)(loc);
78417       var projection2 = geoRawMercator().transform({ k: k2, x: -offset[0], y: -offset[1] });
78418       var tiles = tiler6.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
78419       tiles.forEach(function(tile) {
78420         if (_tileCache.toLoad[tile.id] || _tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
78421           return;
78422         _tileCache.toLoad[tile.id] = true;
78423         this.loadTile(tile, callback);
78424       }, this);
78425     },
78426     // Load notes from the API in tiles
78427     // GET /api/0.6/notes?bbox=
78428     loadNotes: function(projection2, noteOptions) {
78429       noteOptions = Object.assign({ limit: 1e4, closed: 7 }, noteOptions);
78430       if (_off)
78431         return;
78432       var that = this;
78433       var path = "/api/0.6/notes?limit=" + noteOptions.limit + "&closed=" + noteOptions.closed + "&bbox=";
78434       var throttleLoadUsers = throttle_default(function() {
78435         var uids = Object.keys(_userCache.toLoad);
78436         if (!uids.length)
78437           return;
78438         that.loadUsers(uids, function() {
78439         });
78440       }, 750);
78441       var tiles = tiler6.zoomExtent([_noteZoom, _noteZoom]).getTiles(projection2);
78442       abortUnwantedRequests4(_noteCache, tiles);
78443       tiles.forEach(function(tile) {
78444         if (_noteCache.loaded[tile.id] || _noteCache.inflight[tile.id])
78445           return;
78446         var options2 = { skipSeen: false };
78447         _noteCache.inflight[tile.id] = that.loadFromAPI(
78448           path + tile.extent.toParam(),
78449           function(err) {
78450             delete _noteCache.inflight[tile.id];
78451             if (!err) {
78452               _noteCache.loaded[tile.id] = true;
78453             }
78454             throttleLoadUsers();
78455             dispatch10.call("loadedNotes");
78456           },
78457           options2
78458         );
78459       });
78460     },
78461     // Create a note
78462     // POST /api/0.6/notes?params
78463     postNoteCreate: function(note, callback) {
78464       if (!this.authenticated()) {
78465         return callback({ message: "Not Authenticated", status: -3 }, note);
78466       }
78467       if (_noteCache.inflightPost[note.id]) {
78468         return callback({ message: "Note update already inflight", status: -2 }, note);
78469       }
78470       if (!note.loc[0] || !note.loc[1] || !note.newComment)
78471         return;
78472       var comment = note.newComment;
78473       if (note.newCategory && note.newCategory !== "None") {
78474         comment += " #" + note.newCategory;
78475       }
78476       var path = "/api/0.6/notes?" + utilQsString({ lon: note.loc[0], lat: note.loc[1], text: comment });
78477       _noteCache.inflightPost[note.id] = oauth.xhr({
78478         method: "POST",
78479         prefix: false,
78480         path: urlroot + path
78481       }, wrapcb(this, done, _connectionID));
78482       function done(err, xml) {
78483         delete _noteCache.inflightPost[note.id];
78484         if (err) {
78485           return callback(err);
78486         }
78487         this.removeNote(note);
78488         var options2 = { skipSeen: false };
78489         return parseXML(xml, function(err2, results) {
78490           if (err2) {
78491             return callback(err2);
78492           } else {
78493             return callback(void 0, results[0]);
78494           }
78495         }, options2);
78496       }
78497     },
78498     // Update a note
78499     // POST /api/0.6/notes/#id/comment?text=comment
78500     // POST /api/0.6/notes/#id/close?text=comment
78501     // POST /api/0.6/notes/#id/reopen?text=comment
78502     postNoteUpdate: function(note, newStatus, callback) {
78503       if (!this.authenticated()) {
78504         return callback({ message: "Not Authenticated", status: -3 }, note);
78505       }
78506       if (_noteCache.inflightPost[note.id]) {
78507         return callback({ message: "Note update already inflight", status: -2 }, note);
78508       }
78509       var action;
78510       if (note.status !== "closed" && newStatus === "closed") {
78511         action = "close";
78512       } else if (note.status !== "open" && newStatus === "open") {
78513         action = "reopen";
78514       } else {
78515         action = "comment";
78516         if (!note.newComment)
78517           return;
78518       }
78519       var path = "/api/0.6/notes/" + note.id + "/" + action;
78520       if (note.newComment) {
78521         path += "?" + utilQsString({ text: note.newComment });
78522       }
78523       _noteCache.inflightPost[note.id] = oauth.xhr({
78524         method: "POST",
78525         prefix: false,
78526         path: urlroot + path
78527       }, wrapcb(this, done, _connectionID));
78528       function done(err, xml) {
78529         delete _noteCache.inflightPost[note.id];
78530         if (err) {
78531           return callback(err);
78532         }
78533         this.removeNote(note);
78534         if (action === "close") {
78535           _noteCache.closed[note.id] = true;
78536         } else if (action === "reopen") {
78537           delete _noteCache.closed[note.id];
78538         }
78539         var options2 = { skipSeen: false };
78540         return parseXML(xml, function(err2, results) {
78541           if (err2) {
78542             return callback(err2);
78543           } else {
78544             return callback(void 0, results[0]);
78545           }
78546         }, options2);
78547       }
78548     },
78549     /* connection options for source switcher (optional) */
78550     apiConnections: function(val) {
78551       if (!arguments.length)
78552         return _apiConnections;
78553       _apiConnections = val;
78554       return this;
78555     },
78556     switch: function(newOptions) {
78557       urlroot = newOptions.url;
78558       apiUrlroot = newOptions.apiUrl || urlroot;
78559       var oldOptions = utilObjectOmit(oauth.options(), "access_token");
78560       oauth.options(Object.assign(oldOptions, newOptions));
78561       this.reset();
78562       this.userChangesets(function() {
78563       });
78564       dispatch10.call("change");
78565       return this;
78566     },
78567     toggle: function(val) {
78568       _off = !val;
78569       return this;
78570     },
78571     isChangesetInflight: function() {
78572       return !!_changeset.inflight;
78573     },
78574     // get/set cached data
78575     // This is used to save/restore the state when entering/exiting the walkthrough
78576     // Also used for testing purposes.
78577     caches: function(obj) {
78578       function cloneCache(source) {
78579         var target = {};
78580         Object.keys(source).forEach(function(k2) {
78581           if (k2 === "rtree") {
78582             target.rtree = new import_rbush10.default().fromJSON(source.rtree.toJSON());
78583           } else if (k2 === "note") {
78584             target.note = {};
78585             Object.keys(source.note).forEach(function(id2) {
78586               target.note[id2] = osmNote(source.note[id2]);
78587             });
78588           } else {
78589             target[k2] = JSON.parse(JSON.stringify(source[k2]));
78590           }
78591         });
78592         return target;
78593       }
78594       if (!arguments.length) {
78595         return {
78596           tile: cloneCache(_tileCache),
78597           note: cloneCache(_noteCache),
78598           user: cloneCache(_userCache)
78599         };
78600       }
78601       if (obj === "get") {
78602         return {
78603           tile: _tileCache,
78604           note: _noteCache,
78605           user: _userCache
78606         };
78607       }
78608       if (obj.tile) {
78609         _tileCache = obj.tile;
78610         _tileCache.inflight = {};
78611       }
78612       if (obj.note) {
78613         _noteCache = obj.note;
78614         _noteCache.inflight = {};
78615         _noteCache.inflightPost = {};
78616       }
78617       if (obj.user) {
78618         _userCache = obj.user;
78619       }
78620       return this;
78621     },
78622     logout: function() {
78623       _userChangesets = void 0;
78624       _userDetails = void 0;
78625       oauth.logout();
78626       dispatch10.call("change");
78627       return this;
78628     },
78629     authenticated: function() {
78630       return oauth.authenticated();
78631     },
78632     authenticate: function(callback) {
78633       var that = this;
78634       var cid = _connectionID;
78635       _userChangesets = void 0;
78636       _userDetails = void 0;
78637       function done(err, res) {
78638         if (err) {
78639           if (callback)
78640             callback(err);
78641           return;
78642         }
78643         if (that.getConnectionId() !== cid) {
78644           if (callback)
78645             callback({ message: "Connection Switched", status: -1 });
78646           return;
78647         }
78648         _rateLimitError = void 0;
78649         dispatch10.call("change");
78650         if (callback)
78651           callback(err, res);
78652         that.userChangesets(function() {
78653         });
78654       }
78655       oauth.authenticate(done);
78656     },
78657     imageryBlocklists: function() {
78658       return _imageryBlocklists;
78659     },
78660     tileZoom: function(val) {
78661       if (!arguments.length)
78662         return _tileZoom4;
78663       _tileZoom4 = val;
78664       return this;
78665     },
78666     // get all cached notes covering the viewport
78667     notes: function(projection2) {
78668       var viewport = projection2.clipExtent();
78669       var min3 = [viewport[0][0], viewport[1][1]];
78670       var max3 = [viewport[1][0], viewport[0][1]];
78671       var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
78672       return _noteCache.rtree.search(bbox2).map(function(d2) {
78673         return d2.data;
78674       });
78675     },
78676     // get a single note from the cache
78677     getNote: function(id2) {
78678       return _noteCache.note[id2];
78679     },
78680     // remove a single note from the cache
78681     removeNote: function(note) {
78682       if (!(note instanceof osmNote) || !note.id)
78683         return;
78684       delete _noteCache.note[note.id];
78685       updateRtree4(encodeNoteRtree(note), false);
78686     },
78687     // replace a single note in the cache
78688     replaceNote: function(note) {
78689       if (!(note instanceof osmNote) || !note.id)
78690         return;
78691       _noteCache.note[note.id] = note;
78692       updateRtree4(encodeNoteRtree(note), true);
78693       return note;
78694     },
78695     // Get an array of note IDs closed during this session.
78696     // Used to populate `closed:note` changeset tag
78697     getClosedIDs: function() {
78698       return Object.keys(_noteCache.closed).sort();
78699     }
78700   };
78701
78702   // modules/services/osm_wikibase.js
78703   var apibase3 = "https://wiki.openstreetmap.org/w/api.php";
78704   var _inflight2 = {};
78705   var _wikibaseCache = {};
78706   var _localeIDs = { en: false };
78707   var debouncedRequest = debounce_default(request, 500, { leading: false });
78708   function request(url, callback) {
78709     if (_inflight2[url])
78710       return;
78711     var controller = new AbortController();
78712     _inflight2[url] = controller;
78713     json_default(url, { signal: controller.signal }).then(function(result) {
78714       delete _inflight2[url];
78715       if (callback)
78716         callback(null, result);
78717     }).catch(function(err) {
78718       delete _inflight2[url];
78719       if (err.name === "AbortError")
78720         return;
78721       if (callback)
78722         callback(err.message);
78723     });
78724   }
78725   var osm_wikibase_default = {
78726     init: function() {
78727       _inflight2 = {};
78728       _wikibaseCache = {};
78729       _localeIDs = {};
78730     },
78731     reset: function() {
78732       Object.values(_inflight2).forEach(function(controller) {
78733         controller.abort();
78734       });
78735       _inflight2 = {};
78736     },
78737     /**
78738      * Get the best value for the property, or undefined if not found
78739      * @param entity object from wikibase
78740      * @param property string e.g. 'P4' for image
78741      * @param langCode string e.g. 'fr' for French
78742      */
78743     claimToValue: function(entity, property, langCode) {
78744       if (!entity.claims[property])
78745         return void 0;
78746       var locale2 = _localeIDs[langCode];
78747       var preferredPick, localePick;
78748       entity.claims[property].forEach(function(stmt) {
78749         if (!preferredPick && stmt.rank === "preferred") {
78750           preferredPick = stmt;
78751         }
78752         if (locale2 && stmt.qualifiers && stmt.qualifiers.P26 && stmt.qualifiers.P26[0].datavalue.value.id === locale2) {
78753           localePick = stmt;
78754         }
78755       });
78756       var result = localePick || preferredPick;
78757       if (result) {
78758         var datavalue = result.mainsnak.datavalue;
78759         return datavalue.type === "wikibase-entityid" ? datavalue.value.id : datavalue.value;
78760       } else {
78761         return void 0;
78762       }
78763     },
78764     /**
78765      * Convert monolingual property into a key-value object (language -> value)
78766      * @param entity object from wikibase
78767      * @param property string e.g. 'P31' for monolingual wiki page title
78768      */
78769     monolingualClaimToValueObj: function(entity, property) {
78770       if (!entity || !entity.claims[property])
78771         return void 0;
78772       return entity.claims[property].reduce(function(acc, obj) {
78773         var value = obj.mainsnak.datavalue.value;
78774         acc[value.language] = value.text;
78775         return acc;
78776       }, {});
78777     },
78778     toSitelink: function(key, value) {
78779       var result = value ? "Tag:" + key + "=" + value : "Key:" + key;
78780       return result.replace(/_/g, " ").trim();
78781     },
78782     //
78783     // Pass params object of the form:
78784     // {
78785     //   key: 'string',
78786     //   value: 'string',
78787     //   langCode: 'string'
78788     // }
78789     //
78790     getEntity: function(params, callback) {
78791       var doRequest = params.debounce ? debouncedRequest : request;
78792       var that = this;
78793       var titles = [];
78794       var result = {};
78795       var rtypeSitelink = params.key === "type" && params.value ? ("Relation:" + params.value).replace(/_/g, " ").trim() : false;
78796       var keySitelink = params.key ? this.toSitelink(params.key) : false;
78797       var tagSitelink = params.key && params.value ? this.toSitelink(params.key, params.value) : false;
78798       var localeSitelink;
78799       if (params.langCodes) {
78800         params.langCodes.forEach(function(langCode) {
78801           if (_localeIDs[langCode] === void 0) {
78802             localeSitelink = ("Locale:" + langCode).replace(/_/g, " ").trim();
78803             titles.push(localeSitelink);
78804           }
78805         });
78806       }
78807       if (rtypeSitelink) {
78808         if (_wikibaseCache[rtypeSitelink]) {
78809           result.rtype = _wikibaseCache[rtypeSitelink];
78810         } else {
78811           titles.push(rtypeSitelink);
78812         }
78813       }
78814       if (keySitelink) {
78815         if (_wikibaseCache[keySitelink]) {
78816           result.key = _wikibaseCache[keySitelink];
78817         } else {
78818           titles.push(keySitelink);
78819         }
78820       }
78821       if (tagSitelink) {
78822         if (_wikibaseCache[tagSitelink]) {
78823           result.tag = _wikibaseCache[tagSitelink];
78824         } else {
78825           titles.push(tagSitelink);
78826         }
78827       }
78828       if (!titles.length) {
78829         return callback(null, result);
78830       }
78831       var obj = {
78832         action: "wbgetentities",
78833         sites: "wiki",
78834         titles: titles.join("|"),
78835         languages: params.langCodes.join("|"),
78836         languagefallback: 1,
78837         origin: "*",
78838         format: "json"
78839         // There is an MW Wikibase API bug https://phabricator.wikimedia.org/T212069
78840         // We shouldn't use v1 until it gets fixed, but should switch to it afterwards
78841         // formatversion: 2,
78842       };
78843       var url = apibase3 + "?" + utilQsString(obj);
78844       doRequest(url, function(err, d2) {
78845         if (err) {
78846           callback(err);
78847         } else if (!d2.success || d2.error) {
78848           callback(d2.error.messages.map(function(v2) {
78849             return v2.html["*"];
78850           }).join("<br>"));
78851         } else {
78852           var localeID = false;
78853           Object.values(d2.entities).forEach(function(res) {
78854             if (res.missing !== "") {
78855               var title = res.sitelinks.wiki.title;
78856               if (title === rtypeSitelink) {
78857                 _wikibaseCache[rtypeSitelink] = res;
78858                 result.rtype = res;
78859               } else if (title === keySitelink) {
78860                 _wikibaseCache[keySitelink] = res;
78861                 result.key = res;
78862               } else if (title === tagSitelink) {
78863                 _wikibaseCache[tagSitelink] = res;
78864                 result.tag = res;
78865               } else if (title === localeSitelink) {
78866                 localeID = res.id;
78867               } else {
78868                 console.log("Unexpected title " + title);
78869               }
78870             }
78871           });
78872           if (localeSitelink) {
78873             that.addLocale(params.langCodes[0], localeID);
78874           }
78875           callback(null, result);
78876         }
78877       });
78878     },
78879     //
78880     // Pass params object of the form:
78881     // {
78882     //   key: 'string',     // required
78883     //   value: 'string'    // optional
78884     // }
78885     //
78886     // Get an result object used to display tag documentation
78887     // {
78888     //   title:        'string',
78889     //   description:  'string',
78890     //   editURL:      'string',
78891     //   imageURL:     'string',
78892     //   wiki:         { title: 'string', text: 'string', url: 'string' }
78893     // }
78894     //
78895     getDocs: function(params, callback) {
78896       var that = this;
78897       var langCodes = _mainLocalizer.localeCodes().map(function(code) {
78898         return code.toLowerCase();
78899       });
78900       params.langCodes = langCodes;
78901       this.getEntity(params, function(err, data) {
78902         if (err) {
78903           callback(err);
78904           return;
78905         }
78906         var entity = data.rtype || data.tag || data.key;
78907         if (!entity) {
78908           callback("No entity");
78909           return;
78910         }
78911         var i3;
78912         var description;
78913         for (i3 in langCodes) {
78914           let code2 = langCodes[i3];
78915           if (entity.descriptions[code2] && entity.descriptions[code2].language === code2) {
78916             description = entity.descriptions[code2];
78917             break;
78918           }
78919         }
78920         if (!description && Object.values(entity.descriptions).length)
78921           description = Object.values(entity.descriptions)[0];
78922         var result = {
78923           title: entity.title,
78924           description: description ? description.value : "",
78925           descriptionLocaleCode: description ? description.language : "",
78926           editURL: "https://wiki.openstreetmap.org/wiki/" + entity.title
78927         };
78928         if (entity.claims) {
78929           var imageroot;
78930           var image = that.claimToValue(entity, "P4", langCodes[0]);
78931           if (image) {
78932             imageroot = "https://commons.wikimedia.org/w/index.php";
78933           } else {
78934             image = that.claimToValue(entity, "P28", langCodes[0]);
78935             if (image) {
78936               imageroot = "https://wiki.openstreetmap.org/w/index.php";
78937             }
78938           }
78939           if (imageroot && image) {
78940             result.imageURL = imageroot + "?" + utilQsString({
78941               title: "Special:Redirect/file/" + image,
78942               width: 400
78943             });
78944           }
78945         }
78946         var rtypeWiki = that.monolingualClaimToValueObj(data.rtype, "P31");
78947         var tagWiki = that.monolingualClaimToValueObj(data.tag, "P31");
78948         var keyWiki = that.monolingualClaimToValueObj(data.key, "P31");
78949         var wikis = [rtypeWiki, tagWiki, keyWiki];
78950         for (i3 in wikis) {
78951           var wiki = wikis[i3];
78952           for (var j3 in langCodes) {
78953             var code = langCodes[j3];
78954             var referenceId = langCodes[0].split("-")[0] !== "en" && code.split("-")[0] === "en" ? "inspector.wiki_en_reference" : "inspector.wiki_reference";
78955             var info = getWikiInfo(wiki, code, referenceId);
78956             if (info) {
78957               result.wiki = info;
78958               break;
78959             }
78960           }
78961           if (result.wiki)
78962             break;
78963         }
78964         callback(null, result);
78965         function getWikiInfo(wiki2, langCode, tKey) {
78966           if (wiki2 && wiki2[langCode]) {
78967             return {
78968               title: wiki2[langCode],
78969               text: tKey,
78970               url: "https://wiki.openstreetmap.org/wiki/" + wiki2[langCode]
78971             };
78972           }
78973         }
78974       });
78975     },
78976     addLocale: function(langCode, qid) {
78977       _localeIDs[langCode] = qid;
78978     },
78979     apibase: function(val) {
78980       if (!arguments.length)
78981         return apibase3;
78982       apibase3 = val;
78983       return this;
78984     }
78985   };
78986
78987   // modules/services/streetside.js
78988   var import_rbush11 = __toESM(require_rbush_min());
78989
78990   // modules/util/jsonp_request.js
78991   var jsonpCache = {};
78992   window.jsonpCache = jsonpCache;
78993   function jsonpRequest(url, callback) {
78994     var request3 = {
78995       abort: function() {
78996       }
78997     };
78998     if (window.JSONP_FIX) {
78999       if (window.JSONP_DELAY === 0) {
79000         callback(window.JSONP_FIX);
79001       } else {
79002         var t2 = window.setTimeout(function() {
79003           callback(window.JSONP_FIX);
79004         }, window.JSONP_DELAY || 0);
79005         request3.abort = function() {
79006           window.clearTimeout(t2);
79007         };
79008       }
79009       return request3;
79010     }
79011     function rand() {
79012       var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
79013       var c2 = "";
79014       var i3 = -1;
79015       while (++i3 < 15)
79016         c2 += chars.charAt(Math.floor(Math.random() * 52));
79017       return c2;
79018     }
79019     function create2(url2) {
79020       var e3 = url2.match(/callback=(\w+)/);
79021       var c2 = e3 ? e3[1] : rand();
79022       jsonpCache[c2] = function(data) {
79023         if (jsonpCache[c2]) {
79024           callback(data);
79025         }
79026         finalize();
79027       };
79028       function finalize() {
79029         delete jsonpCache[c2];
79030         script.remove();
79031       }
79032       request3.abort = finalize;
79033       return "jsonpCache." + c2;
79034     }
79035     var cb = create2(url);
79036     var script = select_default2("head").append("script").attr("type", "text/javascript").attr("src", url.replace(/(\{|%7B)callback(\}|%7D)/, cb));
79037     return request3;
79038   }
79039
79040   // modules/services/streetside.js
79041   var bubbleApi = "https://dev.virtualearth.net/mapcontrol/HumanScaleServices/GetBubbles.ashx?";
79042   var streetsideImagesApi = "https://t.ssl.ak.tiles.virtualearth.net/tiles/";
79043   var bubbleAppKey = "AuftgJsO0Xs8Ts4M1xZUQJQXJNsvmh3IV8DkNieCiy3tCwCUMq76-WpkrBtNAuEm";
79044   var pannellumViewerCSS2 = "pannellum/pannellum.css";
79045   var pannellumViewerJS2 = "pannellum/pannellum.js";
79046   var maxResults2 = 2e3;
79047   var tileZoom3 = 16.5;
79048   var tiler7 = utilTiler().zoomExtent([tileZoom3, tileZoom3]).skipNullIsland(true);
79049   var dispatch11 = dispatch_default("loadedImages", "viewerChanged");
79050   var minHfov = 10;
79051   var maxHfov = 90;
79052   var defaultHfov = 45;
79053   var _hires = false;
79054   var _resolution = 512;
79055   var _currScene = 0;
79056   var _ssCache;
79057   var _pannellumViewer2;
79058   var _sceneOptions = {
79059     showFullscreenCtrl: false,
79060     autoLoad: true,
79061     compass: true,
79062     yaw: 0,
79063     minHfov,
79064     maxHfov,
79065     hfov: defaultHfov,
79066     type: "cubemap",
79067     cubeMap: []
79068   };
79069   var _loadViewerPromise4;
79070   function abortRequest6(i3) {
79071     i3.abort();
79072   }
79073   function localeTimestamp2(s2) {
79074     if (!s2)
79075       return null;
79076     const options2 = { day: "numeric", month: "short", year: "numeric" };
79077     const d2 = new Date(s2);
79078     if (isNaN(d2.getTime()))
79079       return null;
79080     return d2.toLocaleString(_mainLocalizer.localeCode(), options2);
79081   }
79082   function loadTiles3(which, url, projection2, margin) {
79083     const tiles = tiler7.margin(margin).getTiles(projection2);
79084     const cache = _ssCache[which];
79085     Object.keys(cache.inflight).forEach((k2) => {
79086       const wanted = tiles.find((tile) => k2.indexOf(tile.id + ",") === 0);
79087       if (!wanted) {
79088         abortRequest6(cache.inflight[k2]);
79089         delete cache.inflight[k2];
79090       }
79091     });
79092     tiles.forEach((tile) => loadNextTilePage2(which, url, tile));
79093   }
79094   function loadNextTilePage2(which, url, tile) {
79095     const cache = _ssCache[which];
79096     const nextPage = cache.nextPage[tile.id] || 0;
79097     const id2 = tile.id + "," + String(nextPage);
79098     if (cache.loaded[id2] || cache.inflight[id2])
79099       return;
79100     cache.inflight[id2] = getBubbles(url, tile, (bubbles) => {
79101       cache.loaded[id2] = true;
79102       delete cache.inflight[id2];
79103       if (!bubbles)
79104         return;
79105       bubbles.shift();
79106       const features = bubbles.map((bubble) => {
79107         if (cache.points[bubble.id])
79108           return null;
79109         const loc = [bubble.lo, bubble.la];
79110         const d2 = {
79111           loc,
79112           key: bubble.id,
79113           ca: bubble.he,
79114           captured_at: bubble.cd,
79115           captured_by: "microsoft",
79116           // nbn: bubble.nbn,
79117           // pbn: bubble.pbn,
79118           // ad: bubble.ad,
79119           // rn: bubble.rn,
79120           pr: bubble.pr,
79121           // previous
79122           ne: bubble.ne,
79123           // next
79124           pano: true,
79125           sequenceKey: null
79126         };
79127         cache.points[bubble.id] = d2;
79128         if (bubble.pr === void 0) {
79129           cache.leaders.push(bubble.id);
79130         }
79131         return {
79132           minX: loc[0],
79133           minY: loc[1],
79134           maxX: loc[0],
79135           maxY: loc[1],
79136           data: d2
79137         };
79138       }).filter(Boolean);
79139       cache.rtree.load(features);
79140       connectSequences();
79141       if (which === "bubbles") {
79142         dispatch11.call("loadedImages");
79143       }
79144     });
79145   }
79146   function connectSequences() {
79147     let cache = _ssCache.bubbles;
79148     let keepLeaders = [];
79149     for (let i3 = 0; i3 < cache.leaders.length; i3++) {
79150       let bubble = cache.points[cache.leaders[i3]];
79151       let seen = {};
79152       let sequence = { key: bubble.key, bubbles: [] };
79153       let complete = false;
79154       do {
79155         sequence.bubbles.push(bubble);
79156         seen[bubble.key] = true;
79157         if (bubble.ne === void 0) {
79158           complete = true;
79159         } else {
79160           bubble = cache.points[bubble.ne];
79161         }
79162       } while (bubble && !seen[bubble.key] && !complete);
79163       if (complete) {
79164         _ssCache.sequences[sequence.key] = sequence;
79165         for (let j3 = 0; j3 < sequence.bubbles.length; j3++) {
79166           sequence.bubbles[j3].sequenceKey = sequence.key;
79167         }
79168         sequence.geojson = {
79169           type: "LineString",
79170           properties: {
79171             captured_at: sequence.bubbles[0] ? sequence.bubbles[0].captured_at : null,
79172             captured_by: sequence.bubbles[0] ? sequence.bubbles[0].captured_by : null,
79173             key: sequence.key
79174           },
79175           coordinates: sequence.bubbles.map((d2) => d2.loc)
79176         };
79177       } else {
79178         keepLeaders.push(cache.leaders[i3]);
79179       }
79180     }
79181     cache.leaders = keepLeaders;
79182   }
79183   function getBubbles(url, tile, callback) {
79184     let rect = tile.extent.rectangle();
79185     let urlForRequest = url + utilQsString({
79186       n: rect[3],
79187       s: rect[1],
79188       e: rect[2],
79189       w: rect[0],
79190       c: maxResults2,
79191       appkey: bubbleAppKey,
79192       jsCallback: "{callback}"
79193     });
79194     return jsonpRequest(urlForRequest, (data) => {
79195       if (!data || data.error) {
79196         callback(null);
79197       } else {
79198         callback(data);
79199       }
79200     });
79201   }
79202   function partitionViewport4(projection2) {
79203     let z2 = geoScaleToZoom(projection2.scale());
79204     let z22 = Math.ceil(z2 * 2) / 2 + 2.5;
79205     let tiler9 = utilTiler().zoomExtent([z22, z22]);
79206     return tiler9.getTiles(projection2).map((tile) => tile.extent);
79207   }
79208   function searchLimited4(limit, projection2, rtree) {
79209     limit = limit || 5;
79210     return partitionViewport4(projection2).reduce((result, extent) => {
79211       let found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
79212       return found.length ? result.concat(found) : result;
79213     }, []);
79214   }
79215   function loadImage2(imgInfo) {
79216     return new Promise((resolve) => {
79217       let img = new Image();
79218       img.onload = () => {
79219         let canvas = document.getElementById("ideditor-canvas" + imgInfo.face);
79220         let ctx = canvas.getContext("2d");
79221         ctx.drawImage(img, imgInfo.x, imgInfo.y);
79222         resolve({ imgInfo, status: "ok" });
79223       };
79224       img.onerror = () => {
79225         resolve({ data: imgInfo, status: "error" });
79226       };
79227       img.setAttribute("crossorigin", "");
79228       img.src = imgInfo.url;
79229     });
79230   }
79231   function loadCanvas(imageGroup) {
79232     return Promise.all(imageGroup.map(loadImage2)).then((data) => {
79233       let canvas = document.getElementById("ideditor-canvas" + data[0].imgInfo.face);
79234       const which = { "01": 0, "02": 1, "03": 2, "10": 3, "11": 4, "12": 5 };
79235       let face = data[0].imgInfo.face;
79236       _sceneOptions.cubeMap[which[face]] = canvas.toDataURL("image/jpeg", 1);
79237       return { status: "loadCanvas for face " + data[0].imgInfo.face + "ok" };
79238     });
79239   }
79240   function loadFaces(faceGroup) {
79241     return Promise.all(faceGroup.map(loadCanvas)).then(() => {
79242       return { status: "loadFaces done" };
79243     });
79244   }
79245   function setupCanvas(selection2, reset) {
79246     if (reset) {
79247       selection2.selectAll("#ideditor-stitcher-canvases").remove();
79248     }
79249     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);
79250   }
79251   function qkToXY(qk) {
79252     let x2 = 0;
79253     let y2 = 0;
79254     let scale = 256;
79255     for (let i3 = qk.length; i3 > 0; i3--) {
79256       const key = qk[i3 - 1];
79257       x2 += +(key === "1" || key === "3") * scale;
79258       y2 += +(key === "2" || key === "3") * scale;
79259       scale *= 2;
79260     }
79261     return [x2, y2];
79262   }
79263   function getQuadKeys() {
79264     let dim = _resolution / 256;
79265     let quadKeys;
79266     if (dim === 16) {
79267       quadKeys = [
79268         "0000",
79269         "0001",
79270         "0010",
79271         "0011",
79272         "0100",
79273         "0101",
79274         "0110",
79275         "0111",
79276         "1000",
79277         "1001",
79278         "1010",
79279         "1011",
79280         "1100",
79281         "1101",
79282         "1110",
79283         "1111",
79284         "0002",
79285         "0003",
79286         "0012",
79287         "0013",
79288         "0102",
79289         "0103",
79290         "0112",
79291         "0113",
79292         "1002",
79293         "1003",
79294         "1012",
79295         "1013",
79296         "1102",
79297         "1103",
79298         "1112",
79299         "1113",
79300         "0020",
79301         "0021",
79302         "0030",
79303         "0031",
79304         "0120",
79305         "0121",
79306         "0130",
79307         "0131",
79308         "1020",
79309         "1021",
79310         "1030",
79311         "1031",
79312         "1120",
79313         "1121",
79314         "1130",
79315         "1131",
79316         "0022",
79317         "0023",
79318         "0032",
79319         "0033",
79320         "0122",
79321         "0123",
79322         "0132",
79323         "0133",
79324         "1022",
79325         "1023",
79326         "1032",
79327         "1033",
79328         "1122",
79329         "1123",
79330         "1132",
79331         "1133",
79332         "0200",
79333         "0201",
79334         "0210",
79335         "0211",
79336         "0300",
79337         "0301",
79338         "0310",
79339         "0311",
79340         "1200",
79341         "1201",
79342         "1210",
79343         "1211",
79344         "1300",
79345         "1301",
79346         "1310",
79347         "1311",
79348         "0202",
79349         "0203",
79350         "0212",
79351         "0213",
79352         "0302",
79353         "0303",
79354         "0312",
79355         "0313",
79356         "1202",
79357         "1203",
79358         "1212",
79359         "1213",
79360         "1302",
79361         "1303",
79362         "1312",
79363         "1313",
79364         "0220",
79365         "0221",
79366         "0230",
79367         "0231",
79368         "0320",
79369         "0321",
79370         "0330",
79371         "0331",
79372         "1220",
79373         "1221",
79374         "1230",
79375         "1231",
79376         "1320",
79377         "1321",
79378         "1330",
79379         "1331",
79380         "0222",
79381         "0223",
79382         "0232",
79383         "0233",
79384         "0322",
79385         "0323",
79386         "0332",
79387         "0333",
79388         "1222",
79389         "1223",
79390         "1232",
79391         "1233",
79392         "1322",
79393         "1323",
79394         "1332",
79395         "1333",
79396         "2000",
79397         "2001",
79398         "2010",
79399         "2011",
79400         "2100",
79401         "2101",
79402         "2110",
79403         "2111",
79404         "3000",
79405         "3001",
79406         "3010",
79407         "3011",
79408         "3100",
79409         "3101",
79410         "3110",
79411         "3111",
79412         "2002",
79413         "2003",
79414         "2012",
79415         "2013",
79416         "2102",
79417         "2103",
79418         "2112",
79419         "2113",
79420         "3002",
79421         "3003",
79422         "3012",
79423         "3013",
79424         "3102",
79425         "3103",
79426         "3112",
79427         "3113",
79428         "2020",
79429         "2021",
79430         "2030",
79431         "2031",
79432         "2120",
79433         "2121",
79434         "2130",
79435         "2131",
79436         "3020",
79437         "3021",
79438         "3030",
79439         "3031",
79440         "3120",
79441         "3121",
79442         "3130",
79443         "3131",
79444         "2022",
79445         "2023",
79446         "2032",
79447         "2033",
79448         "2122",
79449         "2123",
79450         "2132",
79451         "2133",
79452         "3022",
79453         "3023",
79454         "3032",
79455         "3033",
79456         "3122",
79457         "3123",
79458         "3132",
79459         "3133",
79460         "2200",
79461         "2201",
79462         "2210",
79463         "2211",
79464         "2300",
79465         "2301",
79466         "2310",
79467         "2311",
79468         "3200",
79469         "3201",
79470         "3210",
79471         "3211",
79472         "3300",
79473         "3301",
79474         "3310",
79475         "3311",
79476         "2202",
79477         "2203",
79478         "2212",
79479         "2213",
79480         "2302",
79481         "2303",
79482         "2312",
79483         "2313",
79484         "3202",
79485         "3203",
79486         "3212",
79487         "3213",
79488         "3302",
79489         "3303",
79490         "3312",
79491         "3313",
79492         "2220",
79493         "2221",
79494         "2230",
79495         "2231",
79496         "2320",
79497         "2321",
79498         "2330",
79499         "2331",
79500         "3220",
79501         "3221",
79502         "3230",
79503         "3231",
79504         "3320",
79505         "3321",
79506         "3330",
79507         "3331",
79508         "2222",
79509         "2223",
79510         "2232",
79511         "2233",
79512         "2322",
79513         "2323",
79514         "2332",
79515         "2333",
79516         "3222",
79517         "3223",
79518         "3232",
79519         "3233",
79520         "3322",
79521         "3323",
79522         "3332",
79523         "3333"
79524       ];
79525     } else if (dim === 8) {
79526       quadKeys = [
79527         "000",
79528         "001",
79529         "010",
79530         "011",
79531         "100",
79532         "101",
79533         "110",
79534         "111",
79535         "002",
79536         "003",
79537         "012",
79538         "013",
79539         "102",
79540         "103",
79541         "112",
79542         "113",
79543         "020",
79544         "021",
79545         "030",
79546         "031",
79547         "120",
79548         "121",
79549         "130",
79550         "131",
79551         "022",
79552         "023",
79553         "032",
79554         "033",
79555         "122",
79556         "123",
79557         "132",
79558         "133",
79559         "200",
79560         "201",
79561         "210",
79562         "211",
79563         "300",
79564         "301",
79565         "310",
79566         "311",
79567         "202",
79568         "203",
79569         "212",
79570         "213",
79571         "302",
79572         "303",
79573         "312",
79574         "313",
79575         "220",
79576         "221",
79577         "230",
79578         "231",
79579         "320",
79580         "321",
79581         "330",
79582         "331",
79583         "222",
79584         "223",
79585         "232",
79586         "233",
79587         "322",
79588         "323",
79589         "332",
79590         "333"
79591       ];
79592     } else if (dim === 4) {
79593       quadKeys = [
79594         "00",
79595         "01",
79596         "10",
79597         "11",
79598         "02",
79599         "03",
79600         "12",
79601         "13",
79602         "20",
79603         "21",
79604         "30",
79605         "31",
79606         "22",
79607         "23",
79608         "32",
79609         "33"
79610       ];
79611     } else {
79612       quadKeys = [
79613         "0",
79614         "1",
79615         "2",
79616         "3"
79617       ];
79618     }
79619     return quadKeys;
79620   }
79621   var streetside_default = {
79622     /**
79623      * init() initialize streetside.
79624      */
79625     init: function() {
79626       if (!_ssCache) {
79627         this.reset();
79628       }
79629       this.event = utilRebind(this, dispatch11, "on");
79630     },
79631     /**
79632      * reset() reset the cache.
79633      */
79634     reset: function() {
79635       if (_ssCache) {
79636         Object.values(_ssCache.bubbles.inflight).forEach(abortRequest6);
79637       }
79638       _ssCache = {
79639         bubbles: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush11.default(), points: {}, leaders: [] },
79640         sequences: {}
79641       };
79642     },
79643     /**
79644      * bubbles()
79645      */
79646     bubbles: function(projection2) {
79647       const limit = 5;
79648       return searchLimited4(limit, projection2, _ssCache.bubbles.rtree);
79649     },
79650     cachedImage: function(imageKey) {
79651       return _ssCache.bubbles.points[imageKey];
79652     },
79653     sequences: function(projection2) {
79654       const viewport = projection2.clipExtent();
79655       const min3 = [viewport[0][0], viewport[1][1]];
79656       const max3 = [viewport[1][0], viewport[0][1]];
79657       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
79658       let seen = {};
79659       let results = [];
79660       _ssCache.bubbles.rtree.search(bbox2).forEach((d2) => {
79661         const key = d2.data.sequenceKey;
79662         if (key && !seen[key]) {
79663           seen[key] = true;
79664           results.push(_ssCache.sequences[key].geojson);
79665         }
79666       });
79667       return results;
79668     },
79669     /**
79670      * loadBubbles()
79671      */
79672     loadBubbles: function(projection2, margin) {
79673       if (margin === void 0)
79674         margin = 2;
79675       loadTiles3("bubbles", bubbleApi, projection2, margin);
79676     },
79677     viewer: function() {
79678       return _pannellumViewer2;
79679     },
79680     initViewer: function() {
79681       if (!window.pannellum)
79682         return;
79683       if (_pannellumViewer2)
79684         return;
79685       _currScene += 1;
79686       const sceneID = _currScene.toString();
79687       const options2 = {
79688         "default": { firstScene: sceneID },
79689         scenes: {}
79690       };
79691       options2.scenes[sceneID] = _sceneOptions;
79692       _pannellumViewer2 = window.pannellum.viewer("ideditor-viewer-streetside", options2);
79693     },
79694     ensureViewerLoaded: function(context) {
79695       if (_loadViewerPromise4)
79696         return _loadViewerPromise4;
79697       let wrap2 = context.container().select(".photoviewer").selectAll(".ms-wrapper").data([0]);
79698       let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper ms-wrapper").classed("hide", true);
79699       let that = this;
79700       let pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
79701       wrapEnter.append("div").attr("id", "ideditor-viewer-streetside").on(pointerPrefix + "down.streetside", () => {
79702         select_default2(window).on(pointerPrefix + "move.streetside", () => {
79703           dispatch11.call("viewerChanged");
79704         }, true);
79705       }).on(pointerPrefix + "up.streetside pointercancel.streetside", () => {
79706         select_default2(window).on(pointerPrefix + "move.streetside", null);
79707         let t2 = timer((elapsed) => {
79708           dispatch11.call("viewerChanged");
79709           if (elapsed > 2e3) {
79710             t2.stop();
79711           }
79712         });
79713       }).append("div").attr("class", "photo-attribution fillD");
79714       let controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
79715       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
79716       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
79717       wrap2 = wrap2.merge(wrapEnter).call(setupCanvas, true);
79718       context.ui().photoviewer.on("resize.streetside", () => {
79719         if (_pannellumViewer2) {
79720           _pannellumViewer2.resize();
79721         }
79722       });
79723       _loadViewerPromise4 = new Promise((resolve, reject) => {
79724         let loadedCount = 0;
79725         function loaded() {
79726           loadedCount += 1;
79727           if (loadedCount === 2)
79728             resolve();
79729         }
79730         const head = select_default2("head");
79731         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() {
79732           reject();
79733         });
79734         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() {
79735           reject();
79736         });
79737       }).catch(function() {
79738         _loadViewerPromise4 = null;
79739       });
79740       return _loadViewerPromise4;
79741       function step(stepBy) {
79742         return () => {
79743           let viewer = context.container().select(".photoviewer");
79744           let selected = viewer.empty() ? void 0 : viewer.datum();
79745           if (!selected)
79746             return;
79747           let nextID = stepBy === 1 ? selected.ne : selected.pr;
79748           let yaw = _pannellumViewer2.getYaw();
79749           let ca = selected.ca + yaw;
79750           let origin = selected.loc;
79751           const meters = 35;
79752           let p1 = [
79753             origin[0] + geoMetersToLon(meters / 5, origin[1]),
79754             origin[1]
79755           ];
79756           let p2 = [
79757             origin[0] + geoMetersToLon(meters / 2, origin[1]),
79758             origin[1] + geoMetersToLat(meters)
79759           ];
79760           let p3 = [
79761             origin[0] - geoMetersToLon(meters / 2, origin[1]),
79762             origin[1] + geoMetersToLat(meters)
79763           ];
79764           let p4 = [
79765             origin[0] - geoMetersToLon(meters / 5, origin[1]),
79766             origin[1]
79767           ];
79768           let poly = [p1, p2, p3, p4, p1];
79769           let angle2 = (stepBy === 1 ? ca : ca + 180) * (Math.PI / 180);
79770           poly = geoRotate(poly, -angle2, origin);
79771           let extent = poly.reduce((extent2, point2) => {
79772             return extent2.extend(geoExtent(point2));
79773           }, geoExtent());
79774           let minDist = Infinity;
79775           _ssCache.bubbles.rtree.search(extent.bbox()).forEach((d2) => {
79776             if (d2.data.key === selected.key)
79777               return;
79778             if (!geoPointInPolygon(d2.data.loc, poly))
79779               return;
79780             let dist = geoVecLength(d2.data.loc, selected.loc);
79781             let theta = selected.ca - d2.data.ca;
79782             let minTheta = Math.min(Math.abs(theta), 360 - Math.abs(theta));
79783             if (minTheta > 20) {
79784               dist += 5;
79785             }
79786             if (dist < minDist) {
79787               nextID = d2.data.key;
79788               minDist = dist;
79789             }
79790           });
79791           let nextBubble = nextID && that.cachedImage(nextID);
79792           if (!nextBubble)
79793             return;
79794           context.map().centerEase(nextBubble.loc);
79795           that.selectImage(context, nextBubble.key).yaw(yaw).showViewer(context);
79796         };
79797       }
79798     },
79799     yaw: function(yaw) {
79800       if (typeof yaw !== "number")
79801         return yaw;
79802       _sceneOptions.yaw = yaw;
79803       return this;
79804     },
79805     /**
79806      * showViewer()
79807      */
79808     showViewer: function(context) {
79809       let wrap2 = context.container().select(".photoviewer").classed("hide", false);
79810       let isHidden = wrap2.selectAll(".photo-wrapper.ms-wrapper.hide").size();
79811       if (isHidden) {
79812         wrap2.selectAll(".photo-wrapper:not(.ms-wrapper)").classed("hide", true);
79813         wrap2.selectAll(".photo-wrapper.ms-wrapper").classed("hide", false);
79814       }
79815       return this;
79816     },
79817     /**
79818      * hideViewer()
79819      */
79820     hideViewer: function(context) {
79821       let viewer = context.container().select(".photoviewer");
79822       if (!viewer.empty())
79823         viewer.datum(null);
79824       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
79825       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
79826       this.updateUrlImage(null);
79827       return this.setStyles(context, null, true);
79828     },
79829     /**
79830      * selectImage().
79831      */
79832     selectImage: function(context, key) {
79833       let that = this;
79834       let d2 = this.cachedImage(key);
79835       let viewer = context.container().select(".photoviewer");
79836       if (!viewer.empty())
79837         viewer.datum(d2);
79838       this.setStyles(context, null, true);
79839       let wrap2 = context.container().select(".photoviewer .ms-wrapper");
79840       let attribution = wrap2.selectAll(".photo-attribution").html("");
79841       wrap2.selectAll(".pnlm-load-box").style("display", "block");
79842       if (!d2)
79843         return this;
79844       this.updateUrlImage(key);
79845       _sceneOptions.northOffset = d2.ca;
79846       let line1 = attribution.append("div").attr("class", "attribution-row");
79847       const hiresDomId = utilUniqueDomId("streetside-hires");
79848       let label = line1.append("label").attr("for", hiresDomId).attr("class", "streetside-hires");
79849       label.append("input").attr("type", "checkbox").attr("id", hiresDomId).property("checked", _hires).on("click", (d3_event) => {
79850         d3_event.stopPropagation();
79851         _hires = !_hires;
79852         _resolution = _hires ? 1024 : 512;
79853         wrap2.call(setupCanvas, true);
79854         let viewstate = {
79855           yaw: _pannellumViewer2.getYaw(),
79856           pitch: _pannellumViewer2.getPitch(),
79857           hfov: _pannellumViewer2.getHfov()
79858         };
79859         _sceneOptions = Object.assign(_sceneOptions, viewstate);
79860         that.selectImage(context, d2.key).showViewer(context);
79861       });
79862       label.append("span").call(_t.append("streetside.hires"));
79863       let captureInfo = line1.append("div").attr("class", "attribution-capture-info");
79864       if (d2.captured_by) {
79865         const yyyy = (/* @__PURE__ */ new Date()).getFullYear();
79866         captureInfo.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://www.microsoft.com/en-us/maps/streetside").text("\xA9" + yyyy + " Microsoft");
79867         captureInfo.append("span").text("|");
79868       }
79869       if (d2.captured_at) {
79870         captureInfo.append("span").attr("class", "captured_at").text(localeTimestamp2(d2.captured_at));
79871       }
79872       let line2 = attribution.append("div").attr("class", "attribution-row");
79873       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"));
79874       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"));
79875       let bubbleIdQuadKey = d2.key.toString(4);
79876       const paddingNeeded = 16 - bubbleIdQuadKey.length;
79877       for (let i3 = 0; i3 < paddingNeeded; i3++) {
79878         bubbleIdQuadKey = "0" + bubbleIdQuadKey;
79879       }
79880       const imgUrlPrefix = streetsideImagesApi + "hs" + bubbleIdQuadKey;
79881       const imgUrlSuffix = ".jpg?g=13515&n=z";
79882       const faceKeys = ["01", "02", "03", "10", "11", "12"];
79883       let quadKeys = getQuadKeys();
79884       let faces = faceKeys.map((faceKey) => {
79885         return quadKeys.map((quadKey) => {
79886           const xy = qkToXY(quadKey);
79887           return {
79888             face: faceKey,
79889             url: imgUrlPrefix + faceKey + quadKey + imgUrlSuffix,
79890             x: xy[0],
79891             y: xy[1]
79892           };
79893         });
79894       });
79895       loadFaces(faces).then(function() {
79896         if (!_pannellumViewer2) {
79897           that.initViewer();
79898         } else {
79899           _currScene += 1;
79900           let sceneID = _currScene.toString();
79901           _pannellumViewer2.addScene(sceneID, _sceneOptions).loadScene(sceneID);
79902           if (_currScene > 2) {
79903             sceneID = (_currScene - 1).toString();
79904             _pannellumViewer2.removeScene(sceneID);
79905           }
79906         }
79907       });
79908       return this;
79909     },
79910     getSequenceKeyForBubble: function(d2) {
79911       return d2 && d2.sequenceKey;
79912     },
79913     // Updates the currently highlighted sequence and selected bubble.
79914     // Reset is only necessary when interacting with the viewport because
79915     // this implicitly changes the currently selected bubble/sequence
79916     setStyles: function(context, hovered, reset) {
79917       if (reset) {
79918         context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
79919         context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
79920       }
79921       let hoveredBubbleKey = hovered && hovered.key;
79922       let hoveredSequenceKey = this.getSequenceKeyForBubble(hovered);
79923       let hoveredSequence = hoveredSequenceKey && _ssCache.sequences[hoveredSequenceKey];
79924       let hoveredBubbleKeys = hoveredSequence && hoveredSequence.bubbles.map((d2) => d2.key) || [];
79925       let viewer = context.container().select(".photoviewer");
79926       let selected = viewer.empty() ? void 0 : viewer.datum();
79927       let selectedBubbleKey = selected && selected.key;
79928       let selectedSequenceKey = this.getSequenceKeyForBubble(selected);
79929       let selectedSequence = selectedSequenceKey && _ssCache.sequences[selectedSequenceKey];
79930       let selectedBubbleKeys = selectedSequence && selectedSequence.bubbles.map((d2) => d2.key) || [];
79931       let highlightedBubbleKeys = utilArrayUnion(hoveredBubbleKeys, selectedBubbleKeys);
79932       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);
79933       context.container().selectAll(".layer-streetside-images .sequence").classed("highlighted", (d2) => d2.properties.key === hoveredSequenceKey).classed("currentView", (d2) => d2.properties.key === selectedSequenceKey);
79934       context.container().selectAll(".layer-streetside-images .viewfield-group .viewfield").attr("d", viewfieldPath);
79935       function viewfieldPath() {
79936         let d2 = this.parentNode.__data__;
79937         if (d2.pano && d2.key !== selectedBubbleKey) {
79938           return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
79939         } else {
79940           return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
79941         }
79942       }
79943       return this;
79944     },
79945     updateUrlImage: function(imageKey) {
79946       if (!window.mocha) {
79947         var hash = utilStringQs(window.location.hash);
79948         if (imageKey) {
79949           hash.photo = "streetside/" + imageKey;
79950         } else {
79951           delete hash.photo;
79952         }
79953         window.location.replace("#" + utilQsString(hash, true));
79954       }
79955     },
79956     /**
79957      * cache().
79958      */
79959     cache: function() {
79960       return _ssCache;
79961     }
79962   };
79963
79964   // modules/services/taginfo.js
79965   var apibase4 = taginfoApiUrl;
79966   var _inflight3 = {};
79967   var _popularKeys = {};
79968   var _taginfoCache = {};
79969   var tag_sorts = {
79970     point: "count_nodes",
79971     vertex: "count_nodes",
79972     area: "count_ways",
79973     line: "count_ways"
79974   };
79975   var tag_sort_members = {
79976     point: "count_node_members",
79977     vertex: "count_node_members",
79978     area: "count_way_members",
79979     line: "count_way_members",
79980     relation: "count_relation_members"
79981   };
79982   var tag_filters = {
79983     point: "nodes",
79984     vertex: "nodes",
79985     area: "ways",
79986     line: "ways"
79987   };
79988   var tag_members_fractions = {
79989     point: "count_node_members_fraction",
79990     vertex: "count_node_members_fraction",
79991     area: "count_way_members_fraction",
79992     line: "count_way_members_fraction",
79993     relation: "count_relation_members_fraction"
79994   };
79995   function sets(params, n3, o2) {
79996     if (params.geometry && o2[params.geometry]) {
79997       params[n3] = o2[params.geometry];
79998     }
79999     return params;
80000   }
80001   function setFilter(params) {
80002     return sets(params, "filter", tag_filters);
80003   }
80004   function setSort(params) {
80005     return sets(params, "sortname", tag_sorts);
80006   }
80007   function setSortMembers(params) {
80008     return sets(params, "sortname", tag_sort_members);
80009   }
80010   function clean(params) {
80011     return utilObjectOmit(params, ["geometry", "debounce"]);
80012   }
80013   function filterKeys(type2) {
80014     var count_type = type2 ? "count_" + type2 : "count_all";
80015     return function(d2) {
80016       return Number(d2[count_type]) > 2500 || d2.in_wiki;
80017     };
80018   }
80019   function filterMultikeys(prefix) {
80020     return function(d2) {
80021       var re3 = new RegExp("^" + prefix + "(.*)$", "i");
80022       var matches = d2.key.match(re3) || [];
80023       return matches.length === 2 && matches[1].indexOf(":") === -1;
80024     };
80025   }
80026   function filterValues(allowUpperCase) {
80027     return function(d2) {
80028       if (d2.value.match(/[;,]/) !== null)
80029         return false;
80030       if (!allowUpperCase && d2.value.match(/[A-Z*]/) !== null)
80031         return false;
80032       return d2.count > 100 || d2.in_wiki;
80033     };
80034   }
80035   function filterRoles(geometry) {
80036     return function(d2) {
80037       if (d2.role === "")
80038         return false;
80039       if (d2.role.match(/[A-Z*;,]/) !== null)
80040         return false;
80041       return Number(d2[tag_members_fractions[geometry]]) > 0;
80042     };
80043   }
80044   function valKey(d2) {
80045     return {
80046       value: d2.key,
80047       title: d2.key
80048     };
80049   }
80050   function valKeyDescription(d2) {
80051     var obj = {
80052       value: d2.value,
80053       title: d2.description || d2.value
80054     };
80055     return obj;
80056   }
80057   function roleKey(d2) {
80058     return {
80059       value: d2.role,
80060       title: d2.role
80061     };
80062   }
80063   function sortKeys(a2, b2) {
80064     return a2.key.indexOf(":") === -1 && b2.key.indexOf(":") !== -1 ? -1 : a2.key.indexOf(":") !== -1 && b2.key.indexOf(":") === -1 ? 1 : 0;
80065   }
80066   var debouncedRequest2 = debounce_default(request2, 300, { leading: false });
80067   function request2(url, params, exactMatch, callback, loaded) {
80068     if (_inflight3[url])
80069       return;
80070     if (checkCache(url, params, exactMatch, callback))
80071       return;
80072     var controller = new AbortController();
80073     _inflight3[url] = controller;
80074     json_default(url, { signal: controller.signal }).then(function(result) {
80075       delete _inflight3[url];
80076       if (loaded)
80077         loaded(null, result);
80078     }).catch(function(err) {
80079       delete _inflight3[url];
80080       if (err.name === "AbortError")
80081         return;
80082       if (loaded)
80083         loaded(err.message);
80084     });
80085   }
80086   function checkCache(url, params, exactMatch, callback) {
80087     var rp = params.rp || 25;
80088     var testQuery = params.query || "";
80089     var testUrl = url;
80090     do {
80091       var hit = _taginfoCache[testUrl];
80092       if (hit && (url === testUrl || hit.length < rp)) {
80093         callback(null, hit);
80094         return true;
80095       }
80096       if (exactMatch || !testQuery.length)
80097         return false;
80098       testQuery = testQuery.slice(0, -1);
80099       testUrl = url.replace(/&query=(.*?)&/, "&query=" + testQuery + "&");
80100     } while (testQuery.length >= 0);
80101     return false;
80102   }
80103   var taginfo_default = {
80104     init: function() {
80105       _inflight3 = {};
80106       _taginfoCache = {};
80107       _popularKeys = {
80108         // manually exclude some keys – #5377, #7485
80109         postal_code: true,
80110         full_name: true,
80111         loc_name: true,
80112         reg_name: true,
80113         short_name: true,
80114         sorting_name: true,
80115         artist_name: true,
80116         nat_name: true,
80117         long_name: true,
80118         via: true,
80119         "bridge:name": true
80120       };
80121       var params = {
80122         rp: 100,
80123         sortname: "values_all",
80124         sortorder: "desc",
80125         page: 1,
80126         debounce: false,
80127         lang: _mainLocalizer.languageCode()
80128       };
80129       this.keys(params, function(err, data) {
80130         if (err)
80131           return;
80132         data.forEach(function(d2) {
80133           if (d2.value === "opening_hours")
80134             return;
80135           _popularKeys[d2.value] = true;
80136         });
80137       });
80138     },
80139     reset: function() {
80140       Object.values(_inflight3).forEach(function(controller) {
80141         controller.abort();
80142       });
80143       _inflight3 = {};
80144     },
80145     keys: function(params, callback) {
80146       var doRequest = params.debounce ? debouncedRequest2 : request2;
80147       params = clean(setSort(params));
80148       params = Object.assign({
80149         rp: 10,
80150         sortname: "count_all",
80151         sortorder: "desc",
80152         page: 1,
80153         lang: _mainLocalizer.languageCode()
80154       }, params);
80155       var url = apibase4 + "keys/all?" + utilQsString(params);
80156       doRequest(url, params, false, callback, function(err, d2) {
80157         if (err) {
80158           callback(err);
80159         } else {
80160           var f3 = filterKeys(params.filter);
80161           var result = d2.data.filter(f3).sort(sortKeys).map(valKey);
80162           _taginfoCache[url] = result;
80163           callback(null, result);
80164         }
80165       });
80166     },
80167     multikeys: function(params, callback) {
80168       var doRequest = params.debounce ? debouncedRequest2 : request2;
80169       params = clean(setSort(params));
80170       params = Object.assign({
80171         rp: 25,
80172         sortname: "count_all",
80173         sortorder: "desc",
80174         page: 1,
80175         lang: _mainLocalizer.languageCode()
80176       }, params);
80177       var prefix = params.query;
80178       var url = apibase4 + "keys/all?" + utilQsString(params);
80179       doRequest(url, params, true, callback, function(err, d2) {
80180         if (err) {
80181           callback(err);
80182         } else {
80183           var f3 = filterMultikeys(prefix);
80184           var result = d2.data.filter(f3).map(valKey);
80185           _taginfoCache[url] = result;
80186           callback(null, result);
80187         }
80188       });
80189     },
80190     values: function(params, callback) {
80191       var key = params.key;
80192       if (key && _popularKeys[key]) {
80193         callback(null, []);
80194         return;
80195       }
80196       var doRequest = params.debounce ? debouncedRequest2 : request2;
80197       params = clean(setSort(setFilter(params)));
80198       params = Object.assign({
80199         rp: 25,
80200         sortname: "count_all",
80201         sortorder: "desc",
80202         page: 1,
80203         lang: _mainLocalizer.languageCode()
80204       }, params);
80205       var url = apibase4 + "key/values?" + utilQsString(params);
80206       doRequest(url, params, false, callback, function(err, d2) {
80207         if (err) {
80208           callback(err);
80209         } else {
80210           var allowUpperCase = allowUpperCaseTagValues.test(params.key);
80211           var f3 = filterValues(allowUpperCase);
80212           var result = d2.data.filter(f3).map(valKeyDescription);
80213           _taginfoCache[url] = result;
80214           callback(null, result);
80215         }
80216       });
80217     },
80218     roles: function(params, callback) {
80219       var doRequest = params.debounce ? debouncedRequest2 : request2;
80220       var geometry = params.geometry;
80221       params = clean(setSortMembers(params));
80222       params = Object.assign({
80223         rp: 25,
80224         sortname: "count_all_members",
80225         sortorder: "desc",
80226         page: 1,
80227         lang: _mainLocalizer.languageCode()
80228       }, params);
80229       var url = apibase4 + "relation/roles?" + utilQsString(params);
80230       doRequest(url, params, true, callback, function(err, d2) {
80231         if (err) {
80232           callback(err);
80233         } else {
80234           var f3 = filterRoles(geometry);
80235           var result = d2.data.filter(f3).map(roleKey);
80236           _taginfoCache[url] = result;
80237           callback(null, result);
80238         }
80239       });
80240     },
80241     docs: function(params, callback) {
80242       var doRequest = params.debounce ? debouncedRequest2 : request2;
80243       params = clean(setSort(params));
80244       var path = "key/wiki_pages?";
80245       if (params.value) {
80246         path = "tag/wiki_pages?";
80247       } else if (params.rtype) {
80248         path = "relation/wiki_pages?";
80249       }
80250       var url = apibase4 + path + utilQsString(params);
80251       doRequest(url, params, true, callback, function(err, d2) {
80252         if (err) {
80253           callback(err);
80254         } else {
80255           _taginfoCache[url] = d2.data;
80256           callback(null, d2.data);
80257         }
80258       });
80259     },
80260     apibase: function(_2) {
80261       if (!arguments.length)
80262         return apibase4;
80263       apibase4 = _2;
80264       return this;
80265     }
80266   };
80267
80268   // modules/services/vector_tile.js
80269   var import_fast_deep_equal11 = __toESM(require_fast_deep_equal());
80270   var import_fast_json_stable_stringify2 = __toESM(require_fast_json_stable_stringify());
80271   var import_polygon_clipping2 = __toESM(require_polygon_clipping_umd());
80272   var import_pbf2 = __toESM(require_pbf());
80273   var import_vector_tile2 = __toESM(require_vector_tile());
80274   var tiler8 = utilTiler().tileSize(512).margin(1);
80275   var dispatch12 = dispatch_default("loadedData");
80276   var _vtCache;
80277   function abortRequest7(controller) {
80278     controller.abort();
80279   }
80280   function vtToGeoJSON(data, tile, mergeCache) {
80281     var vectorTile = new import_vector_tile2.default.VectorTile(new import_pbf2.default(data));
80282     var layers = Object.keys(vectorTile.layers);
80283     if (!Array.isArray(layers)) {
80284       layers = [layers];
80285     }
80286     var features = [];
80287     layers.forEach(function(layerID) {
80288       var layer = vectorTile.layers[layerID];
80289       if (layer) {
80290         for (var i3 = 0; i3 < layer.length; i3++) {
80291           var feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
80292           var geometry = feature3.geometry;
80293           if (geometry.type === "Polygon") {
80294             geometry.type = "MultiPolygon";
80295             geometry.coordinates = [geometry.coordinates];
80296           }
80297           var isClipped = false;
80298           if (geometry.type === "MultiPolygon") {
80299             var featureClip = bboxClip(feature3, tile.extent.rectangle());
80300             if (!(0, import_fast_deep_equal11.default)(feature3.geometry, featureClip.geometry)) {
80301               isClipped = true;
80302             }
80303             if (!feature3.geometry.coordinates.length)
80304               continue;
80305             if (!feature3.geometry.coordinates[0].length)
80306               continue;
80307           }
80308           var featurehash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3));
80309           var propertyhash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3.properties || {}));
80310           feature3.__layerID__ = layerID.replace(/[^_a-zA-Z0-9\-]/g, "_");
80311           feature3.__featurehash__ = featurehash;
80312           feature3.__propertyhash__ = propertyhash;
80313           features.push(feature3);
80314           if (isClipped && geometry.type === "MultiPolygon") {
80315             var merged = mergeCache[propertyhash];
80316             if (merged && merged.length) {
80317               var other = merged[0];
80318               var coords = import_polygon_clipping2.default.union(
80319                 feature3.geometry.coordinates,
80320                 other.geometry.coordinates
80321               );
80322               if (!coords || !coords.length) {
80323                 continue;
80324               }
80325               merged.push(feature3);
80326               for (var j3 = 0; j3 < merged.length; j3++) {
80327                 merged[j3].geometry.coordinates = coords;
80328                 merged[j3].__featurehash__ = featurehash;
80329               }
80330             } else {
80331               mergeCache[propertyhash] = [feature3];
80332             }
80333           }
80334         }
80335       }
80336     });
80337     return features;
80338   }
80339   function loadTile3(source, tile) {
80340     if (source.loaded[tile.id] || source.inflight[tile.id])
80341       return;
80342     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) {
80343       var subdomains = r2.split(",");
80344       return subdomains[(tile.xyz[0] + tile.xyz[1]) % subdomains.length];
80345     });
80346     var controller = new AbortController();
80347     source.inflight[tile.id] = controller;
80348     fetch(url, { signal: controller.signal }).then(function(response) {
80349       if (!response.ok) {
80350         throw new Error(response.status + " " + response.statusText);
80351       }
80352       source.loaded[tile.id] = [];
80353       delete source.inflight[tile.id];
80354       return response.arrayBuffer();
80355     }).then(function(data) {
80356       if (!data) {
80357         throw new Error("No Data");
80358       }
80359       var z2 = tile.xyz[2];
80360       if (!source.canMerge[z2]) {
80361         source.canMerge[z2] = {};
80362       }
80363       source.loaded[tile.id] = vtToGeoJSON(data, tile, source.canMerge[z2]);
80364       dispatch12.call("loadedData");
80365     }).catch(function() {
80366       source.loaded[tile.id] = [];
80367       delete source.inflight[tile.id];
80368     });
80369   }
80370   var vector_tile_default = {
80371     init: function() {
80372       if (!_vtCache) {
80373         this.reset();
80374       }
80375       this.event = utilRebind(this, dispatch12, "on");
80376     },
80377     reset: function() {
80378       for (var sourceID in _vtCache) {
80379         var source = _vtCache[sourceID];
80380         if (source && source.inflight) {
80381           Object.values(source.inflight).forEach(abortRequest7);
80382         }
80383       }
80384       _vtCache = {};
80385     },
80386     addSource: function(sourceID, template) {
80387       _vtCache[sourceID] = { template, inflight: {}, loaded: {}, canMerge: {} };
80388       return _vtCache[sourceID];
80389     },
80390     data: function(sourceID, projection2) {
80391       var source = _vtCache[sourceID];
80392       if (!source)
80393         return [];
80394       var tiles = tiler8.getTiles(projection2);
80395       var seen = {};
80396       var results = [];
80397       for (var i3 = 0; i3 < tiles.length; i3++) {
80398         var features = source.loaded[tiles[i3].id];
80399         if (!features || !features.length)
80400           continue;
80401         for (var j3 = 0; j3 < features.length; j3++) {
80402           var feature3 = features[j3];
80403           var hash = feature3.__featurehash__;
80404           if (seen[hash])
80405             continue;
80406           seen[hash] = true;
80407           results.push(Object.assign({}, feature3));
80408         }
80409       }
80410       return results;
80411     },
80412     loadTiles: function(sourceID, template, projection2) {
80413       var source = _vtCache[sourceID];
80414       if (!source) {
80415         source = this.addSource(sourceID, template);
80416       }
80417       var tiles = tiler8.getTiles(projection2);
80418       Object.keys(source.inflight).forEach(function(k2) {
80419         var wanted = tiles.find(function(tile) {
80420           return k2 === tile.id;
80421         });
80422         if (!wanted) {
80423           abortRequest7(source.inflight[k2]);
80424           delete source.inflight[k2];
80425         }
80426       });
80427       tiles.forEach(function(tile) {
80428         loadTile3(source, tile);
80429       });
80430     },
80431     cache: function() {
80432       return _vtCache;
80433     }
80434   };
80435
80436   // modules/services/wikidata.js
80437   var apibase5 = "https://www.wikidata.org/w/api.php?";
80438   var _wikidataCache = {};
80439   var wikidata_default = {
80440     init: function() {
80441     },
80442     reset: function() {
80443       _wikidataCache = {};
80444     },
80445     // Search for Wikidata items matching the query
80446     itemsForSearchQuery: function(query, callback, language) {
80447       if (!query) {
80448         if (callback)
80449           callback("No query", {});
80450         return;
80451       }
80452       var lang = this.languagesToQuery()[0];
80453       var url = apibase5 + utilQsString({
80454         action: "wbsearchentities",
80455         format: "json",
80456         formatversion: 2,
80457         search: query,
80458         type: "item",
80459         // the language to search
80460         language: language || lang,
80461         // the language for the label and description in the result
80462         uselang: lang,
80463         limit: 10,
80464         origin: "*"
80465       });
80466       json_default(url).then((result) => {
80467         if (result && result.error) {
80468           if (result.error.code === "badvalue" && result.error.info.includes(lang) && !language && lang.includes("-")) {
80469             this.itemsForSearchQuery(query, callback, lang.split("-")[0]);
80470             return;
80471           } else {
80472             throw new Error(result.error);
80473           }
80474         }
80475         if (callback)
80476           callback(null, result.search || {});
80477       }).catch(function(err) {
80478         if (callback)
80479           callback(err.message, {});
80480       });
80481     },
80482     // Given a Wikipedia language and article title,
80483     // return an array of corresponding Wikidata entities.
80484     itemsByTitle: function(lang, title, callback) {
80485       if (!title) {
80486         if (callback)
80487           callback("No title", {});
80488         return;
80489       }
80490       lang = lang || "en";
80491       var url = apibase5 + utilQsString({
80492         action: "wbgetentities",
80493         format: "json",
80494         formatversion: 2,
80495         sites: lang.replace(/-/g, "_") + "wiki",
80496         titles: title,
80497         languages: "en",
80498         // shrink response by filtering to one language
80499         origin: "*"
80500       });
80501       json_default(url).then(function(result) {
80502         if (result && result.error) {
80503           throw new Error(result.error);
80504         }
80505         if (callback)
80506           callback(null, result.entities || {});
80507       }).catch(function(err) {
80508         if (callback)
80509           callback(err.message, {});
80510       });
80511     },
80512     languagesToQuery: function() {
80513       return _mainLocalizer.localeCodes().map(function(code) {
80514         return code.toLowerCase();
80515       }).filter(function(code) {
80516         return code !== "en-us";
80517       });
80518     },
80519     entityByQID: function(qid, callback) {
80520       if (!qid) {
80521         callback("No qid", {});
80522         return;
80523       }
80524       if (_wikidataCache[qid]) {
80525         if (callback)
80526           callback(null, _wikidataCache[qid]);
80527         return;
80528       }
80529       var langs = this.languagesToQuery();
80530       var url = apibase5 + utilQsString({
80531         action: "wbgetentities",
80532         format: "json",
80533         formatversion: 2,
80534         ids: qid,
80535         props: "labels|descriptions|claims|sitelinks",
80536         sitefilter: langs.map(function(d2) {
80537           return d2 + "wiki";
80538         }).join("|"),
80539         languages: langs.join("|"),
80540         languagefallback: 1,
80541         origin: "*"
80542       });
80543       json_default(url).then(function(result) {
80544         if (result && result.error) {
80545           throw new Error(result.error);
80546         }
80547         if (callback)
80548           callback(null, result.entities[qid] || {});
80549       }).catch(function(err) {
80550         if (callback)
80551           callback(err.message, {});
80552       });
80553     },
80554     // Pass `params` object of the form:
80555     // {
80556     //   qid: 'string'      // brand wikidata  (e.g. 'Q37158')
80557     // }
80558     //
80559     // Get an result object used to display tag documentation
80560     // {
80561     //   title:        'string',
80562     //   description:  'string',
80563     //   editURL:      'string',
80564     //   imageURL:     'string',
80565     //   wiki:         { title: 'string', text: 'string', url: 'string' }
80566     // }
80567     //
80568     getDocs: function(params, callback) {
80569       var langs = this.languagesToQuery();
80570       this.entityByQID(params.qid, function(err, entity) {
80571         if (err || !entity) {
80572           callback(err || "No entity");
80573           return;
80574         }
80575         var i3;
80576         var description;
80577         for (i3 in langs) {
80578           let code = langs[i3];
80579           if (entity.descriptions[code] && entity.descriptions[code].language === code) {
80580             description = entity.descriptions[code];
80581             break;
80582           }
80583         }
80584         if (!description && Object.values(entity.descriptions).length)
80585           description = Object.values(entity.descriptions)[0];
80586         var result = {
80587           title: entity.id,
80588           description: description ? description.value : "",
80589           descriptionLocaleCode: description ? description.language : "",
80590           editURL: "https://www.wikidata.org/wiki/" + entity.id
80591         };
80592         if (entity.claims) {
80593           var imageroot = "https://commons.wikimedia.org/w/index.php";
80594           var props = ["P154", "P18"];
80595           var prop, image;
80596           for (i3 = 0; i3 < props.length; i3++) {
80597             prop = entity.claims[props[i3]];
80598             if (prop && Object.keys(prop).length > 0) {
80599               image = prop[Object.keys(prop)[0]].mainsnak.datavalue.value;
80600               if (image) {
80601                 result.imageURL = imageroot + "?" + utilQsString({
80602                   title: "Special:Redirect/file/" + image,
80603                   width: 400
80604                 });
80605                 break;
80606               }
80607             }
80608           }
80609         }
80610         if (entity.sitelinks) {
80611           var englishLocale = _mainLocalizer.languageCode().toLowerCase() === "en";
80612           for (i3 = 0; i3 < langs.length; i3++) {
80613             var w2 = langs[i3] + "wiki";
80614             if (entity.sitelinks[w2]) {
80615               var title = entity.sitelinks[w2].title;
80616               var tKey = "inspector.wiki_reference";
80617               if (!englishLocale && langs[i3] === "en") {
80618                 tKey = "inspector.wiki_en_reference";
80619               }
80620               result.wiki = {
80621                 title,
80622                 text: tKey,
80623                 url: "https://" + langs[i3] + ".wikipedia.org/wiki/" + title.replace(/ /g, "_")
80624               };
80625               break;
80626             }
80627           }
80628         }
80629         callback(null, result);
80630       });
80631     }
80632   };
80633
80634   // modules/services/wikipedia.js
80635   var endpoint = "https://en.wikipedia.org/w/api.php?";
80636   var wikipedia_default = {
80637     init: function() {
80638     },
80639     reset: function() {
80640     },
80641     search: function(lang, query, callback) {
80642       if (!query) {
80643         if (callback)
80644           callback("No Query", []);
80645         return;
80646       }
80647       lang = lang || "en";
80648       var url = endpoint.replace("en", lang) + utilQsString({
80649         action: "query",
80650         list: "search",
80651         srlimit: "10",
80652         srinfo: "suggestion",
80653         format: "json",
80654         origin: "*",
80655         srsearch: query
80656       });
80657       json_default(url).then(function(result) {
80658         if (result && result.error) {
80659           throw new Error(result.error);
80660         } else if (!result || !result.query || !result.query.search) {
80661           throw new Error("No Results");
80662         }
80663         if (callback) {
80664           var titles = result.query.search.map(function(d2) {
80665             return d2.title;
80666           });
80667           callback(null, titles);
80668         }
80669       }).catch(function(err) {
80670         if (callback)
80671           callback(err, []);
80672       });
80673     },
80674     suggestions: function(lang, query, callback) {
80675       if (!query) {
80676         if (callback)
80677           callback("", []);
80678         return;
80679       }
80680       lang = lang || "en";
80681       var url = endpoint.replace("en", lang) + utilQsString({
80682         action: "opensearch",
80683         namespace: 0,
80684         suggest: "",
80685         format: "json",
80686         origin: "*",
80687         search: query
80688       });
80689       json_default(url).then(function(result) {
80690         if (result && result.error) {
80691           throw new Error(result.error);
80692         } else if (!result || result.length < 2) {
80693           throw new Error("No Results");
80694         }
80695         if (callback)
80696           callback(null, result[1] || []);
80697       }).catch(function(err) {
80698         if (callback)
80699           callback(err.message, []);
80700       });
80701     },
80702     translations: function(lang, title, callback) {
80703       if (!title) {
80704         if (callback)
80705           callback("No Title");
80706         return;
80707       }
80708       var url = endpoint.replace("en", lang) + utilQsString({
80709         action: "query",
80710         prop: "langlinks",
80711         format: "json",
80712         origin: "*",
80713         lllimit: 500,
80714         titles: title
80715       });
80716       json_default(url).then(function(result) {
80717         if (result && result.error) {
80718           throw new Error(result.error);
80719         } else if (!result || !result.query || !result.query.pages) {
80720           throw new Error("No Results");
80721         }
80722         if (callback) {
80723           var list = result.query.pages[Object.keys(result.query.pages)[0]];
80724           var translations = {};
80725           if (list && list.langlinks) {
80726             list.langlinks.forEach(function(d2) {
80727               translations[d2.lang] = d2["*"];
80728             });
80729           }
80730           callback(null, translations);
80731         }
80732       }).catch(function(err) {
80733         if (callback)
80734           callback(err.message);
80735       });
80736     }
80737   };
80738
80739   // modules/services/mapilio.js
80740   var import_pbf3 = __toESM(require_pbf());
80741   var import_rbush12 = __toESM(require_rbush_min());
80742   var import_vector_tile3 = __toESM(require_vector_tile());
80743   var apiUrl2 = "https://end.mapilio.com";
80744   var imageBaseUrl = "https://cdn.mapilio.com/im";
80745   var baseTileUrl2 = "https://geo.mapilio.com/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=mapilio:";
80746   var pointLayer = "map_points";
80747   var lineLayer = "map_roads_line";
80748   var tileStyle = "&STYLE=&TILEMATRIX=EPSG:900913:{z}&TILEMATRIXSET=EPSG:900913&FORMAT=application/vnd.mapbox-vector-tile&TILECOL={x}&TILEROW={y}";
80749   var minZoom3 = 14;
80750   var dispatch13 = dispatch_default("loadedImages", "loadedLines");
80751   var imgZoom3 = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
80752   var pannellumViewerCSS3 = "pannellum/pannellum.css";
80753   var pannellumViewerJS3 = "pannellum/pannellum.js";
80754   var resolution = 1080;
80755   var _activeImage;
80756   var _cache4;
80757   var _loadViewerPromise5;
80758   var _pannellumViewer3;
80759   var _sceneOptions2 = {
80760     showFullscreenCtrl: false,
80761     autoLoad: true,
80762     yaw: 0,
80763     minHfov: 10,
80764     maxHfov: 90,
80765     hfov: 60
80766   };
80767   var _currScene2 = 0;
80768   function partitionViewport5(projection2) {
80769     const z2 = geoScaleToZoom(projection2.scale());
80770     const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
80771     const tiler9 = utilTiler().zoomExtent([z22, z22]);
80772     return tiler9.getTiles(projection2).map(function(tile) {
80773       return tile.extent;
80774     });
80775   }
80776   function searchLimited5(limit, projection2, rtree) {
80777     limit = limit || 5;
80778     return partitionViewport5(projection2).reduce(function(result, extent) {
80779       const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
80780         return d2.data;
80781       });
80782       return found.length ? result.concat(found) : result;
80783     }, []);
80784   }
80785   function loadTiles4(which, url, maxZoom2, projection2) {
80786     const tiler9 = utilTiler().zoomExtent([minZoom3, maxZoom2]).skipNullIsland(true);
80787     const tiles = tiler9.getTiles(projection2);
80788     tiles.forEach(function(tile) {
80789       loadTile4(which, url, tile);
80790     });
80791   }
80792   function loadTile4(which, url, tile) {
80793     const cache = _cache4.requests;
80794     const tileId = "".concat(tile.id, "-").concat(which);
80795     if (cache.loaded[tileId] || cache.inflight[tileId])
80796       return;
80797     const controller = new AbortController();
80798     cache.inflight[tileId] = controller;
80799     const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
80800     fetch(requestUrl, { signal: controller.signal }).then(function(response) {
80801       if (!response.ok) {
80802         throw new Error(response.status + " " + response.statusText);
80803       }
80804       cache.loaded[tileId] = true;
80805       delete cache.inflight[tileId];
80806       return response.arrayBuffer();
80807     }).then(function(data) {
80808       if (data.byteLength === 0) {
80809         throw new Error("No Data");
80810       }
80811       loadTileDataToCache2(data, tile, which);
80812       if (which === "images") {
80813         dispatch13.call("loadedImages");
80814       } else {
80815         dispatch13.call("loadedLines");
80816       }
80817     }).catch(function(e3) {
80818       if (e3.message === "No Data") {
80819         cache.loaded[tileId] = true;
80820       } else {
80821         console.error(e3);
80822       }
80823     });
80824   }
80825   function loadTileDataToCache2(data, tile) {
80826     const vectorTile = new import_vector_tile3.VectorTile(new import_pbf3.default(data));
80827     let features, cache, layer, i3, feature3, loc, d2;
80828     if (vectorTile.layers.hasOwnProperty(pointLayer)) {
80829       features = [];
80830       cache = _cache4.images;
80831       layer = vectorTile.layers[pointLayer];
80832       for (i3 = 0; i3 < layer.length; i3++) {
80833         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
80834         loc = feature3.geometry.coordinates;
80835         let resolutionArr = feature3.properties.resolution.split("x");
80836         let sourceWidth = Math.max(resolutionArr[0], resolutionArr[1]);
80837         let sourceHeight = Math.min(resolutionArr[0], resolutionArr[1]);
80838         let isPano = sourceWidth % sourceHeight === 0;
80839         d2 = {
80840           loc,
80841           capture_time: feature3.properties.capture_time,
80842           id: feature3.properties.id,
80843           sequence_id: feature3.properties.sequence_uuid,
80844           heading: feature3.properties.heading,
80845           resolution: feature3.properties.resolution,
80846           isPano
80847         };
80848         cache.forImageId[d2.id] = d2;
80849         features.push({
80850           minX: loc[0],
80851           minY: loc[1],
80852           maxX: loc[0],
80853           maxY: loc[1],
80854           data: d2
80855         });
80856       }
80857       if (cache.rtree) {
80858         cache.rtree.load(features);
80859       }
80860     }
80861     if (vectorTile.layers.hasOwnProperty(lineLayer)) {
80862       cache = _cache4.sequences;
80863       layer = vectorTile.layers[lineLayer];
80864       for (i3 = 0; i3 < layer.length; i3++) {
80865         feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
80866         if (cache.lineString[feature3.properties.sequence_uuid]) {
80867           cache.lineString[feature3.properties.sequence_uuid].push(feature3);
80868         } else {
80869           cache.lineString[feature3.properties.sequence_uuid] = [feature3];
80870         }
80871       }
80872     }
80873   }
80874   function getImageData(imageId, sequenceId) {
80875     return fetch(apiUrl2 + "/api/sequence-detail?sequence_uuid=".concat(sequenceId), { method: "GET" }).then(function(response) {
80876       if (!response.ok) {
80877         throw new Error(response.status + " " + response.statusText);
80878       }
80879       return response.json();
80880     }).then(function(data) {
80881       let index = data.data.findIndex((feature3) => feature3.id === imageId);
80882       const { filename, uploaded_hash } = data.data[index];
80883       _sceneOptions2.panorama = imageBaseUrl + "/" + uploaded_hash + "/" + filename + "/" + resolution;
80884     });
80885   }
80886   var mapilio_default = {
80887     // Initialize Mapilio
80888     init: function() {
80889       if (!_cache4) {
80890         this.reset();
80891       }
80892       this.event = utilRebind(this, dispatch13, "on");
80893     },
80894     // Reset cache and state
80895     reset: function() {
80896       if (_cache4) {
80897         Object.values(_cache4.requests.inflight).forEach(function(request3) {
80898           request3.abort();
80899         });
80900       }
80901       _cache4 = {
80902         images: { rtree: new import_rbush12.default(), forImageId: {} },
80903         sequences: { rtree: new import_rbush12.default(), lineString: {} },
80904         requests: { loaded: {}, inflight: {} }
80905       };
80906       _activeImage = null;
80907     },
80908     // Get visible images
80909     images: function(projection2) {
80910       const limit = 5;
80911       return searchLimited5(limit, projection2, _cache4.images.rtree);
80912     },
80913     cachedImage: function(imageKey) {
80914       return _cache4.images.forImageId[imageKey];
80915     },
80916     // Load images in the visible area
80917     loadImages: function(projection2) {
80918       let url = baseTileUrl2 + pointLayer + tileStyle;
80919       loadTiles4("images", url, 14, projection2);
80920     },
80921     // Load line in the visible area
80922     loadLines: function(projection2) {
80923       let url = baseTileUrl2 + lineLayer + tileStyle;
80924       loadTiles4("line", url, 14, projection2);
80925     },
80926     // Get visible sequences
80927     sequences: function(projection2) {
80928       const viewport = projection2.clipExtent();
80929       const min3 = [viewport[0][0], viewport[1][1]];
80930       const max3 = [viewport[1][0], viewport[0][1]];
80931       const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
80932       const sequenceIds = {};
80933       let lineStrings = [];
80934       _cache4.images.rtree.search(bbox2).forEach(function(d2) {
80935         if (d2.data.sequence_id) {
80936           sequenceIds[d2.data.sequence_id] = true;
80937         }
80938       });
80939       Object.keys(sequenceIds).forEach(function(sequenceId) {
80940         if (_cache4.sequences.lineString[sequenceId]) {
80941           lineStrings = lineStrings.concat(_cache4.sequences.lineString[sequenceId]);
80942         }
80943       });
80944       return lineStrings;
80945     },
80946     // Set the currently visible image
80947     setActiveImage: function(image) {
80948       if (image) {
80949         _activeImage = {
80950           id: image.id,
80951           sequence_id: image.sequence_id
80952         };
80953       } else {
80954         _activeImage = null;
80955       }
80956     },
80957     // Update the currently highlighted sequence and selected bubble.
80958     setStyles: function(context, hovered) {
80959       const hoveredImageId = hovered && hovered.id;
80960       const hoveredSequenceId = hovered && hovered.sequence_id;
80961       const selectedSequenceId = _activeImage && _activeImage.sequence_id;
80962       const selectedImageId = _activeImage && _activeImage.id;
80963       const markers = context.container().selectAll(".layer-mapilio .viewfield-group");
80964       const sequences = context.container().selectAll(".layer-mapilio .sequence");
80965       markers.classed("highlighted", function(d2) {
80966         return d2.id === hoveredImageId;
80967       }).classed("hovered", function(d2) {
80968         return d2.id === hoveredImageId;
80969       }).classed("currentView", function(d2) {
80970         return d2.id === selectedImageId;
80971       });
80972       sequences.classed("highlighted", function(d2) {
80973         return d2.properties.sequence_uuid === hoveredSequenceId;
80974       }).classed("currentView", function(d2) {
80975         return d2.properties.sequence_uuid === selectedSequenceId;
80976       });
80977       return this;
80978     },
80979     updateUrlImage: function(imageKey) {
80980       if (!window.mocha) {
80981         var hash = utilStringQs(window.location.hash);
80982         if (imageKey) {
80983           hash.photo = "mapilio/" + imageKey;
80984         } else {
80985           delete hash.photo;
80986         }
80987         window.location.replace("#" + utilQsString(hash, true));
80988       }
80989     },
80990     initViewer: function() {
80991       if (!window.pannellum)
80992         return;
80993       if (_pannellumViewer3)
80994         return;
80995       _currScene2 += 1;
80996       const sceneID = _currScene2.toString();
80997       const options2 = {
80998         "default": { firstScene: sceneID },
80999         scenes: {}
81000       };
81001       options2.scenes[sceneID] = _sceneOptions2;
81002       _pannellumViewer3 = window.pannellum.viewer("ideditor-viewer-mapilio-pnlm", options2);
81003     },
81004     selectImage: function(context, id2) {
81005       let that = this;
81006       let d2 = this.cachedImage(id2);
81007       this.setActiveImage(d2);
81008       this.updateUrlImage(d2.id);
81009       let viewer = context.container().select(".photoviewer");
81010       if (!viewer.empty())
81011         viewer.datum(d2);
81012       this.setStyles(context, null);
81013       if (!d2)
81014         return this;
81015       let wrap2 = context.container().select(".photoviewer .mapilio-wrapper");
81016       let attribution = wrap2.selectAll(".photo-attribution").text("");
81017       if (d2.capture_time) {
81018         attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.capture_time));
81019         attribution.append("span").text("|");
81020       }
81021       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");
81022       wrap2.transition().duration(100).call(imgZoom3.transform, identity2);
81023       wrap2.selectAll("img").remove();
81024       getImageData(d2.id, d2.sequence_id).then(function() {
81025         if (d2.isPano) {
81026           if (!_pannellumViewer3) {
81027             that.initViewer();
81028           } else {
81029             _currScene2 += 1;
81030             let sceneID = _currScene2.toString();
81031             _pannellumViewer3.addScene(sceneID, _sceneOptions2).loadScene(sceneID);
81032             if (_currScene2 > 2) {
81033               sceneID = (_currScene2 - 1).toString();
81034               _pannellumViewer3.removeScene(sceneID);
81035             }
81036           }
81037         } else {
81038           that.initOnlyPhoto(context);
81039         }
81040       });
81041       function localeDateString2(s2) {
81042         if (!s2)
81043           return null;
81044         var options2 = { day: "numeric", month: "short", year: "numeric" };
81045         var d4 = new Date(s2);
81046         if (isNaN(d4.getTime()))
81047           return null;
81048         return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
81049       }
81050       return this;
81051     },
81052     initOnlyPhoto: function(context) {
81053       if (_pannellumViewer3) {
81054         _pannellumViewer3.destroy();
81055         _pannellumViewer3 = null;
81056       }
81057       let wrap2 = context.container().select("#ideditor-viewer-mapilio-simple");
81058       let imgWrap = wrap2.select("img");
81059       if (!imgWrap.empty()) {
81060         imgWrap.attr("src", _sceneOptions2.panorama);
81061       } else {
81062         wrap2.append("img").attr("src", _sceneOptions2.panorama);
81063       }
81064     },
81065     ensureViewerLoaded: function(context) {
81066       let that = this;
81067       let imgWrap = context.container().select("#ideditor-viewer-mapilio-simple > img");
81068       if (!imgWrap.empty()) {
81069         imgWrap.remove();
81070       }
81071       if (_loadViewerPromise5)
81072         return _loadViewerPromise5;
81073       let wrap2 = context.container().select(".photoviewer").selectAll(".mapilio-wrapper").data([0]);
81074       let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper mapilio-wrapper").classed("hide", true).on("dblclick.zoom", null);
81075       wrapEnter.append("div").attr("class", "photo-attribution fillD");
81076       const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-mapilio");
81077       controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
81078       controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
81079       wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-pnlm");
81080       wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-simple-wrap").call(imgZoom3.on("zoom", zoomPan2)).append("div").attr("id", "ideditor-viewer-mapilio-simple");
81081       context.ui().photoviewer.on("resize.mapilio", () => {
81082         if (_pannellumViewer3) {
81083           _pannellumViewer3.resize();
81084         }
81085       });
81086       _loadViewerPromise5 = new Promise((resolve, reject) => {
81087         let loadedCount = 0;
81088         function loaded() {
81089           loadedCount += 1;
81090           if (loadedCount === 2)
81091             resolve();
81092         }
81093         const head = select_default2("head");
81094         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() {
81095           reject();
81096         });
81097         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() {
81098           reject();
81099         });
81100       }).catch(function() {
81101         _loadViewerPromise5 = null;
81102       });
81103       function step(stepBy) {
81104         return function() {
81105           if (!_activeImage)
81106             return;
81107           const imageId = _activeImage.id;
81108           const nextIndex = imageId + stepBy;
81109           if (!nextIndex)
81110             return;
81111           const nextImage = _cache4.images.forImageId[nextIndex];
81112           context.map().centerEase(nextImage.loc);
81113           that.selectImage(context, nextImage.id);
81114         };
81115       }
81116       function zoomPan2(d3_event) {
81117         var t2 = d3_event.transform;
81118         context.container().select(".photoviewer #ideditor-viewer-mapilio-simple").call(utilSetTransform, t2.x, t2.y, t2.k);
81119       }
81120       return _loadViewerPromise5;
81121     },
81122     showViewer: function(context) {
81123       let wrap2 = context.container().select(".photoviewer").classed("hide", false);
81124       let isHidden = wrap2.selectAll(".photo-wrapper.mapilio-wrapper.hide").size();
81125       if (isHidden) {
81126         wrap2.selectAll(".photo-wrapper:not(.mapilio-wrapper)").classed("hide", true);
81127         wrap2.selectAll(".photo-wrapper.mapilio-wrapper").classed("hide", false);
81128       }
81129       return this;
81130     },
81131     /**
81132      * hideViewer()
81133      */
81134     hideViewer: function(context) {
81135       let viewer = context.container().select(".photoviewer");
81136       if (!viewer.empty())
81137         viewer.datum(null);
81138       this.updateUrlImage(null);
81139       viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
81140       context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
81141       this.setActiveImage();
81142       return this.setStyles(context, null);
81143     },
81144     // Return the current cache
81145     cache: function() {
81146       return _cache4;
81147     }
81148   };
81149
81150   // modules/services/index.js
81151   var services = {
81152     geocoder: nominatim_default,
81153     keepRight: keepRight_default,
81154     improveOSM: improveOSM_default,
81155     osmose: osmose_default,
81156     mapillary: mapillary_default,
81157     nsi: nsi_default,
81158     kartaview: kartaview_default,
81159     vegbilder: vegbilder_default,
81160     osm: osm_default,
81161     osmWikibase: osm_wikibase_default,
81162     maprules: maprules_default,
81163     streetside: streetside_default,
81164     taginfo: taginfo_default,
81165     vectorTile: vector_tile_default,
81166     wikidata: wikidata_default,
81167     wikipedia: wikipedia_default,
81168     mapilio: mapilio_default
81169   };
81170
81171   // modules/modes/drag_note.js
81172   function modeDragNote(context) {
81173     var mode = {
81174       id: "drag-note",
81175       button: "browse"
81176     };
81177     var edit2 = behaviorEdit(context);
81178     var _nudgeInterval;
81179     var _lastLoc;
81180     var _note;
81181     function startNudge(d3_event, nudge) {
81182       if (_nudgeInterval)
81183         window.clearInterval(_nudgeInterval);
81184       _nudgeInterval = window.setInterval(function() {
81185         context.map().pan(nudge);
81186         doMove(d3_event, nudge);
81187       }, 50);
81188     }
81189     function stopNudge() {
81190       if (_nudgeInterval) {
81191         window.clearInterval(_nudgeInterval);
81192         _nudgeInterval = null;
81193       }
81194     }
81195     function origin(note) {
81196       return context.projection(note.loc);
81197     }
81198     function start2(d3_event, note) {
81199       _note = note;
81200       var osm = services.osm;
81201       if (osm) {
81202         _note = osm.getNote(_note.id);
81203       }
81204       context.surface().selectAll(".note-" + _note.id).classed("active", true);
81205       context.perform(actionNoop());
81206       context.enter(mode);
81207       context.selectedNoteID(_note.id);
81208     }
81209     function move(d3_event, entity, point2) {
81210       d3_event.stopPropagation();
81211       _lastLoc = context.projection.invert(point2);
81212       doMove(d3_event);
81213       var nudge = geoViewportEdge(point2, context.map().dimensions());
81214       if (nudge) {
81215         startNudge(d3_event, nudge);
81216       } else {
81217         stopNudge();
81218       }
81219     }
81220     function doMove(d3_event, nudge) {
81221       nudge = nudge || [0, 0];
81222       var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
81223       var currMouse = geoVecSubtract(currPoint, nudge);
81224       var loc = context.projection.invert(currMouse);
81225       _note = _note.move(loc);
81226       var osm = services.osm;
81227       if (osm) {
81228         osm.replaceNote(_note);
81229       }
81230       context.replace(actionNoop());
81231     }
81232     function end() {
81233       context.replace(actionNoop());
81234       context.selectedNoteID(_note.id).enter(modeSelectNote(context, _note.id));
81235     }
81236     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);
81237     mode.enter = function() {
81238       context.install(edit2);
81239     };
81240     mode.exit = function() {
81241       context.ui().sidebar.hover.cancel();
81242       context.uninstall(edit2);
81243       context.surface().selectAll(".active").classed("active", false);
81244       stopNudge();
81245     };
81246     mode.behavior = drag;
81247     return mode;
81248   }
81249
81250   // modules/modes/select_data.js
81251   function modeSelectData(context, selectedDatum) {
81252     var mode = {
81253       id: "select-data",
81254       button: "browse"
81255     };
81256     var keybinding = utilKeybinding("select-data");
81257     var dataEditor = uiDataEditor(context);
81258     var behaviors = [
81259       behaviorBreathe(context),
81260       behaviorHover(context),
81261       behaviorSelect(context),
81262       behaviorLasso(context),
81263       modeDragNode(context).behavior,
81264       modeDragNote(context).behavior
81265     ];
81266     function selectData(d3_event, drawn) {
81267       var selection2 = context.surface().selectAll(".layer-mapdata .data" + selectedDatum.__featurehash__);
81268       if (selection2.empty()) {
81269         var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
81270         if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
81271           context.enter(modeBrowse(context));
81272         }
81273       } else {
81274         selection2.classed("selected", true);
81275       }
81276     }
81277     function esc() {
81278       if (context.container().select(".combobox").size())
81279         return;
81280       context.enter(modeBrowse(context));
81281     }
81282     mode.zoomToSelected = function() {
81283       var extent = geoExtent(bounds_default(selectedDatum));
81284       context.map().centerZoomEase(extent.center(), context.map().trimmedExtentZoom(extent));
81285     };
81286     mode.enter = function() {
81287       behaviors.forEach(context.install);
81288       keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
81289       select_default2(document).call(keybinding);
81290       selectData();
81291       var sidebar = context.ui().sidebar;
81292       sidebar.show(dataEditor.datum(selectedDatum));
81293       var extent = geoExtent(bounds_default(selectedDatum));
81294       sidebar.expand(sidebar.intersects(extent));
81295       context.map().on("drawn.select-data", selectData);
81296     };
81297     mode.exit = function() {
81298       behaviors.forEach(context.uninstall);
81299       select_default2(document).call(keybinding.unbind);
81300       context.surface().selectAll(".layer-mapdata .selected").classed("selected hover", false);
81301       context.map().on("drawn.select-data", null);
81302       context.ui().sidebar.hide();
81303     };
81304     return mode;
81305   }
81306
81307   // modules/behavior/select.js
81308   function behaviorSelect(context) {
81309     var _tolerancePx = 4;
81310     var _lastMouseEvent = null;
81311     var _showMenu = false;
81312     var _downPointers = {};
81313     var _longPressTimeout = null;
81314     var _lastInteractionType = null;
81315     var _multiselectionPointerId = null;
81316     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
81317     function keydown(d3_event) {
81318       if (d3_event.keyCode === 32) {
81319         var activeNode = document.activeElement;
81320         if (activeNode && (/* @__PURE__ */ new Set(["INPUT", "TEXTAREA"])).has(activeNode.nodeName))
81321           return;
81322       }
81323       if (d3_event.keyCode === 93 || // context menu key
81324       d3_event.keyCode === 32) {
81325         d3_event.preventDefault();
81326       }
81327       if (d3_event.repeat)
81328         return;
81329       cancelLongPress();
81330       if (d3_event.shiftKey) {
81331         context.surface().classed("behavior-multiselect", true);
81332       }
81333       if (d3_event.keyCode === 32) {
81334         if (!_downPointers.spacebar && _lastMouseEvent) {
81335           cancelLongPress();
81336           _longPressTimeout = window.setTimeout(didLongPress, 500, "spacebar", "spacebar");
81337           _downPointers.spacebar = {
81338             firstEvent: _lastMouseEvent,
81339             lastEvent: _lastMouseEvent
81340           };
81341         }
81342       }
81343     }
81344     function keyup(d3_event) {
81345       cancelLongPress();
81346       if (!d3_event.shiftKey) {
81347         context.surface().classed("behavior-multiselect", false);
81348       }
81349       if (d3_event.keyCode === 93) {
81350         d3_event.preventDefault();
81351         _lastInteractionType = "menukey";
81352         contextmenu(d3_event);
81353       } else if (d3_event.keyCode === 32) {
81354         var pointer = _downPointers.spacebar;
81355         if (pointer) {
81356           delete _downPointers.spacebar;
81357           if (pointer.done)
81358             return;
81359           d3_event.preventDefault();
81360           _lastInteractionType = "spacebar";
81361           click(pointer.firstEvent, pointer.lastEvent, "spacebar");
81362         }
81363       }
81364     }
81365     function pointerdown(d3_event) {
81366       var id2 = (d3_event.pointerId || "mouse").toString();
81367       cancelLongPress();
81368       if (d3_event.buttons && d3_event.buttons !== 1)
81369         return;
81370       context.ui().closeEditMenu();
81371       if (d3_event.pointerType !== "mouse") {
81372         _longPressTimeout = window.setTimeout(didLongPress, 500, id2, "longdown-" + (d3_event.pointerType || "mouse"));
81373       }
81374       _downPointers[id2] = {
81375         firstEvent: d3_event,
81376         lastEvent: d3_event
81377       };
81378     }
81379     function didLongPress(id2, interactionType) {
81380       var pointer = _downPointers[id2];
81381       if (!pointer)
81382         return;
81383       for (var i3 in _downPointers) {
81384         _downPointers[i3].done = true;
81385       }
81386       _longPressTimeout = null;
81387       _lastInteractionType = interactionType;
81388       _showMenu = true;
81389       click(pointer.firstEvent, pointer.lastEvent, id2);
81390     }
81391     function pointermove(d3_event) {
81392       var id2 = (d3_event.pointerId || "mouse").toString();
81393       if (_downPointers[id2]) {
81394         _downPointers[id2].lastEvent = d3_event;
81395       }
81396       if (!d3_event.pointerType || d3_event.pointerType === "mouse") {
81397         _lastMouseEvent = d3_event;
81398         if (_downPointers.spacebar) {
81399           _downPointers.spacebar.lastEvent = d3_event;
81400         }
81401       }
81402     }
81403     function pointerup(d3_event) {
81404       var id2 = (d3_event.pointerId || "mouse").toString();
81405       var pointer = _downPointers[id2];
81406       if (!pointer)
81407         return;
81408       delete _downPointers[id2];
81409       if (_multiselectionPointerId === id2) {
81410         _multiselectionPointerId = null;
81411       }
81412       if (pointer.done)
81413         return;
81414       click(pointer.firstEvent, d3_event, id2);
81415     }
81416     function pointercancel(d3_event) {
81417       var id2 = (d3_event.pointerId || "mouse").toString();
81418       if (!_downPointers[id2])
81419         return;
81420       delete _downPointers[id2];
81421       if (_multiselectionPointerId === id2) {
81422         _multiselectionPointerId = null;
81423       }
81424     }
81425     function contextmenu(d3_event) {
81426       d3_event.preventDefault();
81427       if (!+d3_event.clientX && !+d3_event.clientY) {
81428         if (_lastMouseEvent) {
81429           d3_event = _lastMouseEvent;
81430         } else {
81431           return;
81432         }
81433       } else {
81434         _lastMouseEvent = d3_event;
81435         if (d3_event.pointerType === "touch" || d3_event.pointerType === "pen" || d3_event.mozInputSource && // firefox doesn't give a pointerType on contextmenu events
81436         (d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_TOUCH || d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_PEN)) {
81437           _lastInteractionType = "touch";
81438         } else {
81439           _lastInteractionType = "rightclick";
81440         }
81441       }
81442       _showMenu = true;
81443       click(d3_event, d3_event);
81444     }
81445     function click(firstEvent, lastEvent, pointerId) {
81446       cancelLongPress();
81447       var mapNode = context.container().select(".main-map").node();
81448       var pointGetter = utilFastMouse(mapNode);
81449       var p1 = pointGetter(firstEvent);
81450       var p2 = pointGetter(lastEvent);
81451       var dist = geoVecLength(p1, p2);
81452       if (dist > _tolerancePx || !mapContains(lastEvent)) {
81453         resetProperties();
81454         return;
81455       }
81456       var targetDatum = lastEvent.target.__data__;
81457       var multiselectEntityId;
81458       if (!_multiselectionPointerId) {
81459         var selectPointerInfo = pointerDownOnSelection(pointerId);
81460         if (selectPointerInfo) {
81461           _multiselectionPointerId = selectPointerInfo.pointerId;
81462           multiselectEntityId = !selectPointerInfo.selected && selectPointerInfo.entityId;
81463           _downPointers[selectPointerInfo.pointerId].done = true;
81464         }
81465       }
81466       var isMultiselect = context.mode().id === "select" && // and shift key is down
81467       (lastEvent && lastEvent.shiftKey || // or we're lasso-selecting
81468       context.surface().select(".lasso").node() || // or a pointer is down over a selected feature
81469       _multiselectionPointerId && !multiselectEntityId);
81470       processClick(targetDatum, isMultiselect, p2, multiselectEntityId);
81471       function mapContains(event) {
81472         var rect = mapNode.getBoundingClientRect();
81473         return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
81474       }
81475       function pointerDownOnSelection(skipPointerId) {
81476         var mode = context.mode();
81477         var selectedIDs = mode.id === "select" ? mode.selectedIDs() : [];
81478         for (var pointerId2 in _downPointers) {
81479           if (pointerId2 === "spacebar" || pointerId2 === skipPointerId)
81480             continue;
81481           var pointerInfo = _downPointers[pointerId2];
81482           var p12 = pointGetter(pointerInfo.firstEvent);
81483           var p22 = pointGetter(pointerInfo.lastEvent);
81484           if (geoVecLength(p12, p22) > _tolerancePx)
81485             continue;
81486           var datum2 = pointerInfo.firstEvent.target.__data__;
81487           var entity = datum2 && datum2.properties && datum2.properties.entity || datum2;
81488           if (context.graph().hasEntity(entity.id)) {
81489             return {
81490               pointerId: pointerId2,
81491               entityId: entity.id,
81492               selected: selectedIDs.indexOf(entity.id) !== -1
81493             };
81494           }
81495         }
81496         return null;
81497       }
81498     }
81499     function processClick(datum2, isMultiselect, point2, alsoSelectId) {
81500       var mode = context.mode();
81501       var showMenu = _showMenu;
81502       var interactionType = _lastInteractionType;
81503       var entity = datum2 && datum2.properties && datum2.properties.entity;
81504       if (entity)
81505         datum2 = entity;
81506       if (datum2 && datum2.type === "midpoint") {
81507         datum2 = datum2.parents[0];
81508       }
81509       var newMode;
81510       if (datum2 instanceof osmEntity) {
81511         var selectedIDs = context.selectedIDs();
81512         context.selectedNoteID(null);
81513         context.selectedErrorID(null);
81514         if (!isMultiselect) {
81515           if (!showMenu || selectedIDs.length <= 1 || selectedIDs.indexOf(datum2.id) === -1) {
81516             if (alsoSelectId === datum2.id)
81517               alsoSelectId = null;
81518             selectedIDs = (alsoSelectId ? [alsoSelectId] : []).concat([datum2.id]);
81519             newMode = mode.id === "select" ? mode.selectedIDs(selectedIDs) : modeSelect(context, selectedIDs).selectBehavior(behavior);
81520             context.enter(newMode);
81521           }
81522         } else {
81523           if (selectedIDs.indexOf(datum2.id) !== -1) {
81524             if (!showMenu) {
81525               selectedIDs = selectedIDs.filter(function(id2) {
81526                 return id2 !== datum2.id;
81527               });
81528               newMode = selectedIDs.length ? mode.selectedIDs(selectedIDs) : modeBrowse(context).selectBehavior(behavior);
81529               context.enter(newMode);
81530             }
81531           } else {
81532             selectedIDs = selectedIDs.concat([datum2.id]);
81533             newMode = mode.selectedIDs(selectedIDs);
81534             context.enter(newMode);
81535           }
81536         }
81537       } else if (datum2 && datum2.__featurehash__ && !isMultiselect) {
81538         context.selectedNoteID(null).enter(modeSelectData(context, datum2));
81539       } else if (datum2 instanceof osmNote && !isMultiselect) {
81540         context.selectedNoteID(datum2.id).enter(modeSelectNote(context, datum2.id));
81541       } else if (datum2 instanceof QAItem && !isMultiselect) {
81542         context.selectedErrorID(datum2.id).enter(modeSelectError(context, datum2.id, datum2.service));
81543       } else {
81544         context.selectedNoteID(null);
81545         context.selectedErrorID(null);
81546         if (!isMultiselect && mode.id !== "browse") {
81547           context.enter(modeBrowse(context));
81548         }
81549       }
81550       context.ui().closeEditMenu();
81551       if (showMenu)
81552         context.ui().showEditMenu(point2, interactionType);
81553       resetProperties();
81554     }
81555     function cancelLongPress() {
81556       if (_longPressTimeout)
81557         window.clearTimeout(_longPressTimeout);
81558       _longPressTimeout = null;
81559     }
81560     function resetProperties() {
81561       cancelLongPress();
81562       _showMenu = false;
81563       _lastInteractionType = null;
81564     }
81565     function behavior(selection2) {
81566       resetProperties();
81567       _lastMouseEvent = context.map().lastPointerEvent();
81568       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) {
81569         var e3 = d3_event;
81570         if (+e3.clientX === 0 && +e3.clientY === 0) {
81571           d3_event.preventDefault();
81572         }
81573       });
81574       selection2.on(_pointerPrefix + "down.select", pointerdown).on("contextmenu.select", contextmenu);
81575     }
81576     behavior.off = function(selection2) {
81577       cancelLongPress();
81578       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);
81579       selection2.on(_pointerPrefix + "down.select", null).on("contextmenu.select", null);
81580       context.surface().classed("behavior-multiselect", false);
81581     };
81582     return behavior;
81583   }
81584
81585   // modules/operations/index.js
81586   var operations_exports = {};
81587   __export(operations_exports, {
81588     operationCircularize: () => operationCircularize,
81589     operationContinue: () => operationContinue,
81590     operationCopy: () => operationCopy,
81591     operationDelete: () => operationDelete,
81592     operationDisconnect: () => operationDisconnect,
81593     operationDowngrade: () => operationDowngrade,
81594     operationExtract: () => operationExtract,
81595     operationMerge: () => operationMerge,
81596     operationMove: () => operationMove,
81597     operationOrthogonalize: () => operationOrthogonalize,
81598     operationPaste: () => operationPaste,
81599     operationReflectLong: () => operationReflectLong,
81600     operationReflectShort: () => operationReflectShort,
81601     operationReverse: () => operationReverse,
81602     operationRotate: () => operationRotate,
81603     operationSplit: () => operationSplit,
81604     operationStraighten: () => operationStraighten
81605   });
81606
81607   // modules/operations/continue.js
81608   function operationContinue(context, selectedIDs) {
81609     var _entities = selectedIDs.map(function(id2) {
81610       return context.graph().entity(id2);
81611     });
81612     var _geometries = Object.assign(
81613       { line: [], vertex: [] },
81614       utilArrayGroupBy(_entities, function(entity) {
81615         return entity.geometry(context.graph());
81616       })
81617     );
81618     var _vertex = _geometries.vertex.length && _geometries.vertex[0];
81619     function candidateWays() {
81620       return _vertex ? context.graph().parentWays(_vertex).filter(function(parent) {
81621         return parent.geometry(context.graph()) === "line" && !parent.isClosed() && parent.affix(_vertex.id) && (_geometries.line.length === 0 || _geometries.line[0] === parent);
81622       }) : [];
81623     }
81624     var _candidates = candidateWays();
81625     var operation = function() {
81626       var candidate = _candidates[0];
81627       context.enter(
81628         modeDrawLine(context, candidate.id, context.graph(), "line", candidate.affix(_vertex.id), true)
81629       );
81630     };
81631     operation.relatedEntityIds = function() {
81632       return _candidates.length ? [_candidates[0].id] : [];
81633     };
81634     operation.available = function() {
81635       return _geometries.vertex.length === 1 && _geometries.line.length <= 1 && !context.features().hasHiddenConnections(_vertex, context.graph());
81636     };
81637     operation.disabled = function() {
81638       if (_candidates.length === 0) {
81639         return "not_eligible";
81640       } else if (_candidates.length > 1) {
81641         return "multiple";
81642       }
81643       return false;
81644     };
81645     operation.tooltip = function() {
81646       var disable = operation.disabled();
81647       return disable ? _t.append("operations.continue." + disable) : _t.append("operations.continue.description");
81648     };
81649     operation.annotation = function() {
81650       return _t("operations.continue.annotation.line");
81651     };
81652     operation.id = "continue";
81653     operation.keys = [_t("operations.continue.key")];
81654     operation.title = _t.append("operations.continue.title");
81655     operation.behavior = behaviorOperation(context).which(operation);
81656     return operation;
81657   }
81658
81659   // modules/operations/copy.js
81660   function operationCopy(context, selectedIDs) {
81661     function getFilteredIdsToCopy() {
81662       return selectedIDs.filter(function(selectedID) {
81663         var entity = context.graph().hasEntity(selectedID);
81664         return entity.hasInterestingTags() || entity.geometry(context.graph()) !== "vertex";
81665       });
81666     }
81667     var operation = function() {
81668       var graph = context.graph();
81669       var selected = groupEntities(getFilteredIdsToCopy(), graph);
81670       var canCopy = [];
81671       var skip = {};
81672       var entity;
81673       var i3;
81674       for (i3 = 0; i3 < selected.relation.length; i3++) {
81675         entity = selected.relation[i3];
81676         if (!skip[entity.id] && entity.isComplete(graph)) {
81677           canCopy.push(entity.id);
81678           skip = getDescendants(entity.id, graph, skip);
81679         }
81680       }
81681       for (i3 = 0; i3 < selected.way.length; i3++) {
81682         entity = selected.way[i3];
81683         if (!skip[entity.id]) {
81684           canCopy.push(entity.id);
81685           skip = getDescendants(entity.id, graph, skip);
81686         }
81687       }
81688       for (i3 = 0; i3 < selected.node.length; i3++) {
81689         entity = selected.node[i3];
81690         if (!skip[entity.id]) {
81691           canCopy.push(entity.id);
81692         }
81693       }
81694       context.copyIDs(canCopy);
81695       if (_point && (canCopy.length !== 1 || graph.entity(canCopy[0]).type !== "node")) {
81696         context.copyLonLat(context.projection.invert(_point));
81697       } else {
81698         context.copyLonLat(null);
81699       }
81700     };
81701     function groupEntities(ids, graph) {
81702       var entities = ids.map(function(id2) {
81703         return graph.entity(id2);
81704       });
81705       return Object.assign(
81706         { relation: [], way: [], node: [] },
81707         utilArrayGroupBy(entities, "type")
81708       );
81709     }
81710     function getDescendants(id2, graph, descendants) {
81711       var entity = graph.entity(id2);
81712       var children2;
81713       descendants = descendants || {};
81714       if (entity.type === "relation") {
81715         children2 = entity.members.map(function(m2) {
81716           return m2.id;
81717         });
81718       } else if (entity.type === "way") {
81719         children2 = entity.nodes;
81720       } else {
81721         children2 = [];
81722       }
81723       for (var i3 = 0; i3 < children2.length; i3++) {
81724         if (!descendants[children2[i3]]) {
81725           descendants[children2[i3]] = true;
81726           descendants = getDescendants(children2[i3], graph, descendants);
81727         }
81728       }
81729       return descendants;
81730     }
81731     operation.available = function() {
81732       return getFilteredIdsToCopy().length > 0;
81733     };
81734     operation.disabled = function() {
81735       var extent = utilTotalExtent(getFilteredIdsToCopy(), context.graph());
81736       if (extent.percentContainedIn(context.map().extent()) < 0.8) {
81737         return "too_large";
81738       }
81739       return false;
81740     };
81741     operation.availableForKeypress = function() {
81742       var selection2 = window.getSelection && window.getSelection();
81743       return !selection2 || !selection2.toString();
81744     };
81745     operation.tooltip = function() {
81746       var disable = operation.disabled();
81747       return disable ? _t.append("operations.copy." + disable, { n: selectedIDs.length }) : _t.append("operations.copy.description", { n: selectedIDs.length });
81748     };
81749     operation.annotation = function() {
81750       return _t("operations.copy.annotation", { n: selectedIDs.length });
81751     };
81752     var _point;
81753     operation.point = function(val) {
81754       _point = val;
81755       return operation;
81756     };
81757     operation.id = "copy";
81758     operation.keys = [uiCmd("\u2318C")];
81759     operation.title = _t.append("operations.copy.title");
81760     operation.behavior = behaviorOperation(context).which(operation);
81761     return operation;
81762   }
81763
81764   // modules/operations/disconnect.js
81765   function operationDisconnect(context, selectedIDs) {
81766     var _vertexIDs = [];
81767     var _wayIDs = [];
81768     var _otherIDs = [];
81769     var _actions = [];
81770     selectedIDs.forEach(function(id2) {
81771       var entity = context.entity(id2);
81772       if (entity.type === "way") {
81773         _wayIDs.push(id2);
81774       } else if (entity.geometry(context.graph()) === "vertex") {
81775         _vertexIDs.push(id2);
81776       } else {
81777         _otherIDs.push(id2);
81778       }
81779     });
81780     var _coords, _descriptionID = "", _annotationID = "features";
81781     var _disconnectingVertexIds = [];
81782     var _disconnectingWayIds = [];
81783     if (_vertexIDs.length > 0) {
81784       _disconnectingVertexIds = _vertexIDs;
81785       _vertexIDs.forEach(function(vertexID) {
81786         var action = actionDisconnect(vertexID);
81787         if (_wayIDs.length > 0) {
81788           var waysIDsForVertex = _wayIDs.filter(function(wayID) {
81789             var way = context.entity(wayID);
81790             return way.nodes.indexOf(vertexID) !== -1;
81791           });
81792           action.limitWays(waysIDsForVertex);
81793         }
81794         _actions.push(action);
81795         _disconnectingWayIds = _disconnectingWayIds.concat(context.graph().parentWays(context.graph().entity(vertexID)).map((d2) => d2.id));
81796       });
81797       _disconnectingWayIds = utilArrayUniq(_disconnectingWayIds).filter(function(id2) {
81798         return _wayIDs.indexOf(id2) === -1;
81799       });
81800       _descriptionID += _actions.length === 1 ? "single_point." : "multiple_points.";
81801       if (_wayIDs.length === 1) {
81802         _descriptionID += "single_way." + context.graph().geometry(_wayIDs[0]);
81803       } else {
81804         _descriptionID += _wayIDs.length === 0 ? "no_ways" : "multiple_ways";
81805       }
81806     } else if (_wayIDs.length > 0) {
81807       var ways = _wayIDs.map(function(id2) {
81808         return context.entity(id2);
81809       });
81810       var nodes = utilGetAllNodes(_wayIDs, context.graph());
81811       _coords = nodes.map(function(n3) {
81812         return n3.loc;
81813       });
81814       var sharedActions = [];
81815       var sharedNodes = [];
81816       var unsharedActions = [];
81817       var unsharedNodes = [];
81818       nodes.forEach(function(node) {
81819         var action = actionDisconnect(node.id).limitWays(_wayIDs);
81820         if (action.disabled(context.graph()) !== "not_connected") {
81821           var count = 0;
81822           for (var i3 in ways) {
81823             var way = ways[i3];
81824             if (way.nodes.indexOf(node.id) !== -1) {
81825               count += 1;
81826             }
81827             if (count > 1)
81828               break;
81829           }
81830           if (count > 1) {
81831             sharedActions.push(action);
81832             sharedNodes.push(node);
81833           } else {
81834             unsharedActions.push(action);
81835             unsharedNodes.push(node);
81836           }
81837         }
81838       });
81839       _descriptionID += "no_points.";
81840       _descriptionID += _wayIDs.length === 1 ? "single_way." : "multiple_ways.";
81841       if (sharedActions.length) {
81842         _actions = sharedActions;
81843         _disconnectingVertexIds = sharedNodes.map((node) => node.id);
81844         _descriptionID += "conjoined";
81845         _annotationID = "from_each_other";
81846       } else {
81847         _actions = unsharedActions;
81848         _disconnectingVertexIds = unsharedNodes.map((node) => node.id);
81849         if (_wayIDs.length === 1) {
81850           _descriptionID += context.graph().geometry(_wayIDs[0]);
81851         } else {
81852           _descriptionID += "separate";
81853         }
81854       }
81855     }
81856     var _extent = utilTotalExtent(_disconnectingVertexIds, context.graph());
81857     var operation = function() {
81858       context.perform(function(graph) {
81859         return _actions.reduce(function(graph2, action) {
81860           return action(graph2);
81861         }, graph);
81862       }, operation.annotation());
81863       context.validator().validate();
81864     };
81865     operation.relatedEntityIds = function() {
81866       if (_vertexIDs.length) {
81867         return _disconnectingWayIds;
81868       }
81869       return _disconnectingVertexIds;
81870     };
81871     operation.available = function() {
81872       if (_actions.length === 0)
81873         return false;
81874       if (_otherIDs.length !== 0)
81875         return false;
81876       if (_vertexIDs.length !== 0 && _wayIDs.length !== 0 && !_wayIDs.every(function(wayID) {
81877         return _vertexIDs.some(function(vertexID) {
81878           var way = context.entity(wayID);
81879           return way.nodes.indexOf(vertexID) !== -1;
81880         });
81881       }))
81882         return false;
81883       return true;
81884     };
81885     operation.disabled = function() {
81886       var reason;
81887       for (var actionIndex in _actions) {
81888         reason = _actions[actionIndex].disabled(context.graph());
81889         if (reason)
81890           return reason;
81891       }
81892       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
81893         return "too_large." + ((_vertexIDs.length ? _vertexIDs : _wayIDs).length === 1 ? "single" : "multiple");
81894       } else if (_coords && someMissing()) {
81895         return "not_downloaded";
81896       } else if (selectedIDs.some(context.hasHiddenConnections)) {
81897         return "connected_to_hidden";
81898       }
81899       return false;
81900       function someMissing() {
81901         if (context.inIntro())
81902           return false;
81903         var osm = context.connection();
81904         if (osm) {
81905           var missing = _coords.filter(function(loc) {
81906             return !osm.isDataLoaded(loc);
81907           });
81908           if (missing.length) {
81909             missing.forEach(function(loc) {
81910               context.loadTileAtLoc(loc);
81911             });
81912             return true;
81913           }
81914         }
81915         return false;
81916       }
81917     };
81918     operation.tooltip = function() {
81919       var disable = operation.disabled();
81920       return disable ? _t.append("operations.disconnect." + disable) : _t.append("operations.disconnect.description." + _descriptionID);
81921     };
81922     operation.annotation = function() {
81923       return _t("operations.disconnect.annotation." + _annotationID);
81924     };
81925     operation.id = "disconnect";
81926     operation.keys = [_t("operations.disconnect.key")];
81927     operation.title = _t.append("operations.disconnect.title");
81928     operation.behavior = behaviorOperation(context).which(operation);
81929     return operation;
81930   }
81931
81932   // modules/operations/downgrade.js
81933   function operationDowngrade(context, selectedIDs) {
81934     var _affectedFeatureCount = 0;
81935     var _downgradeType = downgradeTypeForEntityIDs(selectedIDs);
81936     var _multi = _affectedFeatureCount === 1 ? "single" : "multiple";
81937     function downgradeTypeForEntityIDs(entityIds) {
81938       var downgradeType;
81939       _affectedFeatureCount = 0;
81940       for (var i3 in entityIds) {
81941         var entityID = entityIds[i3];
81942         var type2 = downgradeTypeForEntityID(entityID);
81943         if (type2) {
81944           _affectedFeatureCount += 1;
81945           if (downgradeType && type2 !== downgradeType) {
81946             if (downgradeType !== "generic" && type2 !== "generic") {
81947               downgradeType = "building_address";
81948             } else {
81949               downgradeType = "generic";
81950             }
81951           } else {
81952             downgradeType = type2;
81953           }
81954         }
81955       }
81956       return downgradeType;
81957     }
81958     function downgradeTypeForEntityID(entityID) {
81959       var graph = context.graph();
81960       var entity = graph.entity(entityID);
81961       var preset = _mainPresetIndex.match(entity, graph);
81962       if (!preset || preset.isFallback())
81963         return null;
81964       if (entity.type === "node" && preset.id !== "address" && Object.keys(entity.tags).some(function(key) {
81965         return key.match(/^addr:.{1,}/);
81966       })) {
81967         return "address";
81968       }
81969       var geometry = entity.geometry(graph);
81970       if (geometry === "area" && entity.tags.building && !preset.tags.building) {
81971         return "building";
81972       }
81973       if (geometry === "vertex" && Object.keys(entity.tags).length) {
81974         return "generic";
81975       }
81976       return null;
81977     }
81978     var buildingKeysToKeep = ["architect", "building", "height", "layer", "source", "type", "wheelchair"];
81979     var addressKeysToKeep = ["source"];
81980     var operation = function() {
81981       context.perform(function(graph) {
81982         for (var i3 in selectedIDs) {
81983           var entityID = selectedIDs[i3];
81984           var type2 = downgradeTypeForEntityID(entityID);
81985           if (!type2)
81986             continue;
81987           var tags = Object.assign({}, graph.entity(entityID).tags);
81988           for (var key in tags) {
81989             if (type2 === "address" && addressKeysToKeep.indexOf(key) !== -1)
81990               continue;
81991             if (type2 === "building") {
81992               if (buildingKeysToKeep.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/))
81993                 continue;
81994             }
81995             if (type2 !== "generic") {
81996               if (key.match(/^addr:.{1,}/) || key.match(/^source:.{1,}/))
81997                 continue;
81998             }
81999             delete tags[key];
82000           }
82001           graph = actionChangeTags(entityID, tags)(graph);
82002         }
82003         return graph;
82004       }, operation.annotation());
82005       context.validator().validate();
82006       context.enter(modeSelect(context, selectedIDs));
82007     };
82008     operation.available = function() {
82009       return _downgradeType;
82010     };
82011     operation.disabled = function() {
82012       if (selectedIDs.some(hasWikidataTag)) {
82013         return "has_wikidata_tag";
82014       }
82015       return false;
82016       function hasWikidataTag(id2) {
82017         var entity = context.entity(id2);
82018         return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
82019       }
82020     };
82021     operation.tooltip = function() {
82022       var disable = operation.disabled();
82023       return disable ? _t.append("operations.downgrade." + disable + "." + _multi) : _t.append("operations.downgrade.description." + _downgradeType);
82024     };
82025     operation.annotation = function() {
82026       var suffix;
82027       if (_downgradeType === "building_address") {
82028         suffix = "generic";
82029       } else {
82030         suffix = _downgradeType;
82031       }
82032       return _t("operations.downgrade.annotation." + suffix, { n: _affectedFeatureCount });
82033     };
82034     operation.id = "downgrade";
82035     operation.keys = [uiCmd("\u232B")];
82036     operation.title = _t.append("operations.downgrade.title");
82037     operation.behavior = behaviorOperation(context).which(operation);
82038     return operation;
82039   }
82040
82041   // modules/operations/extract.js
82042   function operationExtract(context, selectedIDs) {
82043     var _amount = selectedIDs.length === 1 ? "single" : "multiple";
82044     var _geometries = utilArrayUniq(selectedIDs.map(function(entityID) {
82045       return context.graph().hasEntity(entityID) && context.graph().geometry(entityID);
82046     }).filter(Boolean));
82047     var _geometryID = _geometries.length === 1 ? _geometries[0] : "feature";
82048     var _extent;
82049     var _actions = selectedIDs.map(function(entityID) {
82050       var graph = context.graph();
82051       var entity = graph.hasEntity(entityID);
82052       if (!entity || !entity.hasInterestingTags())
82053         return null;
82054       if (entity.type === "node" && graph.parentWays(entity).length === 0)
82055         return null;
82056       if (entity.type !== "node") {
82057         var preset = _mainPresetIndex.match(entity, graph);
82058         if (preset.geometry.indexOf("point") === -1)
82059           return null;
82060       }
82061       _extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph);
82062       return actionExtract(entityID, context.projection);
82063     }).filter(Boolean);
82064     var operation = function() {
82065       var combinedAction = function(graph) {
82066         _actions.forEach(function(action) {
82067           graph = action(graph);
82068         });
82069         return graph;
82070       };
82071       context.perform(combinedAction, operation.annotation());
82072       var extractedNodeIDs = _actions.map(function(action) {
82073         return action.getExtractedNodeID();
82074       });
82075       context.enter(modeSelect(context, extractedNodeIDs));
82076     };
82077     operation.available = function() {
82078       return _actions.length && selectedIDs.length === _actions.length;
82079     };
82080     operation.disabled = function() {
82081       if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
82082         return "too_large";
82083       } else if (selectedIDs.some(function(entityID) {
82084         return context.graph().geometry(entityID) === "vertex" && context.hasHiddenConnections(entityID);
82085       })) {
82086         return "connected_to_hidden";
82087       }
82088       return false;
82089     };
82090     operation.tooltip = function() {
82091       var disableReason = operation.disabled();
82092       if (disableReason) {
82093         return _t.append("operations.extract." + disableReason + "." + _amount);
82094       } else {
82095         return _t.append("operations.extract.description." + _geometryID + "." + _amount);
82096       }
82097     };
82098     operation.annotation = function() {
82099       return _t("operations.extract.annotation", { n: selectedIDs.length });
82100     };
82101     operation.id = "extract";
82102     operation.keys = [_t("operations.extract.key")];
82103     operation.title = _t.append("operations.extract.title");
82104     operation.behavior = behaviorOperation(context).which(operation);
82105     return operation;
82106   }
82107
82108   // modules/operations/merge.js
82109   function operationMerge(context, selectedIDs) {
82110     var _action = getAction();
82111     function getAction() {
82112       var join = actionJoin(selectedIDs);
82113       if (!join.disabled(context.graph()))
82114         return join;
82115       var merge2 = actionMerge(selectedIDs);
82116       if (!merge2.disabled(context.graph()))
82117         return merge2;
82118       var mergePolygon = actionMergePolygon(selectedIDs);
82119       if (!mergePolygon.disabled(context.graph()))
82120         return mergePolygon;
82121       var mergeNodes = actionMergeNodes(selectedIDs);
82122       if (!mergeNodes.disabled(context.graph()))
82123         return mergeNodes;
82124       if (join.disabled(context.graph()) !== "not_eligible")
82125         return join;
82126       if (merge2.disabled(context.graph()) !== "not_eligible")
82127         return merge2;
82128       if (mergePolygon.disabled(context.graph()) !== "not_eligible")
82129         return mergePolygon;
82130       return mergeNodes;
82131     }
82132     var operation = function() {
82133       if (operation.disabled())
82134         return;
82135       context.perform(_action, operation.annotation());
82136       context.validator().validate();
82137       var resultIDs = selectedIDs.filter(context.hasEntity);
82138       if (resultIDs.length > 1) {
82139         var interestingIDs = resultIDs.filter(function(id2) {
82140           return context.entity(id2).hasInterestingTags();
82141         });
82142         if (interestingIDs.length)
82143           resultIDs = interestingIDs;
82144       }
82145       context.enter(modeSelect(context, resultIDs));
82146     };
82147     operation.available = function() {
82148       return selectedIDs.length >= 2;
82149     };
82150     operation.disabled = function() {
82151       var actionDisabled = _action.disabled(context.graph());
82152       if (actionDisabled)
82153         return actionDisabled;
82154       var osm = context.connection();
82155       if (osm && _action.resultingWayNodesLength && _action.resultingWayNodesLength(context.graph()) > osm.maxWayNodes()) {
82156         return "too_many_vertices";
82157       }
82158       return false;
82159     };
82160     operation.tooltip = function() {
82161       var disabled = operation.disabled();
82162       if (disabled) {
82163         if (disabled === "conflicting_relations") {
82164           return _t.append("operations.merge.conflicting_relations");
82165         }
82166         if (disabled === "restriction" || disabled === "connectivity") {
82167           return _t.append(
82168             "operations.merge.damage_relation",
82169             { relation: _mainPresetIndex.item("type/" + disabled).name() }
82170           );
82171         }
82172         return _t.append("operations.merge." + disabled);
82173       }
82174       return _t.append("operations.merge.description");
82175     };
82176     operation.annotation = function() {
82177       return _t("operations.merge.annotation", { n: selectedIDs.length });
82178     };
82179     operation.id = "merge";
82180     operation.keys = [_t("operations.merge.key")];
82181     operation.title = _t.append("operations.merge.title");
82182     operation.behavior = behaviorOperation(context).which(operation);
82183     return operation;
82184   }
82185
82186   // modules/operations/paste.js
82187   function operationPaste(context) {
82188     var _pastePoint;
82189     var operation = function() {
82190       if (!_pastePoint)
82191         return;
82192       var oldIDs = context.copyIDs();
82193       if (!oldIDs.length)
82194         return;
82195       var projection2 = context.projection;
82196       var extent = geoExtent();
82197       var oldGraph = context.copyGraph();
82198       var newIDs = [];
82199       var action = actionCopyEntities(oldIDs, oldGraph);
82200       context.perform(action);
82201       var copies = action.copies();
82202       var originals = /* @__PURE__ */ new Set();
82203       Object.values(copies).forEach(function(entity) {
82204         originals.add(entity.id);
82205       });
82206       for (var id2 in copies) {
82207         var oldEntity = oldGraph.entity(id2);
82208         var newEntity = copies[id2];
82209         extent._extend(oldEntity.extent(oldGraph));
82210         var parents = context.graph().parentWays(newEntity);
82211         var parentCopied = parents.some(function(parent) {
82212           return originals.has(parent.id);
82213         });
82214         if (!parentCopied) {
82215           newIDs.push(newEntity.id);
82216         }
82217       }
82218       var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
82219       var delta = geoVecSubtract(_pastePoint, copyPoint);
82220       context.replace(actionMove(newIDs, delta, projection2), operation.annotation());
82221       context.enter(modeSelect(context, newIDs));
82222     };
82223     operation.point = function(val) {
82224       _pastePoint = val;
82225       return operation;
82226     };
82227     operation.available = function() {
82228       return context.mode().id === "browse";
82229     };
82230     operation.disabled = function() {
82231       return !context.copyIDs().length;
82232     };
82233     operation.tooltip = function() {
82234       var oldGraph = context.copyGraph();
82235       var ids = context.copyIDs();
82236       if (!ids.length) {
82237         return _t.append("operations.paste.nothing_copied");
82238       }
82239       return _t.append("operations.paste.description", { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
82240     };
82241     operation.annotation = function() {
82242       var ids = context.copyIDs();
82243       return _t("operations.paste.annotation", { n: ids.length });
82244     };
82245     operation.id = "paste";
82246     operation.keys = [uiCmd("\u2318V")];
82247     operation.title = _t.append("operations.paste.title");
82248     return operation;
82249   }
82250
82251   // modules/operations/reverse.js
82252   function operationReverse(context, selectedIDs) {
82253     var operation = function() {
82254       context.perform(function combinedReverseAction(graph) {
82255         actions().forEach(function(action) {
82256           graph = action(graph);
82257         });
82258         return graph;
82259       }, operation.annotation());
82260       context.validator().validate();
82261     };
82262     function actions(situation) {
82263       return selectedIDs.map(function(entityID) {
82264         var entity = context.hasEntity(entityID);
82265         if (!entity)
82266           return null;
82267         if (situation === "toolbar") {
82268           if (entity.type === "way" && (!entity.isOneWay() && !entity.isSided()))
82269             return null;
82270         }
82271         var geometry = entity.geometry(context.graph());
82272         if (entity.type !== "node" && geometry !== "line")
82273           return null;
82274         var action = actionReverse(entityID);
82275         if (action.disabled(context.graph()))
82276           return null;
82277         return action;
82278       }).filter(Boolean);
82279     }
82280     function reverseTypeID() {
82281       var acts = actions();
82282       var nodeActionCount = acts.filter(function(act) {
82283         var entity = context.hasEntity(act.entityID());
82284         return entity && entity.type === "node";
82285       }).length;
82286       if (nodeActionCount === 0)
82287         return "line";
82288       if (nodeActionCount === acts.length)
82289         return "point";
82290       return "feature";
82291     }
82292     operation.available = function(situation) {
82293       return actions(situation).length > 0;
82294     };
82295     operation.disabled = function() {
82296       return false;
82297     };
82298     operation.tooltip = function() {
82299       return _t.append("operations.reverse.description." + reverseTypeID());
82300     };
82301     operation.annotation = function() {
82302       var acts = actions();
82303       return _t("operations.reverse.annotation." + reverseTypeID(), { n: acts.length });
82304     };
82305     operation.id = "reverse";
82306     operation.keys = [_t("operations.reverse.key")];
82307     operation.title = _t.append("operations.reverse.title");
82308     operation.behavior = behaviorOperation(context).which(operation);
82309     return operation;
82310   }
82311
82312   // modules/operations/split.js
82313   function operationSplit(context, selectedIDs) {
82314     var _vertexIds = selectedIDs.filter(function(id2) {
82315       return context.graph().geometry(id2) === "vertex";
82316     });
82317     var _selectedWayIds = selectedIDs.filter(function(id2) {
82318       var entity = context.graph().hasEntity(id2);
82319       return entity && entity.type === "way";
82320     });
82321     var _isAvailable = _vertexIds.length > 0 && _vertexIds.length + _selectedWayIds.length === selectedIDs.length;
82322     var _action = actionSplit(_vertexIds);
82323     var _ways = [];
82324     var _geometry = "feature";
82325     var _waysAmount = "single";
82326     var _nodesAmount = _vertexIds.length === 1 ? "single" : "multiple";
82327     if (_isAvailable) {
82328       if (_selectedWayIds.length)
82329         _action.limitWays(_selectedWayIds);
82330       _ways = _action.ways(context.graph());
82331       var geometries = {};
82332       _ways.forEach(function(way) {
82333         geometries[way.geometry(context.graph())] = true;
82334       });
82335       if (Object.keys(geometries).length === 1) {
82336         _geometry = Object.keys(geometries)[0];
82337       }
82338       _waysAmount = _ways.length === 1 ? "single" : "multiple";
82339     }
82340     var operation = function() {
82341       var difference = context.perform(_action, operation.annotation());
82342       var idsToSelect = _vertexIds.concat(difference.extantIDs().filter(function(id2) {
82343         return context.entity(id2).type === "way";
82344       }));
82345       context.enter(modeSelect(context, idsToSelect));
82346     };
82347     operation.relatedEntityIds = function() {
82348       return _selectedWayIds.length ? [] : _ways.map((way) => way.id);
82349     };
82350     operation.available = function() {
82351       return _isAvailable;
82352     };
82353     operation.disabled = function() {
82354       var reason = _action.disabled(context.graph());
82355       if (reason) {
82356         return reason;
82357       } else if (selectedIDs.some(context.hasHiddenConnections)) {
82358         return "connected_to_hidden";
82359       }
82360       return false;
82361     };
82362     operation.tooltip = function() {
82363       var disable = operation.disabled();
82364       return disable ? _t.append("operations.split." + disable) : _t.append("operations.split.description." + _geometry + "." + _waysAmount + "." + _nodesAmount + "_node");
82365     };
82366     operation.annotation = function() {
82367       return _t("operations.split.annotation." + _geometry, { n: _ways.length });
82368     };
82369     operation.icon = function() {
82370       if (_waysAmount === "multiple") {
82371         return "#iD-operation-split-multiple";
82372       } else {
82373         return "#iD-operation-split";
82374       }
82375     };
82376     operation.id = "split";
82377     operation.keys = [_t("operations.split.key")];
82378     operation.title = _t.append("operations.split.title");
82379     operation.behavior = behaviorOperation(context).which(operation);
82380     return operation;
82381   }
82382
82383   // modules/operations/straighten.js
82384   function operationStraighten(context, selectedIDs) {
82385     var _wayIDs = selectedIDs.filter(function(id2) {
82386       return id2.charAt(0) === "w";
82387     });
82388     var _nodeIDs = selectedIDs.filter(function(id2) {
82389       return id2.charAt(0) === "n";
82390     });
82391     var _amount = (_wayIDs.length ? _wayIDs : _nodeIDs).length === 1 ? "single" : "multiple";
82392     var _nodes = utilGetAllNodes(selectedIDs, context.graph());
82393     var _coords = _nodes.map(function(n3) {
82394       return n3.loc;
82395     });
82396     var _extent = utilTotalExtent(selectedIDs, context.graph());
82397     var _action = chooseAction();
82398     var _geometry;
82399     function chooseAction() {
82400       if (_wayIDs.length === 0 && _nodeIDs.length > 2) {
82401         _geometry = "point";
82402         return actionStraightenNodes(_nodeIDs, context.projection);
82403       } else if (_wayIDs.length > 0 && (_nodeIDs.length === 0 || _nodeIDs.length === 2)) {
82404         var startNodeIDs = [];
82405         var endNodeIDs = [];
82406         for (var i3 = 0; i3 < selectedIDs.length; i3++) {
82407           var entity = context.entity(selectedIDs[i3]);
82408           if (entity.type === "node") {
82409             continue;
82410           } else if (entity.type !== "way" || entity.isClosed()) {
82411             return null;
82412           }
82413           startNodeIDs.push(entity.first());
82414           endNodeIDs.push(entity.last());
82415         }
82416         startNodeIDs = startNodeIDs.filter(function(n3) {
82417           return startNodeIDs.indexOf(n3) === startNodeIDs.lastIndexOf(n3);
82418         });
82419         endNodeIDs = endNodeIDs.filter(function(n3) {
82420           return endNodeIDs.indexOf(n3) === endNodeIDs.lastIndexOf(n3);
82421         });
82422         if (utilArrayDifference(startNodeIDs, endNodeIDs).length + utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2)
82423           return null;
82424         var wayNodeIDs = utilGetAllNodes(_wayIDs, context.graph()).map(function(node) {
82425           return node.id;
82426         });
82427         if (wayNodeIDs.length <= 2)
82428           return null;
82429         if (_nodeIDs.length === 2 && (wayNodeIDs.indexOf(_nodeIDs[0]) === -1 || wayNodeIDs.indexOf(_nodeIDs[1]) === -1))
82430           return null;
82431         if (_nodeIDs.length) {
82432           _extent = utilTotalExtent(_nodeIDs, context.graph());
82433         }
82434         _geometry = "line";
82435         return actionStraightenWay(selectedIDs, context.projection);
82436       }
82437       return null;
82438     }
82439     function operation() {
82440       if (!_action)
82441         return;
82442       context.perform(_action, operation.annotation());
82443       window.setTimeout(function() {
82444         context.validator().validate();
82445       }, 300);
82446     }
82447     operation.available = function() {
82448       return Boolean(_action);
82449     };
82450     operation.disabled = function() {
82451       var reason = _action.disabled(context.graph());
82452       if (reason) {
82453         return reason;
82454       } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
82455         return "too_large";
82456       } else if (someMissing()) {
82457         return "not_downloaded";
82458       } else if (selectedIDs.some(context.hasHiddenConnections)) {
82459         return "connected_to_hidden";
82460       }
82461       return false;
82462       function someMissing() {
82463         if (context.inIntro())
82464           return false;
82465         var osm = context.connection();
82466         if (osm) {
82467           var missing = _coords.filter(function(loc) {
82468             return !osm.isDataLoaded(loc);
82469           });
82470           if (missing.length) {
82471             missing.forEach(function(loc) {
82472               context.loadTileAtLoc(loc);
82473             });
82474             return true;
82475           }
82476         }
82477         return false;
82478       }
82479     };
82480     operation.tooltip = function() {
82481       var disable = operation.disabled();
82482       return disable ? _t.append("operations.straighten." + disable + "." + _amount) : _t.append("operations.straighten.description." + _geometry + (_wayIDs.length === 1 ? "" : "s"));
82483     };
82484     operation.annotation = function() {
82485       return _t("operations.straighten.annotation." + _geometry, { n: _wayIDs.length ? _wayIDs.length : _nodeIDs.length });
82486     };
82487     operation.id = "straighten";
82488     operation.keys = [_t("operations.straighten.key")];
82489     operation.title = _t.append("operations.straighten.title");
82490     operation.behavior = behaviorOperation(context).which(operation);
82491     return operation;
82492   }
82493
82494   // modules/modes/select.js
82495   function modeSelect(context, selectedIDs) {
82496     var mode = {
82497       id: "select",
82498       button: "browse"
82499     };
82500     var keybinding = utilKeybinding("select");
82501     var _breatheBehavior = behaviorBreathe(context);
82502     var _modeDragNode = modeDragNode(context);
82503     var _selectBehavior;
82504     var _behaviors = [];
82505     var _operations = [];
82506     var _newFeature = false;
82507     var _follow = false;
82508     var _focusedParentWayId;
82509     var _focusedVertexIds;
82510     function singular() {
82511       if (selectedIDs && selectedIDs.length === 1) {
82512         return context.hasEntity(selectedIDs[0]);
82513       }
82514     }
82515     function selectedEntities() {
82516       return selectedIDs.map(function(id2) {
82517         return context.hasEntity(id2);
82518       }).filter(Boolean);
82519     }
82520     function checkSelectedIDs() {
82521       var ids = [];
82522       if (Array.isArray(selectedIDs)) {
82523         ids = selectedIDs.filter(function(id2) {
82524           return context.hasEntity(id2);
82525         });
82526       }
82527       if (!ids.length) {
82528         context.enter(modeBrowse(context));
82529         return false;
82530       } else if (selectedIDs.length > 1 && ids.length === 1 || selectedIDs.length === 1 && ids.length > 1) {
82531         context.enter(modeSelect(context, ids));
82532         return false;
82533       }
82534       selectedIDs = ids;
82535       return true;
82536     }
82537     function parentWaysIdsOfSelection(onlyCommonParents) {
82538       var graph = context.graph();
82539       var parents = [];
82540       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
82541         var entity = context.hasEntity(selectedIDs[i3]);
82542         if (!entity || entity.geometry(graph) !== "vertex") {
82543           return [];
82544         }
82545         var currParents = graph.parentWays(entity).map(function(w2) {
82546           return w2.id;
82547         });
82548         if (!parents.length) {
82549           parents = currParents;
82550           continue;
82551         }
82552         parents = (onlyCommonParents ? utilArrayIntersection : utilArrayUnion)(parents, currParents);
82553         if (!parents.length) {
82554           return [];
82555         }
82556       }
82557       return parents;
82558     }
82559     function childNodeIdsOfSelection(onlyCommon) {
82560       var graph = context.graph();
82561       var childs = [];
82562       for (var i3 = 0; i3 < selectedIDs.length; i3++) {
82563         var entity = context.hasEntity(selectedIDs[i3]);
82564         if (!entity || !["area", "line"].includes(entity.geometry(graph))) {
82565           return [];
82566         }
82567         var currChilds = graph.childNodes(entity).map(function(node) {
82568           return node.id;
82569         });
82570         if (!childs.length) {
82571           childs = currChilds;
82572           continue;
82573         }
82574         childs = (onlyCommon ? utilArrayIntersection : utilArrayUnion)(childs, currChilds);
82575         if (!childs.length) {
82576           return [];
82577         }
82578       }
82579       return childs;
82580     }
82581     function checkFocusedParent() {
82582       if (_focusedParentWayId) {
82583         var parents = parentWaysIdsOfSelection(true);
82584         if (parents.indexOf(_focusedParentWayId) === -1)
82585           _focusedParentWayId = null;
82586       }
82587     }
82588     function parentWayIdForVertexNavigation() {
82589       var parentIds = parentWaysIdsOfSelection(true);
82590       if (_focusedParentWayId && parentIds.indexOf(_focusedParentWayId) !== -1) {
82591         return _focusedParentWayId;
82592       }
82593       return parentIds.length ? parentIds[0] : null;
82594     }
82595     mode.selectedIDs = function(val) {
82596       if (!arguments.length)
82597         return selectedIDs;
82598       selectedIDs = val;
82599       return mode;
82600     };
82601     mode.zoomToSelected = function() {
82602       context.map().zoomToEase(selectedEntities());
82603     };
82604     mode.newFeature = function(val) {
82605       if (!arguments.length)
82606         return _newFeature;
82607       _newFeature = val;
82608       return mode;
82609     };
82610     mode.selectBehavior = function(val) {
82611       if (!arguments.length)
82612         return _selectBehavior;
82613       _selectBehavior = val;
82614       return mode;
82615     };
82616     mode.follow = function(val) {
82617       if (!arguments.length)
82618         return _follow;
82619       _follow = val;
82620       return mode;
82621     };
82622     function loadOperations() {
82623       _operations.forEach(function(operation) {
82624         if (operation.behavior) {
82625           context.uninstall(operation.behavior);
82626         }
82627       });
82628       _operations = Object.values(operations_exports).map(function(o2) {
82629         return o2(context, selectedIDs);
82630       }).filter(function(o2) {
82631         return o2.id !== "delete" && o2.id !== "downgrade" && o2.id !== "copy";
82632       }).concat([
82633         // group copy/downgrade/delete operation together at the end of the list
82634         operationCopy(context, selectedIDs),
82635         operationDowngrade(context, selectedIDs),
82636         operationDelete(context, selectedIDs)
82637       ]).filter(function(operation) {
82638         return operation.available();
82639       });
82640       _operations.forEach(function(operation) {
82641         if (operation.behavior) {
82642           context.install(operation.behavior);
82643         }
82644       });
82645       context.ui().closeEditMenu();
82646     }
82647     mode.operations = function() {
82648       return _operations;
82649     };
82650     mode.enter = function() {
82651       if (!checkSelectedIDs())
82652         return;
82653       context.features().forceVisible(selectedIDs);
82654       _modeDragNode.restoreSelectedIDs(selectedIDs);
82655       loadOperations();
82656       if (!_behaviors.length) {
82657         if (!_selectBehavior)
82658           _selectBehavior = behaviorSelect(context);
82659         _behaviors = [
82660           behaviorPaste(context),
82661           _breatheBehavior,
82662           behaviorHover(context).on("hover", context.ui().sidebar.hoverModeSelect),
82663           _selectBehavior,
82664           behaviorLasso(context),
82665           _modeDragNode.behavior,
82666           modeDragNote(context).behavior
82667         ];
82668       }
82669       _behaviors.forEach(context.install);
82670       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);
82671       select_default2(document).call(keybinding);
82672       context.ui().sidebar.select(selectedIDs, _newFeature);
82673       context.history().on("change.select", function() {
82674         loadOperations();
82675         selectElements();
82676       }).on("undone.select", checkSelectedIDs).on("redone.select", checkSelectedIDs);
82677       context.map().on("drawn.select", selectElements).on("crossEditableZoom.select", function() {
82678         selectElements();
82679         _breatheBehavior.restartIfNeeded(context.surface());
82680       });
82681       context.map().doubleUpHandler().on("doubleUp.modeSelect", didDoubleUp);
82682       selectElements();
82683       if (_follow) {
82684         var extent = geoExtent();
82685         var graph = context.graph();
82686         selectedIDs.forEach(function(id2) {
82687           var entity = context.entity(id2);
82688           extent._extend(entity.extent(graph));
82689         });
82690         var loc = extent.center();
82691         context.map().centerEase(loc);
82692         _follow = false;
82693       }
82694       function nudgeSelection(delta) {
82695         return function() {
82696           if (!context.map().withinEditableZoom())
82697             return;
82698           var moveOp = operationMove(context, selectedIDs);
82699           if (moveOp.disabled()) {
82700             context.ui().flash.duration(4e3).iconName("#iD-operation-" + moveOp.id).iconClass("operation disabled").label(moveOp.tooltip())();
82701           } else {
82702             context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
82703             context.validator().validate();
82704           }
82705         };
82706       }
82707       function scaleSelection(factor) {
82708         return function() {
82709           if (!context.map().withinEditableZoom())
82710             return;
82711           let nodes = utilGetAllNodes(selectedIDs, context.graph());
82712           let isUp = factor > 1;
82713           if (nodes.length <= 1)
82714             return;
82715           let extent2 = utilTotalExtent(selectedIDs, context.graph());
82716           function scalingDisabled() {
82717             if (tooSmall()) {
82718               return "too_small";
82719             } else if (extent2.percentContainedIn(context.map().extent()) < 0.8) {
82720               return "too_large";
82721             } else if (someMissing() || selectedIDs.some(incompleteRelation)) {
82722               return "not_downloaded";
82723             } else if (selectedIDs.some(context.hasHiddenConnections)) {
82724               return "connected_to_hidden";
82725             }
82726             return false;
82727             function tooSmall() {
82728               if (isUp)
82729                 return false;
82730               let dLon = Math.abs(extent2[1][0] - extent2[0][0]);
82731               let dLat = Math.abs(extent2[1][1] - extent2[0][1]);
82732               return dLon < geoMetersToLon(1, extent2[1][1]) && dLat < geoMetersToLat(1);
82733             }
82734             function someMissing() {
82735               if (context.inIntro())
82736                 return false;
82737               let osm = context.connection();
82738               if (osm) {
82739                 let missing = nodes.filter(function(n3) {
82740                   return !osm.isDataLoaded(n3.loc);
82741                 });
82742                 if (missing.length) {
82743                   missing.forEach(function(loc2) {
82744                     context.loadTileAtLoc(loc2);
82745                   });
82746                   return true;
82747                 }
82748               }
82749               return false;
82750             }
82751             function incompleteRelation(id2) {
82752               let entity = context.entity(id2);
82753               return entity.type === "relation" && !entity.isComplete(context.graph());
82754             }
82755           }
82756           const disabled = scalingDisabled();
82757           if (disabled) {
82758             let multi = selectedIDs.length === 1 ? "single" : "multiple";
82759             context.ui().flash.duration(4e3).iconName("#iD-icon-no").iconClass("operation disabled").label(_t.append("operations.scale." + disabled + "." + multi))();
82760           } else {
82761             const pivot = context.projection(extent2.center());
82762             const annotation = _t("operations.scale.annotation." + (isUp ? "up" : "down") + ".feature", { n: selectedIDs.length });
82763             context.perform(actionScale(selectedIDs, pivot, factor, context.projection), annotation);
82764             context.validator().validate();
82765           }
82766         };
82767       }
82768       function didDoubleUp(d3_event, loc2) {
82769         if (!context.map().withinEditableZoom())
82770           return;
82771         var target = select_default2(d3_event.target);
82772         var datum2 = target.datum();
82773         var entity = datum2 && datum2.properties && datum2.properties.entity;
82774         if (!entity)
82775           return;
82776         if (entity instanceof osmWay && target.classed("target")) {
82777           var choice = geoChooseEdge(context.graph().childNodes(entity), loc2, context.projection);
82778           var prev = entity.nodes[choice.index - 1];
82779           var next = entity.nodes[choice.index];
82780           context.perform(
82781             actionAddMidpoint({ loc: choice.loc, edge: [prev, next] }, osmNode()),
82782             _t("operations.add.annotation.vertex")
82783           );
82784           context.validator().validate();
82785         } else if (entity.type === "midpoint") {
82786           context.perform(
82787             actionAddMidpoint({ loc: entity.loc, edge: entity.edge }, osmNode()),
82788             _t("operations.add.annotation.vertex")
82789           );
82790           context.validator().validate();
82791         }
82792       }
82793       function selectElements() {
82794         if (!checkSelectedIDs())
82795           return;
82796         var surface = context.surface();
82797         surface.selectAll(".selected-member").classed("selected-member", false);
82798         surface.selectAll(".selected").classed("selected", false);
82799         surface.selectAll(".related").classed("related", false);
82800         checkFocusedParent();
82801         if (_focusedParentWayId) {
82802           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
82803         }
82804         if (context.map().withinEditableZoom()) {
82805           surface.selectAll(utilDeepMemberSelector(
82806             selectedIDs,
82807             context.graph(),
82808             true
82809             /* skipMultipolgonMembers */
82810           )).classed("selected-member", true);
82811           surface.selectAll(utilEntityOrDeepMemberSelector(selectedIDs, context.graph())).classed("selected", true);
82812         }
82813       }
82814       function esc() {
82815         if (context.container().select(".combobox").size())
82816           return;
82817         context.enter(modeBrowse(context));
82818       }
82819       function firstVertex(d3_event) {
82820         d3_event.preventDefault();
82821         var entity = singular();
82822         var parentId = parentWayIdForVertexNavigation();
82823         var way;
82824         if (entity && entity.type === "way") {
82825           way = entity;
82826         } else if (parentId) {
82827           way = context.entity(parentId);
82828         }
82829         _focusedParentWayId = way && way.id;
82830         if (way) {
82831           context.enter(
82832             mode.selectedIDs([way.first()]).follow(true)
82833           );
82834         }
82835       }
82836       function lastVertex(d3_event) {
82837         d3_event.preventDefault();
82838         var entity = singular();
82839         var parentId = parentWayIdForVertexNavigation();
82840         var way;
82841         if (entity && entity.type === "way") {
82842           way = entity;
82843         } else if (parentId) {
82844           way = context.entity(parentId);
82845         }
82846         _focusedParentWayId = way && way.id;
82847         if (way) {
82848           context.enter(
82849             mode.selectedIDs([way.last()]).follow(true)
82850           );
82851         }
82852       }
82853       function previousVertex(d3_event) {
82854         d3_event.preventDefault();
82855         var parentId = parentWayIdForVertexNavigation();
82856         _focusedParentWayId = parentId;
82857         if (!parentId)
82858           return;
82859         var way = context.entity(parentId);
82860         var length = way.nodes.length;
82861         var curr = way.nodes.indexOf(selectedIDs[0]);
82862         var index = -1;
82863         if (curr > 0) {
82864           index = curr - 1;
82865         } else if (way.isClosed()) {
82866           index = length - 2;
82867         }
82868         if (index !== -1) {
82869           context.enter(
82870             mode.selectedIDs([way.nodes[index]]).follow(true)
82871           );
82872         }
82873       }
82874       function nextVertex(d3_event) {
82875         d3_event.preventDefault();
82876         var parentId = parentWayIdForVertexNavigation();
82877         _focusedParentWayId = parentId;
82878         if (!parentId)
82879           return;
82880         var way = context.entity(parentId);
82881         var length = way.nodes.length;
82882         var curr = way.nodes.indexOf(selectedIDs[0]);
82883         var index = -1;
82884         if (curr < length - 1) {
82885           index = curr + 1;
82886         } else if (way.isClosed()) {
82887           index = 0;
82888         }
82889         if (index !== -1) {
82890           context.enter(
82891             mode.selectedIDs([way.nodes[index]]).follow(true)
82892           );
82893         }
82894       }
82895       function focusNextParent(d3_event) {
82896         d3_event.preventDefault();
82897         var parents = parentWaysIdsOfSelection(true);
82898         if (!parents || parents.length < 2)
82899           return;
82900         var index = parents.indexOf(_focusedParentWayId);
82901         if (index < 0 || index > parents.length - 2) {
82902           _focusedParentWayId = parents[0];
82903         } else {
82904           _focusedParentWayId = parents[index + 1];
82905         }
82906         var surface = context.surface();
82907         surface.selectAll(".related").classed("related", false);
82908         if (_focusedParentWayId) {
82909           surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
82910         }
82911       }
82912       function selectParent(d3_event) {
82913         d3_event.preventDefault();
82914         var currentSelectedIds = mode.selectedIDs();
82915         var parentIds = _focusedParentWayId ? [_focusedParentWayId] : parentWaysIdsOfSelection(false);
82916         if (!parentIds.length)
82917           return;
82918         context.enter(
82919           mode.selectedIDs(parentIds)
82920         );
82921         _focusedVertexIds = currentSelectedIds;
82922       }
82923       function selectChild(d3_event) {
82924         d3_event.preventDefault();
82925         var currentSelectedIds = mode.selectedIDs();
82926         var childIds = _focusedVertexIds ? _focusedVertexIds.filter((id2) => context.hasEntity(id2)) : childNodeIdsOfSelection(true);
82927         if (!childIds || !childIds.length)
82928           return;
82929         if (currentSelectedIds.length === 1)
82930           _focusedParentWayId = currentSelectedIds[0];
82931         context.enter(
82932           mode.selectedIDs(childIds)
82933         );
82934       }
82935     };
82936     mode.exit = function() {
82937       _newFeature = false;
82938       _focusedVertexIds = null;
82939       _operations.forEach(function(operation) {
82940         if (operation.behavior) {
82941           context.uninstall(operation.behavior);
82942         }
82943       });
82944       _operations = [];
82945       _behaviors.forEach(context.uninstall);
82946       select_default2(document).call(keybinding.unbind);
82947       context.ui().closeEditMenu();
82948       context.history().on("change.select", null).on("undone.select", null).on("redone.select", null);
82949       var surface = context.surface();
82950       surface.selectAll(".selected-member").classed("selected-member", false);
82951       surface.selectAll(".selected").classed("selected", false);
82952       surface.selectAll(".highlighted").classed("highlighted", false);
82953       surface.selectAll(".related").classed("related", false);
82954       context.map().on("drawn.select", null);
82955       context.ui().sidebar.hide();
82956       context.features().forceVisible([]);
82957       var entity = singular();
82958       if (_newFeature && entity && entity.type === "relation" && // no tags
82959       Object.keys(entity.tags).length === 0 && // no parent relations
82960       context.graph().parentRelations(entity).length === 0 && // no members or one member with no role
82961       (entity.members.length === 0 || entity.members.length === 1 && !entity.members[0].role)) {
82962         var deleteAction = actionDeleteRelation(
82963           entity.id,
82964           true
82965           /* don't delete untagged members */
82966         );
82967         context.perform(deleteAction, _t("operations.delete.annotation.relation"));
82968         context.validator().validate();
82969       }
82970     };
82971     return mode;
82972   }
82973
82974   // modules/behavior/lasso.js
82975   function behaviorLasso(context) {
82976     var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
82977     var behavior = function(selection2) {
82978       var lasso;
82979       function pointerdown(d3_event) {
82980         var button = 0;
82981         if (d3_event.button === button && d3_event.shiftKey === true) {
82982           lasso = null;
82983           select_default2(window).on(_pointerPrefix + "move.lasso", pointermove).on(_pointerPrefix + "up.lasso", pointerup);
82984           d3_event.stopPropagation();
82985         }
82986       }
82987       function pointermove() {
82988         if (!lasso) {
82989           lasso = uiLasso(context);
82990           context.surface().call(lasso);
82991         }
82992         lasso.p(context.map().mouse());
82993       }
82994       function normalize2(a2, b2) {
82995         return [
82996           [Math.min(a2[0], b2[0]), Math.min(a2[1], b2[1])],
82997           [Math.max(a2[0], b2[0]), Math.max(a2[1], b2[1])]
82998         ];
82999       }
83000       function lassoed() {
83001         if (!lasso)
83002           return [];
83003         var graph = context.graph();
83004         var limitToNodes;
83005         if (context.map().editableDataEnabled(
83006           true
83007           /* skipZoomCheck */
83008         ) && context.map().isInWideSelection()) {
83009           limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), graph));
83010         } else if (!context.map().editableDataEnabled()) {
83011           return [];
83012         }
83013         var bounds = lasso.extent().map(context.projection.invert);
83014         var extent = geoExtent(normalize2(bounds[0], bounds[1]));
83015         var intersects = context.history().intersects(extent).filter(function(entity) {
83016           return entity.type === "node" && (!limitToNodes || limitToNodes.has(entity)) && geoPointInPolygon(context.projection(entity.loc), lasso.coordinates) && !context.features().isHidden(entity, graph, entity.geometry(graph));
83017         });
83018         intersects.sort(function(node1, node2) {
83019           var parents1 = graph.parentWays(node1);
83020           var parents2 = graph.parentWays(node2);
83021           if (parents1.length && parents2.length) {
83022             var sharedParents = utilArrayIntersection(parents1, parents2);
83023             if (sharedParents.length) {
83024               var sharedParentNodes = sharedParents[0].nodes;
83025               return sharedParentNodes.indexOf(node1.id) - sharedParentNodes.indexOf(node2.id);
83026             } else {
83027               return Number(parents1[0].id.slice(1)) - Number(parents2[0].id.slice(1));
83028             }
83029           } else if (parents1.length || parents2.length) {
83030             return parents1.length - parents2.length;
83031           }
83032           return node1.loc[0] - node2.loc[0];
83033         });
83034         return intersects.map(function(entity) {
83035           return entity.id;
83036         });
83037       }
83038       function pointerup() {
83039         select_default2(window).on(_pointerPrefix + "move.lasso", null).on(_pointerPrefix + "up.lasso", null);
83040         if (!lasso)
83041           return;
83042         var ids = lassoed();
83043         lasso.close();
83044         if (ids.length) {
83045           context.enter(modeSelect(context, ids));
83046         }
83047       }
83048       selection2.on(_pointerPrefix + "down.lasso", pointerdown);
83049     };
83050     behavior.off = function(selection2) {
83051       selection2.on(_pointerPrefix + "down.lasso", null);
83052     };
83053     return behavior;
83054   }
83055
83056   // modules/modes/browse.js
83057   function modeBrowse(context) {
83058     var mode = {
83059       button: "browse",
83060       id: "browse",
83061       title: _t.append("modes.browse.title"),
83062       description: _t.append("modes.browse.description")
83063     };
83064     var sidebar;
83065     var _selectBehavior;
83066     var _behaviors = [];
83067     mode.selectBehavior = function(val) {
83068       if (!arguments.length)
83069         return _selectBehavior;
83070       _selectBehavior = val;
83071       return mode;
83072     };
83073     mode.enter = function() {
83074       if (!_behaviors.length) {
83075         if (!_selectBehavior)
83076           _selectBehavior = behaviorSelect(context);
83077         _behaviors = [
83078           behaviorPaste(context),
83079           behaviorHover(context).on("hover", context.ui().sidebar.hover),
83080           _selectBehavior,
83081           behaviorLasso(context),
83082           modeDragNode(context).behavior,
83083           modeDragNote(context).behavior
83084         ];
83085       }
83086       _behaviors.forEach(context.install);
83087       if (document.activeElement && document.activeElement.blur) {
83088         document.activeElement.blur();
83089       }
83090       if (sidebar) {
83091         context.ui().sidebar.show(sidebar);
83092       } else {
83093         context.ui().sidebar.select(null);
83094       }
83095     };
83096     mode.exit = function() {
83097       context.ui().sidebar.hover.cancel();
83098       _behaviors.forEach(context.uninstall);
83099       if (sidebar) {
83100         context.ui().sidebar.hide();
83101       }
83102     };
83103     mode.sidebar = function(_2) {
83104       if (!arguments.length)
83105         return sidebar;
83106       sidebar = _2;
83107       return mode;
83108     };
83109     mode.operations = function() {
83110       return [operationPaste(context)];
83111     };
83112     return mode;
83113   }
83114
83115   // modules/behavior/add_way.js
83116   function behaviorAddWay(context) {
83117     var dispatch14 = dispatch_default("start", "startFromWay", "startFromNode");
83118     var draw = behaviorDraw(context);
83119     function behavior(surface) {
83120       draw.on("click", function() {
83121         dispatch14.apply("start", this, arguments);
83122       }).on("clickWay", function() {
83123         dispatch14.apply("startFromWay", this, arguments);
83124       }).on("clickNode", function() {
83125         dispatch14.apply("startFromNode", this, arguments);
83126       }).on("cancel", behavior.cancel).on("finish", behavior.cancel);
83127       context.map().dblclickZoomEnable(false);
83128       surface.call(draw);
83129     }
83130     behavior.off = function(surface) {
83131       surface.call(draw.off);
83132     };
83133     behavior.cancel = function() {
83134       window.setTimeout(function() {
83135         context.map().dblclickZoomEnable(true);
83136       }, 1e3);
83137       context.enter(modeBrowse(context));
83138     };
83139     return utilRebind(behavior, dispatch14, "on");
83140   }
83141
83142   // modules/behavior/hash.js
83143   function behaviorHash(context) {
83144     var _cachedHash = null;
83145     var _latitudeLimit = 90 - 1e-8;
83146     function computedHashParameters() {
83147       var map2 = context.map();
83148       var center = map2.center();
83149       var zoom = map2.zoom();
83150       var precision2 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
83151       var oldParams = utilObjectOmit(
83152         utilStringQs(window.location.hash),
83153         ["comment", "source", "hashtags", "walkthrough"]
83154       );
83155       var newParams = {};
83156       delete oldParams.id;
83157       var selected = context.selectedIDs().filter(function(id2) {
83158         return context.hasEntity(id2);
83159       });
83160       if (selected.length) {
83161         newParams.id = selected.join(",");
83162       }
83163       newParams.map = zoom.toFixed(2) + "/" + center[1].toFixed(precision2) + "/" + center[0].toFixed(precision2);
83164       return Object.assign(oldParams, newParams);
83165     }
83166     function computedHash() {
83167       return "#" + utilQsString(computedHashParameters(), true);
83168     }
83169     function computedTitle(includeChangeCount) {
83170       var baseTitle = context.documentTitleBase() || "iD";
83171       var contextual;
83172       var changeCount;
83173       var titleID;
83174       var selected = context.selectedIDs().filter(function(id2) {
83175         return context.hasEntity(id2);
83176       });
83177       if (selected.length) {
83178         var firstLabel = utilDisplayLabel(context.entity(selected[0]), context.graph());
83179         if (selected.length > 1) {
83180           contextual = _t("title.labeled_and_more", {
83181             labeled: firstLabel,
83182             count: selected.length - 1
83183           });
83184         } else {
83185           contextual = firstLabel;
83186         }
83187         titleID = "context";
83188       }
83189       if (includeChangeCount) {
83190         changeCount = context.history().difference().summary().length;
83191         if (changeCount > 0) {
83192           titleID = contextual ? "changes_context" : "changes";
83193         }
83194       }
83195       if (titleID) {
83196         return _t("title.format." + titleID, {
83197           changes: changeCount,
83198           base: baseTitle,
83199           context: contextual
83200         });
83201       }
83202       return baseTitle;
83203     }
83204     function updateTitle(includeChangeCount) {
83205       if (!context.setsDocumentTitle())
83206         return;
83207       var newTitle = computedTitle(includeChangeCount);
83208       if (document.title !== newTitle) {
83209         document.title = newTitle;
83210       }
83211     }
83212     function updateHashIfNeeded() {
83213       if (context.inIntro())
83214         return;
83215       var latestHash = computedHash();
83216       if (_cachedHash !== latestHash) {
83217         _cachedHash = latestHash;
83218         window.history.replaceState(null, computedTitle(
83219           false
83220           /* includeChangeCount */
83221         ), latestHash);
83222         updateTitle(
83223           true
83224           /* includeChangeCount */
83225         );
83226         const q2 = utilStringQs(latestHash);
83227         if (q2.map) {
83228           corePreferences("map-location", q2.map);
83229         }
83230       }
83231     }
83232     var _throttledUpdate = throttle_default(updateHashIfNeeded, 500);
83233     var _throttledUpdateTitle = throttle_default(function() {
83234       updateTitle(
83235         true
83236         /* includeChangeCount */
83237       );
83238     }, 500);
83239     function hashchange() {
83240       if (window.location.hash === _cachedHash)
83241         return;
83242       _cachedHash = window.location.hash;
83243       var q2 = utilStringQs(_cachedHash);
83244       var mapArgs = (q2.map || "").split("/").map(Number);
83245       if (mapArgs.length < 3 || mapArgs.some(isNaN)) {
83246         updateHashIfNeeded();
83247       } else {
83248         if (_cachedHash === computedHash())
83249           return;
83250         var mode = context.mode();
83251         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
83252         if (q2.id && mode) {
83253           var ids = q2.id.split(",").filter(function(id2) {
83254             return context.hasEntity(id2);
83255           });
83256           if (ids.length && (mode.id === "browse" || mode.id === "select" && !utilArrayIdentical(mode.selectedIDs(), ids))) {
83257             context.enter(modeSelect(context, ids));
83258             return;
83259           }
83260         }
83261         var center = context.map().center();
83262         var dist = geoSphericalDistance(center, [mapArgs[2], mapArgs[1]]);
83263         var maxdist = 500;
83264         if (mode && mode.id.match(/^draw/) !== null && dist > maxdist) {
83265           context.enter(modeBrowse(context));
83266           return;
83267         }
83268       }
83269     }
83270     function behavior() {
83271       context.map().on("move.behaviorHash", _throttledUpdate);
83272       context.history().on("change.behaviorHash", _throttledUpdateTitle);
83273       context.on("enter.behaviorHash", _throttledUpdate);
83274       select_default2(window).on("hashchange.behaviorHash", hashchange);
83275       var q2 = utilStringQs(window.location.hash);
83276       if (q2.id) {
83277         context.zoomToEntity(q2.id.split(",")[0], !q2.map);
83278       }
83279       if (q2.walkthrough === "true") {
83280         behavior.startWalkthrough = true;
83281       }
83282       if (q2.map) {
83283         behavior.hadLocation = true;
83284       } else if (!q2.id && corePreferences("map-location")) {
83285         const mapArgs = corePreferences("map-location").split("/").map(Number);
83286         context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
83287         updateHashIfNeeded();
83288         behavior.hadLocation = true;
83289       }
83290       hashchange();
83291       updateTitle(false);
83292     }
83293     behavior.off = function() {
83294       _throttledUpdate.cancel();
83295       _throttledUpdateTitle.cancel();
83296       context.map().on("move.behaviorHash", null);
83297       context.on("enter.behaviorHash", null);
83298       select_default2(window).on("hashchange.behaviorHash", null);
83299       window.location.hash = "";
83300     };
83301     return behavior;
83302   }
83303
83304   // node_modules/d3-brush/src/brush.js
83305   var { abs: abs2, max: max2, min: min2 } = Math;
83306   function number1(e3) {
83307     return [+e3[0], +e3[1]];
83308   }
83309   function number22(e3) {
83310     return [number1(e3[0]), number1(e3[1])];
83311   }
83312   var X3 = {
83313     name: "x",
83314     handles: ["w", "e"].map(type),
83315     input: function(x2, e3) {
83316       return x2 == null ? null : [[+x2[0], e3[0][1]], [+x2[1], e3[1][1]]];
83317     },
83318     output: function(xy) {
83319       return xy && [xy[0][0], xy[1][0]];
83320     }
83321   };
83322   var Y3 = {
83323     name: "y",
83324     handles: ["n", "s"].map(type),
83325     input: function(y2, e3) {
83326       return y2 == null ? null : [[e3[0][0], +y2[0]], [e3[1][0], +y2[1]]];
83327     },
83328     output: function(xy) {
83329       return xy && [xy[0][1], xy[1][1]];
83330     }
83331   };
83332   var XY = {
83333     name: "xy",
83334     handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
83335     input: function(xy) {
83336       return xy == null ? null : number22(xy);
83337     },
83338     output: function(xy) {
83339       return xy;
83340     }
83341   };
83342   function type(t2) {
83343     return { type: t2 };
83344   }
83345
83346   // modules/index.js
83347   var debug = false;
83348   var d3 = {
83349     dispatch: dispatch_default,
83350     geoMercator: mercator_default,
83351     geoProjection: projection,
83352     polygonArea: area_default3,
83353     polygonCentroid: centroid_default2,
83354     select: select_default2,
83355     selectAll: selectAll_default2,
83356     timerFlush
83357   };
83358
83359   // modules/id.js
83360   window.requestIdleCallback = window.requestIdleCallback || function(cb) {
83361     var start2 = Date.now();
83362     return window.requestAnimationFrame(function() {
83363       cb({
83364         didTimeout: false,
83365         timeRemaining: function() {
83366           return Math.max(0, 50 - (Date.now() - start2));
83367         }
83368       });
83369     });
83370   };
83371   window.cancelIdleCallback = window.cancelIdleCallback || function(id2) {
83372     window.cancelAnimationFrame(id2);
83373   };
83374   window.iD = modules_exports;
83375 })();
83376 //# sourceMappingURL=iD.js.map